blob: 42cff81359c6fd40de6609026c013ca97ff4eb9d [file] [log] [blame]
Yash Maheshwarie0b25c52024-05-22 20:23:36 -07001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
2load("//tools/build_rules:template.bzl", "jinja2_template")
3load("//y2024_swerve/constants:validator.bzl", "constants_json")
4
5cc_library(
6 name = "simulated_constants_sender",
7 srcs = ["simulated_constants_sender.cc"],
8 hdrs = ["simulated_constants_sender.h"],
9 data = [":test_constants.json"],
10 visibility = ["//y2024_swerve:__subpackages__"],
11 deps = [
12 ":constants_fbs",
13 ":constants_list_fbs",
14 "//aos/events:simulated_event_loop",
15 "//aos/testing:path",
16 "//frc971/constants:constants_sender_lib",
17 ],
18)
19
20jinja2_template(
21 name = "test_constants_unvalidated.json",
22 src = "test_constants.jinja2.json",
23 includes = glob([
24 "test_data/*.json",
25 ]) + [
26 "common.jinja2",
27 "common.json",
28 "//y2024_swerve/constants/calib_files",
29 "//y2024_swerve/vision/maps",
30 ],
31 parameters = {},
32 visibility = ["//visibility:public"],
33)
34
35jinja2_template(
36 name = "constants_unvalidated.json",
37 src = "constants.jinja2.json",
38 includes = [
Yash Maheshwarie0b25c52024-05-22 20:23:36 -070039 "7971.json",
James Kuszmaul8078c952024-07-06 12:27:59 -070040 "9971.json",
Yash Maheshwarie0b25c52024-05-22 20:23:36 -070041 "common.jinja2",
42 "common.json",
43 "//y2024_swerve/constants/calib_files",
44 "//y2024_swerve/vision/maps",
45 ],
46 parameters = {},
47 visibility = ["//visibility:public"],
48)
49
50static_flatbuffer(
51 name = "constants_fbs",
52 srcs = ["constants.fbs"],
53 visibility = ["//visibility:public"],
54 deps = [
55 "//frc971/control_loops:profiled_subsystem_fbs",
56 "//frc971/control_loops/drivetrain:drivetrain_config_fbs",
James Kuszmauldf6b1682024-07-06 13:53:10 -070057 "//frc971/control_loops/swerve:swerve_zeroing_fbs",
Yash Maheshwarie0b25c52024-05-22 20:23:36 -070058 "//frc971/vision:calibration_fbs",
59 "//frc971/vision:target_map_fbs",
Nikolai Sohmersce9ee6e2024-07-06 17:16:20 -070060 "//frc971/wpilib/swerve:swerve_constants_fbs",
Yash Maheshwarie0b25c52024-05-22 20:23:36 -070061 "//frc971/zeroing:constants_fbs",
62 ],
63)
64
65static_flatbuffer(
66 name = "constants_list_fbs",
67 srcs = ["constants_list.fbs"],
68 visibility = ["//visibility:public"],
69 deps = [":constants_fbs"],
70)
71
72cc_binary(
73 name = "constants_sender",
74 srcs = ["constants_sender.cc"],
75 visibility = ["//visibility:public"],
76 deps = [
77 ":constants_fbs",
78 ":constants_list_fbs",
79 "//aos:init",
80 "//aos/events:shm_event_loop",
81 "//aos/testing:path",
82 "//frc971/constants:constants_sender_lib",
83 ],
84)
85
86cc_binary(
87 name = "constants_formatter",
88 srcs = ["constants_formatter.cc"],
89 data = [":constants_unvalidated.json"],
90 visibility = ["//visibility:public"],
91 deps = [
92 ":constants_list_fbs",
93 "//aos:init",
94 "//aos:json_to_flatbuffer",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070095 "@com_google_absl//absl/log",
96 "@com_google_absl//absl/log:check",
Yash Maheshwarie0b25c52024-05-22 20:23:36 -070097 ],
98)
99
100constants_json(
101 name = "constants_json",
102 src = ":constants_unvalidated.json",
103 out = "constants.json",
104)
105
106constants_json(
107 name = "test_constants_json",
108 src = ":test_constants_unvalidated.json",
109 out = "test_constants.json",
110)