Update ~all flatbuffer rules to static_flatbuffer rules
Don't update things that use unions or circular dependencies.
Used buildozer to make most changes; didn't document the precise steps,
but the approximate steps were:
* Alter the load statements to use the new rule.
* Make all flatbuffer_cc_library rules:
* No longer specify gen_reflections.
* Move all includes attributes to use deps (including stripping the
_includes prefix off of the items in the includes list).
* Rename all flatbuffer_cc_library rules to static_flatbuffer rules.
* Manually fix the spyglass flatbuffer_py_library target that depended
directly on some outputs of the flatbuffer_cc_library macro.
* Manually undo anything that can't build with the new rules (should
just be the json_to_flatbuffer target, web_proxy_fbs, and one of the
flatbuffers used to test the static flatbuffers codegen itself).
* Run the cleanup to get rid of unused load statements.
Change-Id: Ie37a13585228847b19177dc86a9aa603ad90e890
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/y2022/BUILD b/y2022/BUILD
index 8d9d901..a839f37 100644
--- a/y2022/BUILD
+++ b/y2022/BUILD
@@ -1,6 +1,6 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//frc971:downloader.bzl", "robot_downloader")
load("//aos:config.bzl", "aos_config")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("//tools/build_rules:template.bzl", "jinja2_template")
load("//aos/util:config_validator_macro.bzl", "config_validator_test")
@@ -303,12 +303,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "setpoint_fbs",
srcs = [
"setpoint.fbs",
],
- gen_reflections = 1,
target_compatible_with = ["@platforms//os:linux"],
)
diff --git a/y2022/control_loops/superstructure/BUILD b/y2022/control_loops/superstructure/BUILD
index e370f0e..0f2737d 100644
--- a/y2022/control_loops/superstructure/BUILD
+++ b/y2022/control_loops/superstructure/BUILD
@@ -1,46 +1,42 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:js.bzl", "ts_project")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
package(default_visibility = ["//visibility:public"])
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_goal_fbs",
srcs = [
"superstructure_goal.fbs",
],
- gen_reflections = 1,
- includes = [
- "//frc971/control_loops:control_loops_fbs_includes",
- "//frc971/control_loops:profiled_subsystem_fbs_includes",
+ deps = [
+ "//frc971/control_loops:control_loops_fbs",
+ "//frc971/control_loops:profiled_subsystem_fbs",
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_output_fbs",
srcs = [
"superstructure_output.fbs",
],
- gen_reflections = 1,
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_can_position_fbs",
srcs = [
"superstructure_can_position.fbs",
],
- gen_reflections = 1,
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_status_fbs",
srcs = [
"superstructure_status.fbs",
],
- gen_reflections = 1,
- includes = [
- "//frc971/control_loops:control_loops_fbs_includes",
- "//frc971/control_loops:profiled_subsystem_fbs_includes",
+ deps = [
+ "//frc971/control_loops:control_loops_fbs",
+ "//frc971/control_loops:profiled_subsystem_fbs",
],
)
@@ -55,15 +51,14 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_position_fbs",
srcs = [
"superstructure_position.fbs",
],
- gen_reflections = 1,
- includes = [
- "//frc971/control_loops:control_loops_fbs_includes",
- "//frc971/control_loops:profiled_subsystem_fbs_includes",
+ deps = [
+ "//frc971/control_loops:control_loops_fbs",
+ "//frc971/control_loops:profiled_subsystem_fbs",
],
)
diff --git a/y2022/localizer/BUILD b/y2022/localizer/BUILD
index 7f076e8..63f720f 100644
--- a/y2022/localizer/BUILD
+++ b/y2022/localizer/BUILD
@@ -1,5 +1,5 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:js.bzl", "ts_project")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
@@ -16,12 +16,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "localizer_status_fbs",
srcs = [
"localizer_status.fbs",
],
- gen_reflections = True,
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
@@ -42,16 +41,15 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "localizer_visualization_fbs",
srcs = ["localizer_visualization.fbs"],
- gen_reflections = 1,
- includes = [
- ":localizer_status_fbs_includes",
- "//frc971/control_loops:control_loops_fbs_includes",
- "//frc971/control_loops/drivetrain:drivetrain_status_fbs_includes",
- ],
visibility = ["//visibility:public"],
+ deps = [
+ ":localizer_status_fbs",
+ "//frc971/control_loops:control_loops_fbs",
+ "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
+ ],
)
flatbuffer_ts_library(
diff --git a/y2022/vision/BUILD b/y2022/vision/BUILD
index 99fb95d..523ee04 100644
--- a/y2022/vision/BUILD
+++ b/y2022/vision/BUILD
@@ -1,5 +1,5 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:js.bzl", "ts_project")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
ts_project(
@@ -176,15 +176,14 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "ball_color_fbs",
srcs = ["ball_color.fbs"],
- gen_reflections = 1,
- includes = [
- "//frc971/input:joystick_state_fbs_includes",
- ],
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//y2022:__subpackages__"],
+ deps = [
+ "//frc971/input:joystick_state_fbs",
+ ],
)
cc_library(
@@ -231,15 +230,14 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "target_estimate_fbs",
srcs = ["target_estimate.fbs"],
- gen_reflections = 1,
- includes = [
- "//frc971/vision:calibration_fbs_includes",
- ],
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//y2022:__subpackages__"],
+ deps = [
+ "//frc971/vision:calibration_fbs",
+ ],
)
flatbuffer_ts_library(