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", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 35 | "//y2024/vision/maps", |
| 36 | ], |
| 37 | parameters = {}, |
| 38 | visibility = ["//visibility:public"], |
| 39 | ) |
| 40 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 41 | static_flatbuffer( |
| 42 | name = "constants_fbs", |
| 43 | srcs = ["constants.fbs"], |
| 44 | visibility = ["//visibility:public"], |
| 45 | deps = [ |
| 46 | "//frc971/vision:target_map_fbs", |
| 47 | ], |
| 48 | ) |
| 49 | |
| 50 | static_flatbuffer( |
| 51 | name = "constants_list_fbs", |
| 52 | srcs = ["constants_list.fbs"], |
| 53 | visibility = ["//visibility:public"], |
| 54 | deps = [":constants_fbs"], |
| 55 | ) |
| 56 | |
| 57 | cc_binary( |
| 58 | name = "constants_sender", |
| 59 | srcs = ["constants_sender.cc"], |
| 60 | visibility = ["//visibility:public"], |
| 61 | deps = [ |
| 62 | ":constants_fbs", |
| 63 | ":constants_list_fbs", |
| 64 | "//aos:init", |
| 65 | "//aos/events:shm_event_loop", |
| 66 | "//aos/testing:path", |
| 67 | "//frc971/constants:constants_sender_lib", |
| 68 | ], |
| 69 | ) |
Maxwell Henderson | 6a929ff | 2024-01-14 20:03:59 -0800 | [diff] [blame] | 70 | |
| 71 | cc_test( |
| 72 | name = "constants_validator_test", |
| 73 | srcs = ["constants_validator_test.cc"], |
| 74 | data = [":constants.json"], |
| 75 | visibility = ["//visibility:public"], |
| 76 | deps = [ |
| 77 | ":constants_list_fbs", |
| 78 | "//aos:json_to_flatbuffer", |
| 79 | "//aos/testing:googletest", |
| 80 | "@com_github_google_glog//:glog", |
| 81 | ], |
| 82 | ) |