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/y2023/constants/BUILD b/y2023/constants/BUILD
index c91aa56..512e400 100644
--- a/y2023/constants/BUILD
+++ b/y2023/constants/BUILD
@@ -1,4 +1,4 @@
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:template.bzl", "jinja2_template")
cc_library(
@@ -49,10 +49,9 @@
visibility = ["//y2023:__subpackages__"],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "constants_fbs",
srcs = ["constants.fbs"],
- gen_reflections = True,
visibility = ["//visibility:public"],
deps = [
"//frc971/vision:calibration_fbs",
@@ -61,10 +60,9 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "constants_list_fbs",
srcs = ["constants_list.fbs"],
- gen_reflections = True,
visibility = ["//visibility:public"],
deps = [":constants_fbs"],
)
diff --git a/y2023/control_loops/drivetrain/BUILD b/y2023/control_loops/drivetrain/BUILD
index f6b5655..01c360b 100644
--- a/y2023/control_loops/drivetrain/BUILD
+++ b/y2023/control_loops/drivetrain/BUILD
@@ -1,5 +1,5 @@
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//aos:config.bzl", "aos_config")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
genrule(
name = "genrule_drivetrain",
@@ -115,21 +115,19 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "target_selector_status_fbs",
srcs = [
":target_selector_status.fbs",
],
- gen_reflections = 1,
visibility = ["//visibility:public"],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "target_selector_hint_fbs",
srcs = [
":target_selector_hint.fbs",
],
- gen_reflections = 1,
visibility = ["//visibility:public"],
deps = [
"//frc971/control_loops/drivetrain:drivetrain_status_fbs",
diff --git a/y2023/control_loops/superstructure/BUILD b/y2023/control_loops/superstructure/BUILD
index 3d35dae..f62d790 100644
--- a/y2023/control_loops/superstructure/BUILD
+++ b/y2023/control_loops/superstructure/BUILD
@@ -1,35 +1,32 @@
+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,
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_status_fbs",
srcs = [
"superstructure_status.fbs",
],
- gen_reflections = 1,
deps = [
"//frc971/control_loops:control_loops_fbs",
"//frc971/control_loops:profiled_subsystem_fbs",
@@ -49,12 +46,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "superstructure_position_fbs",
srcs = [
"superstructure_position.fbs",
],
- gen_reflections = 1,
deps = [
"//frc971/control_loops:control_loops_fbs",
"//frc971/control_loops:profiled_subsystem_fbs",
diff --git a/y2023/control_loops/superstructure/arm/BUILD b/y2023/control_loops/superstructure/arm/BUILD
index 768a54e..2f4e7d6 100644
--- a/y2023/control_loops/superstructure/arm/BUILD
+++ b/y2023/control_loops/superstructure/arm/BUILD
@@ -1,4 +1,4 @@
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
cc_library(
name = "arm",
@@ -73,12 +73,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "arm_trajectories_fbs",
srcs = [
"arm_trajectories.fbs",
],
- gen_reflections = 1,
visibility = ["//visibility:public"],
)
diff --git a/y2023/localizer/BUILD b/y2023/localizer/BUILD
index f9d0d28..eb0f886 100644
--- a/y2023/localizer/BUILD
+++ b/y2023/localizer/BUILD
@@ -1,4 +1,4 @@
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//tools/build_rules:js.bzl", "ts_project")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
@@ -15,12 +15,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "status_fbs",
srcs = [
"status.fbs",
],
- gen_reflections = True,
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
@@ -39,12 +38,11 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "visualization_fbs",
srcs = [
"visualization.fbs",
],
- gen_reflections = True,
visibility = ["//visibility:public"],
deps = [
":status_fbs",
@@ -60,24 +58,22 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "scoring_map_fbs",
srcs = [
"scoring_map.fbs",
],
- gen_reflections = True,
visibility = ["//visibility:public"],
deps = [
"//frc971/vision:target_map_fbs",
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "relative_scoring_map_fbs",
srcs = [
"relative_scoring_map.fbs",
],
- gen_reflections = True,
visibility = ["//visibility:public"],
deps = [
":scoring_map_fbs",
diff --git a/y2023/vision/BUILD b/y2023/vision/BUILD
index 512bb58..82b804b 100644
--- a/y2023/vision/BUILD
+++ b/y2023/vision/BUILD
@@ -1,7 +1,7 @@
load("//frc971:halide.bzl", "halide_library")
load("//tools/build_rules:select.bzl", "cpu_select")
-load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
+load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
cc_binary(
name = "camera_reader",
@@ -308,10 +308,9 @@
],
)
-flatbuffer_cc_library(
+static_flatbuffer(
name = "game_pieces_fbs",
srcs = ["game_pieces.fbs"],
- gen_reflections = 1,
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)