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", |
Filip Kujawa | 37aa0bc | 2024-01-31 20:59:49 -0800 | [diff] [blame] | 26 | "//y2024/control_loops/superstructure/climber:climber_json", |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 27 | "//y2024/control_loops/superstructure/catapult:catapult_json", |
| 28 | "//y2024/control_loops/superstructure/altitude:altitude_json", |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 29 | "//y2024/control_loops/superstructure/extend:extend_json", |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 30 | "//y2024/control_loops/superstructure/turret:turret_json", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 31 | "//y2024/control_loops/drivetrain:drivetrain_config.json", |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 32 | "//y2024/constants/calib_files", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 33 | "common.json", |
Maxwell Henderson | de14bbb | 2024-01-29 13:59:28 -0800 | [diff] [blame] | 34 | "common.jinja2", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 35 | "//y2024/vision/maps", |
| 36 | ], |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 37 | parameters = {}, |
| 38 | visibility = ["//visibility:public"], |
| 39 | ) |
| 40 | |
| 41 | jinja2_template( |
| 42 | name = "constants.json", |
| 43 | src = "constants.jinja2.json", |
| 44 | includes = [ |
| 45 | "7971.json", |
| 46 | "971.json", |
| 47 | "9971.json", |
Maxwell Henderson | de14bbb | 2024-01-29 13:59:28 -0800 | [diff] [blame] | 48 | "common.jinja2", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 49 | "common.json", |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 50 | "//y2024/constants/calib_files", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 51 | "//y2024/control_loops/drivetrain:drivetrain_config.json", |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 52 | "//y2024/control_loops/superstructure/altitude:altitude_json", |
| 53 | "//y2024/control_loops/superstructure/catapult:catapult_json", |
Filip Kujawa | 37aa0bc | 2024-01-31 20:59:49 -0800 | [diff] [blame] | 54 | "//y2024/control_loops/superstructure/climber:climber_json", |
Austin Schuh | 3db875a | 2024-02-18 20:02:40 -0800 | [diff] [blame] | 55 | "//y2024/control_loops/superstructure/extend:extend_json", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 56 | "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json", |
Niko Sohmers | 3bfe3d6 | 2024-02-18 16:09:49 -0800 | [diff] [blame] | 57 | "//y2024/control_loops/superstructure/turret:turret_json", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 58 | "//y2024/vision/maps", |
| 59 | ], |
| 60 | parameters = {}, |
| 61 | visibility = ["//visibility:public"], |
| 62 | ) |
| 63 | |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 64 | static_flatbuffer( |
| 65 | name = "constants_fbs", |
| 66 | srcs = ["constants.fbs"], |
| 67 | visibility = ["//visibility:public"], |
| 68 | deps = [ |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 69 | "//frc971/control_loops:profiled_subsystem_fbs", |
James Kuszmaul | 2549e75 | 2024-01-20 17:42:51 -0800 | [diff] [blame] | 70 | "//frc971/control_loops/drivetrain:drivetrain_config_fbs", |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 71 | "//frc971/vision:calibration_fbs", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 72 | "//frc971/vision:target_map_fbs", |
Niko Sohmers | b21dbdc | 2024-01-20 20:06:59 -0800 | [diff] [blame] | 73 | "//frc971/zeroing:constants_fbs", |
Niko Sohmers | 3860f8a | 2024-01-12 21:05:19 -0800 | [diff] [blame] | 74 | ], |
| 75 | ) |
| 76 | |
| 77 | static_flatbuffer( |
| 78 | name = "constants_list_fbs", |
| 79 | srcs = ["constants_list.fbs"], |
| 80 | visibility = ["//visibility:public"], |
| 81 | deps = [":constants_fbs"], |
| 82 | ) |
| 83 | |
| 84 | cc_binary( |
| 85 | name = "constants_sender", |
| 86 | srcs = ["constants_sender.cc"], |
| 87 | visibility = ["//visibility:public"], |
| 88 | deps = [ |
| 89 | ":constants_fbs", |
| 90 | ":constants_list_fbs", |
| 91 | "//aos:init", |
| 92 | "//aos/events:shm_event_loop", |
| 93 | "//aos/testing:path", |
| 94 | "//frc971/constants:constants_sender_lib", |
| 95 | ], |
| 96 | ) |
Maxwell Henderson | 6a929ff | 2024-01-14 20:03:59 -0800 | [diff] [blame] | 97 | |
| 98 | cc_test( |
| 99 | name = "constants_validator_test", |
| 100 | srcs = ["constants_validator_test.cc"], |
| 101 | data = [":constants.json"], |
| 102 | visibility = ["//visibility:public"], |
| 103 | deps = [ |
| 104 | ":constants_list_fbs", |
| 105 | "//aos:json_to_flatbuffer", |
| 106 | "//aos/testing:googletest", |
| 107 | "@com_github_google_glog//:glog", |
| 108 | ], |
| 109 | ) |