Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 1 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
| 2 | load("//tools/build_rules:template.bzl", "jinja2_template") |
| 3 | |
| 4 | cc_library( |
| 5 | name = "simulated_constants_sender", |
| 6 | srcs = ["simulated_constants_sender.cc"], |
| 7 | hdrs = ["simulated_constants_sender.h"], |
| 8 | data = [":test_constants.json"], |
| 9 | visibility = ["//y2024:__subpackages__"], |
| 10 | deps = [ |
| 11 | ":constants_fbs", |
| 12 | ":constants_list_fbs", |
| 13 | "//aos/events:simulated_event_loop", |
| 14 | "//aos/testing:path", |
| 15 | "//frc971/constants:constants_sender_lib", |
| 16 | ], |
| 17 | ) |
| 18 | |
| 19 | jinja2_template( |
| 20 | name = "test_constants.json", |
| 21 | src = "test_constants.jinja2.json", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 22 | includes = glob([ |
| 23 | "test_data/*.json", |
| 24 | ]) + [ |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 25 | "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 26 | "//y2024/control_loops/drivetrain:drivetrain_config.json", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 27 | "common.json", |
Maxwell Henderson | de14bbb | 2024-01-29 13:59:28 -0800 | [diff] [blame^] | 28 | "common.jinja2", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 29 | "//y2024/vision/maps", |
| 30 | ], |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 31 | parameters = {}, |
| 32 | visibility = ["//visibility:public"], |
| 33 | ) |
| 34 | |
| 35 | jinja2_template( |
| 36 | name = "constants.json", |
| 37 | src = "constants.jinja2.json", |
| 38 | includes = [ |
| 39 | "7971.json", |
| 40 | "971.json", |
| 41 | "9971.json", |
Maxwell Henderson | de14bbb | 2024-01-29 13:59:28 -0800 | [diff] [blame^] | 42 | "common.jinja2", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 43 | "common.json", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 44 | "//y2024/control_loops/drivetrain:drivetrain_config.json", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 45 | "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 46 | "//y2024/vision/maps", |
| 47 | ], |
| 48 | parameters = {}, |
| 49 | visibility = ["//visibility:public"], |
| 50 | ) |
| 51 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 52 | static_flatbuffer( |
| 53 | name = "constants_fbs", |
| 54 | srcs = ["constants.fbs"], |
| 55 | visibility = ["//visibility:public"], |
| 56 | deps = [ |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 57 | "//frc971/control_loops:profiled_subsystem_fbs", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 58 | "//frc971/control_loops/drivetrain:drivetrain_config_fbs", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 59 | "//frc971/vision:target_map_fbs", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 60 | "//frc971/zeroing:constants_fbs", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 61 | ], |
| 62 | ) |
| 63 | |
| 64 | static_flatbuffer( |
| 65 | name = "constants_list_fbs", |
| 66 | srcs = ["constants_list.fbs"], |
| 67 | visibility = ["//visibility:public"], |
| 68 | deps = [":constants_fbs"], |
| 69 | ) |
| 70 | |
| 71 | cc_binary( |
| 72 | name = "constants_sender", |
| 73 | srcs = ["constants_sender.cc"], |
| 74 | visibility = ["//visibility:public"], |
| 75 | deps = [ |
| 76 | ":constants_fbs", |
| 77 | ":constants_list_fbs", |
| 78 | "//aos:init", |
| 79 | "//aos/events:shm_event_loop", |
| 80 | "//aos/testing:path", |
| 81 | "//frc971/constants:constants_sender_lib", |
| 82 | ], |
| 83 | ) |
Maxwell Henderson | 6a929ff | 2024-01-14 20:03:59 -0800 | [diff] [blame] | 84 | |
| 85 | cc_test( |
| 86 | name = "constants_validator_test", |
| 87 | srcs = ["constants_validator_test.cc"], |
| 88 | data = [":constants.json"], |
| 89 | visibility = ["//visibility:public"], |
| 90 | deps = [ |
| 91 | ":constants_list_fbs", |
| 92 | "//aos:json_to_flatbuffer", |
| 93 | "//aos/testing:googletest", |
| 94 | "@com_github_google_glog//:glog", |
| 95 | ], |
| 96 | ) |