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", |
| 22 | includes = glob(["test_data/*.json"]), |
| 23 | parameters = {}, |
| 24 | visibility = ["//visibility:public"], |
| 25 | ) |
| 26 | |
| 27 | jinja2_template( |
| 28 | name = "constants.json", |
| 29 | src = "constants.jinja2.json", |
| 30 | includes = [ |
| 31 | "7971.json", |
| 32 | "971.json", |
| 33 | "9971.json", |
| 34 | "common.json", |
| 35 | ":target_map", |
| 36 | "//y2024/vision/maps", |
| 37 | ], |
| 38 | parameters = {}, |
| 39 | visibility = ["//visibility:public"], |
| 40 | ) |
| 41 | |
| 42 | filegroup( |
| 43 | name = "target_map", |
| 44 | srcs = [ |
| 45 | "target_map.json", |
| 46 | ], |
| 47 | visibility = ["//y2024:__subpackages__"], |
| 48 | ) |
| 49 | |
| 50 | static_flatbuffer( |
| 51 | name = "constants_fbs", |
| 52 | srcs = ["constants.fbs"], |
| 53 | visibility = ["//visibility:public"], |
| 54 | deps = [ |
| 55 | "//frc971/vision:target_map_fbs", |
| 56 | ], |
| 57 | ) |
| 58 | |
| 59 | static_flatbuffer( |
| 60 | name = "constants_list_fbs", |
| 61 | srcs = ["constants_list.fbs"], |
| 62 | visibility = ["//visibility:public"], |
| 63 | deps = [":constants_fbs"], |
| 64 | ) |
| 65 | |
| 66 | cc_binary( |
| 67 | name = "constants_sender", |
| 68 | srcs = ["constants_sender.cc"], |
| 69 | visibility = ["//visibility:public"], |
| 70 | deps = [ |
| 71 | ":constants_fbs", |
| 72 | ":constants_list_fbs", |
| 73 | "//aos:init", |
| 74 | "//aos/events:shm_event_loop", |
| 75 | "//aos/testing:path", |
| 76 | "//frc971/constants:constants_sender_lib", |
| 77 | ], |
| 78 | ) |
Maxwell Henderson | 6a929ff | 2024-01-14 20:03:59 -0800 | [diff] [blame^] | 79 | |
| 80 | cc_test( |
| 81 | name = "constants_validator_test", |
| 82 | srcs = ["constants_validator_test.cc"], |
| 83 | data = [":constants.json"], |
| 84 | visibility = ["//visibility:public"], |
| 85 | deps = [ |
| 86 | ":constants_list_fbs", |
| 87 | "//aos:json_to_flatbuffer", |
| 88 | "//aos/testing:googletest", |
| 89 | "@com_github_google_glog//:glog", |
| 90 | ], |
| 91 | ) |