Switch everything to platforms
This patch switches the codebase over from using the "cpu"
mechanism to using bazel platforms. See
https://docs.bazel.build/versions/master/platforms.html for some more
information.
Most of the substantial changes are in //tools. Instead of using
`cc_toolchain_suite` rules, we now use regular `toolchain` rules that
are registered in the WORKSPACE. That also means that bazel now uses
the target platform to select the compiler.
All --cpu=* arguments should now be --config=* arguments. For example,
`--cpu=roborio` should now be `--config=roborio`. The CI script and
all documentation has been updated to reflect that.
The remainder of the changes revolve around tagging all targets with
`target_compatible_with`. The old mechanism allowed us to specify
repo-wide defaults. The new mechanism does not. That means every
target that didn't have any compatibility specified, now requires
compatibility with `@platforms//os:linux`.
I used buildozer for the vast majority of `target_compatible_with`
changes. buildozer automatically buildifies any BUILD files it
touches. That means this patch also contains a few non-functional
changes that I was too lazy to remove.
Change-Id: I66d6e6ad9161520ee397597cdb492585820a3acd
diff --git a/frc971/BUILD b/frc971/BUILD
index 563f05e..d6a3af8 100644
--- a/frc971/BUILD
+++ b/frc971/BUILD
@@ -1,13 +1,10 @@
package(default_visibility = ["//visibility:public"])
-load("//tools:environments.bzl", "mcu_cpus")
-
cc_library(
name = "shifter_hall_effect",
hdrs = [
"shifter_hall_effect.h",
],
- compatible_with = mcu_cpus,
)
cc_library(
@@ -15,10 +12,12 @@
hdrs = [
"constants.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
py_library(
name = "python_init",
srcs = ["__init__.py"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
diff --git a/frc971/analysis/BUILD b/frc971/analysis/BUILD
index 2686bcd..61355b0 100644
--- a/frc971/analysis/BUILD
+++ b/frc971/analysis/BUILD
@@ -11,7 +11,7 @@
"plotter.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":python_init",
"@matplotlib_repo//:matplotlib2.7",
@@ -21,6 +21,7 @@
py_library(
name = "python_init",
srcs = ["__init__.py"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = ["//frc971:python_init"],
)
@@ -28,7 +29,7 @@
name = "py_log_reader.so",
srcs = ["py_log_reader.cc"],
linkshared = True,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:configuration",
"//aos:json_to_flatbuffer",
@@ -47,13 +48,14 @@
":py_log_reader.so",
"@sample_logfile//file",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = ["//aos:configuration_fbs_python"],
)
py_proto_library(
name = "plot_config_proto",
srcs = ["plot_config.proto"],
+ target_compatible_with = ["@platforms//os:linux"],
)
py_binary(
@@ -62,7 +64,7 @@
data = [
":py_log_reader.so",
] + glob(["plot_configs/**"]),
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":plot_config_proto",
":python_init",
@@ -76,6 +78,6 @@
data = [
"@sample_logfile//file",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [":plot"],
)
diff --git a/frc971/autonomous/BUILD b/frc971/autonomous/BUILD
index 12698a9..414f817 100644
--- a/frc971/autonomous/BUILD
+++ b/frc971/autonomous/BUILD
@@ -7,6 +7,7 @@
name = "auto_fbs",
srcs = ["auto.fbs"],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
@@ -14,6 +15,7 @@
name = "auto_mode_fbs",
srcs = ["auto_mode.fbs"],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
@@ -25,6 +27,7 @@
hdrs = [
"base_autonomous_actor.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":auto_fbs",
"//aos/actions:action_lib",
@@ -47,5 +50,6 @@
":auto_fbs",
":auto_mode_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
diff --git a/frc971/codelab/BUILD b/frc971/codelab/BUILD
index ddc5466..c50a2c1 100644
--- a/frc971/codelab/BUILD
+++ b/frc971/codelab/BUILD
@@ -8,6 +8,7 @@
testonly = 1,
srcs = ["basic_test.cc"],
data = [":config"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":basic",
":basic_goal_fbs",
@@ -26,6 +27,7 @@
name = "basic",
srcs = ["basic.cc"],
hdrs = ["basic.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":basic_goal_fbs",
":basic_output_fbs",
@@ -41,6 +43,7 @@
"basic_goal.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -49,6 +52,7 @@
"basic_output.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -57,6 +61,7 @@
"basic_status.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -65,6 +70,7 @@
"basic_position.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
aos_config(
@@ -76,6 +82,7 @@
":basic_status_fbs",
":basic_output_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/robot_state:config",
],
diff --git a/frc971/config/BUILD b/frc971/config/BUILD
index 098d1f8..dbb81b9 100644
--- a/frc971/config/BUILD
+++ b/frc971/config/BUILD
@@ -11,5 +11,6 @@
":sctp.ko",
"@arm_frc_linux_gnueabi_repo//:compiler_pieces",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
diff --git a/frc971/control_loops/BUILD b/frc971/control_loops/BUILD
index 7d3b915..1945db9 100644
--- a/frc971/control_loops/BUILD
+++ b/frc971/control_loops/BUILD
@@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"])
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-load("//tools:environments.bzl", "mcu_cpus")
cc_library(
name = "team_number_test_environment",
@@ -12,6 +11,7 @@
hdrs = [
"team_number_test_environment.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/network:team_number",
"//aos/testing:googletest",
@@ -23,6 +23,7 @@
srcs = [
"hybrid_state_feedback_loop_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":hybrid_state_feedback_loop",
"//aos/testing:googletest",
@@ -32,6 +33,7 @@
cc_library(
name = "pose",
hdrs = ["pose.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/util:math",
"@org_tuxfamily_eigen//:eigen",
@@ -41,6 +43,7 @@
cc_test(
name = "pose_test",
srcs = ["pose_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":pose",
"//aos/testing:googletest",
@@ -52,6 +55,7 @@
hdrs = [
"hall_effect_tracker.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":control_loops_fbs",
],
@@ -62,7 +66,6 @@
srcs = [
"control_loops.fbs",
],
- compatible_with = mcu_cpus,
)
cc_test(
@@ -70,6 +73,7 @@
srcs = [
"position_sensor_sim_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":control_loops_fbs",
":position_sensor_sim",
@@ -90,6 +94,7 @@
linkopts = [
"-lm",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":control_loops_fbs",
":gaussian_noise",
@@ -108,21 +113,7 @@
linkopts = [
"-lm",
],
-)
-
-cc_library(
- name = "coerce_goal_uc",
- srcs = [
- "coerce_goal.cc",
- ],
- hdrs = [
- "coerce_goal.h",
- ],
- restricted_to = mcu_cpus,
- deps = [
- "//aos/controls:polytope_uc",
- "@org_tuxfamily_eigen//:eigen",
- ],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -133,9 +124,10 @@
hdrs = [
"coerce_goal.h",
],
- linkopts = [
- "-lm",
- ],
+ linkopts = select({
+ "@platforms//os:linux": ["-lm"],
+ "//conditions:default": [],
+ }),
deps = [
"//aos/controls:polytope",
"@org_tuxfamily_eigen//:eigen",
@@ -150,6 +142,7 @@
linkopts = [
"-lm",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":coerce_goal",
"//aos/controls:polytope",
@@ -158,20 +151,6 @@
],
)
-# TODO(austin): Select isn't working right. We should be able to remove
-# logging conditionally with select and have CPU constraints work correctly.
-cc_library(
- name = "state_feedback_loop_uc",
- hdrs = [
- "state_feedback_loop.h",
- ],
- restricted_to = mcu_cpus,
- deps = [
- "//aos:macros",
- "@org_tuxfamily_eigen//:eigen",
- ],
-)
-
cc_library(
name = "state_feedback_loop",
hdrs = [
@@ -179,9 +158,11 @@
],
deps = [
"//aos:macros",
- "//aos/logging",
"@org_tuxfamily_eigen//:eigen",
- ],
+ ] + select({
+ "@platforms//os:linux": ["//aos/logging"],
+ "//conditions:default": [],
+ }),
)
cc_library(
@@ -189,6 +170,7 @@
hdrs = [
"hybrid_state_feedback_loop.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":c2d",
":state_feedback_loop",
@@ -204,6 +186,7 @@
hdrs = [
"simple_capped_state_feedback_loop.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":state_feedback_loop",
"@org_tuxfamily_eigen//:eigen",
@@ -215,6 +198,7 @@
hdrs = [
"runge_kutta.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"@org_tuxfamily_eigen//:eigen",
],
@@ -225,6 +209,7 @@
srcs = [
"runge_kutta_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":runge_kutta",
"//aos/testing:googletest",
@@ -237,6 +222,7 @@
hdrs = [
"fixed_quadrature.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -244,6 +230,7 @@
srcs = [
"fixed_quadrature_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":fixed_quadrature",
"//aos/testing:googletest",
@@ -258,6 +245,7 @@
includes = [
":control_loops_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -268,6 +256,7 @@
hdrs = [
"profiled_subsystem.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":control_loops_fbs",
":profiled_subsystem_fbs",
@@ -284,6 +273,7 @@
hdrs = [
"jacobian.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"@org_tuxfamily_eigen//:eigen",
],
@@ -294,6 +284,7 @@
srcs = [
"jacobian_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":jacobian",
"//aos/testing:googletest",
@@ -306,6 +297,7 @@
srcs = [
"c2d_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":c2d",
@@ -319,6 +311,7 @@
hdrs = [
"c2d.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos/time",
@@ -331,6 +324,7 @@
hdrs = [
"dlqr.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"@org_tuxfamily_eigen//:eigen",
@@ -341,6 +335,7 @@
py_library(
name = "python_init",
srcs = ["__init__.py"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = ["//frc971:python_init"],
)
@@ -348,6 +343,7 @@
cc_library(
name = "binomial",
hdrs = ["binomial.h"],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -355,6 +351,7 @@
srcs = [
"binomial_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":binomial",
"//aos/testing:googletest",
@@ -370,6 +367,7 @@
hdrs = [
"capped_test_plant.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":state_feedback_loop",
"//aos/testing:googletest",
@@ -381,6 +379,7 @@
hdrs = [
"static_zeroing_single_dof_profiled_subsystem.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//frc971/control_loops:profiled_subsystem",
],
@@ -395,6 +394,7 @@
"static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
],
cmd = "$(location //frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test) $(OUTS)",
+ target_compatible_with = ["@platforms//os:linux"],
tools = [
"//frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test",
],
@@ -410,6 +410,7 @@
"static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
"static_zeroing_single_dof_profiled_subsystem_test_plant.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":state_feedback_loop",
],
@@ -424,6 +425,7 @@
":control_loops_fbs_includes",
":profiled_subsystem_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -431,6 +433,7 @@
srcs = [
"static_zeroing_single_dof_profiled_subsystem_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":capped_test_plant",
":position_sensor_sim",
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index ed905cf..042c8d8 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -2,13 +2,11 @@
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
load("//aos:config.bzl", "aos_config")
-load("//tools:environments.bzl", "mcu_cpus")
-load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select")
+load("//tools/build_rules:select.bzl", "cpu_select")
flatbuffer_cc_library(
name = "drivetrain_goal_fbs",
srcs = ["drivetrain_goal.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
includes = ["//frc971/control_loops:control_loops_fbs_includes"],
)
@@ -16,21 +14,18 @@
flatbuffer_cc_library(
name = "drivetrain_output_fbs",
srcs = ["drivetrain_output.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
)
flatbuffer_cc_library(
name = "drivetrain_position_fbs",
srcs = ["drivetrain_position.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
)
flatbuffer_cc_library(
name = "drivetrain_status_fbs",
srcs = ["drivetrain_status.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
includes = ["//frc971/control_loops:control_loops_fbs_includes"],
)
@@ -39,6 +34,7 @@
name = "drivetrain_status_ts_fbs",
srcs = ["drivetrain_status.fbs"],
includes = ["//frc971/control_loops:control_loops_fbs_includes"],
+ target_compatible_with = ["@platforms//os:linux"],
)
genrule(
@@ -46,7 +42,6 @@
srcs = ["drivetrain_goal.fbs"],
outs = ["drivetrain_goal_float.fbs"],
cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
- compatible_with = mcu_cpus,
)
genrule(
@@ -54,7 +49,6 @@
srcs = ["drivetrain_position.fbs"],
outs = ["drivetrain_position_float.fbs"],
cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
- compatible_with = mcu_cpus,
)
genrule(
@@ -62,7 +56,6 @@
srcs = ["drivetrain_output.fbs"],
outs = ["drivetrain_output_float.fbs"],
cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
- compatible_with = mcu_cpus,
)
genrule(
@@ -70,13 +63,11 @@
srcs = ["drivetrain_status.fbs"],
outs = ["drivetrain_status_float.fbs"],
cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
- compatible_with = mcu_cpus,
)
flatbuffer_cc_library(
name = "drivetrain_goal_float_fbs",
srcs = ["drivetrain_goal_float.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
includes = ["//frc971/control_loops:control_loops_fbs_includes"],
)
@@ -84,21 +75,18 @@
flatbuffer_cc_library(
name = "drivetrain_output_float_fbs",
srcs = ["drivetrain_output_float.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
)
flatbuffer_cc_library(
name = "drivetrain_position_float_fbs",
srcs = ["drivetrain_position_float.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
)
flatbuffer_cc_library(
name = "drivetrain_status_float_fbs",
srcs = ["drivetrain_status_float.fbs"],
- compatible_with = mcu_cpus,
gen_reflections = 1,
includes = ["//frc971/control_loops:control_loops_fbs_includes"],
)
@@ -109,12 +97,14 @@
flatbuffers = [
":drivetrain_status_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
aos_config(
name = "simulation_config",
src = "drivetrain_simulation_config.json",
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":config",
@@ -136,6 +126,7 @@
"//frc971/wpilib:imu_fbs",
"//frc971/wpilib:imu_batch_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos/robot_state:config",
@@ -149,14 +140,17 @@
],
deps = [
"//frc971:shifter_hall_effect",
- "//frc971/control_loops:hybrid_state_feedback_loop",
"//frc971/control_loops:state_feedback_loop",
- ],
+ ] + select({
+ "@platforms//os:linux": ["//frc971/control_loops:hybrid_state_feedback_loop"],
+ "//conditions:default": [],
+ }),
)
cc_library(
name = "hybrid_ekf",
hdrs = ["hybrid_ekf.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
"//aos:math",
@@ -171,6 +165,7 @@
cc_test(
name = "hybrid_ekf_test",
srcs = ["hybrid_ekf_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_test_lib",
":hybrid_ekf",
@@ -185,11 +180,13 @@
name = "localizer_fbs",
srcs = ["localizer.fbs"],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
name = "localizer",
hdrs = ["localizer.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_status_fbs",
@@ -204,7 +201,6 @@
hdrs = [
"gear.h",
],
- compatible_with = mcu_cpus,
)
cc_library(
@@ -215,6 +211,7 @@
hdrs = [
"splinedrivetrain.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":distance_spline",
":drivetrain_config",
@@ -238,6 +235,7 @@
hdrs = [
"line_follow_drivetrain.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_goal_fbs",
@@ -260,7 +258,7 @@
name = "line_follow_drivetrain_test",
srcs = ["line_follow_drivetrain_test.cc"],
linkstatic = True,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_test_lib",
@@ -281,6 +279,7 @@
hdrs = [
"ssdrivetrain.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_goal_fbs",
@@ -309,58 +308,34 @@
hdrs = [
"polydrivetrain.h",
],
+ copts = select({
+ "@platforms//os:none": ["-Wno-type-limits"],
+ "//conditions:default": [],
+ }),
deps = [
":drivetrain_config",
- ":drivetrain_goal_fbs",
- ":drivetrain_output_fbs",
- ":drivetrain_position_fbs",
- ":drivetrain_status_fbs",
":gear",
"//aos:math",
"//aos/controls:polytope",
- "//aos/robot_state:robot_state_fbs",
- "//aos/util:log_interval",
"//frc971/control_loops:coerce_goal",
"//frc971/control_loops:control_loops_fbs",
"//frc971/control_loops:state_feedback_loop",
- ],
-)
-
-cc_library(
- name = "drivetrain_config_uc",
- hdrs = [
- "drivetrain_config.h",
- ],
- restricted_to = mcu_cpus,
- deps = [
- "//frc971:shifter_hall_effect",
- "//frc971/control_loops:state_feedback_loop_uc",
- ],
-)
-
-cc_library(
- name = "polydrivetrain_uc",
- srcs = [
- "polydrivetrain.cc",
- ],
- hdrs = [
- "polydrivetrain.h",
- ],
- copts = ["-Wno-type-limits"],
- restricted_to = mcu_cpus,
- deps = [
- ":drivetrain_config_uc",
- ":drivetrain_goal_float_fbs",
- ":drivetrain_output_float_fbs",
- ":drivetrain_position_float_fbs",
- ":drivetrain_status_float_fbs",
- ":gear",
- "//aos:math",
- "//aos/controls:polytope_uc",
- "//frc971/control_loops:coerce_goal_uc",
- "//frc971/control_loops:control_loops_fbs",
- "//frc971/control_loops:state_feedback_loop_uc",
- ],
+ ] + select({
+ "@platforms//os:linux": [
+ ":drivetrain_goal_fbs",
+ ":drivetrain_output_fbs",
+ ":drivetrain_position_fbs",
+ ":drivetrain_status_fbs",
+ "//aos/robot_state:robot_state_fbs",
+ "//aos/util:log_interval",
+ ],
+ "@platforms//os:none": [
+ ":drivetrain_goal_float_fbs",
+ ":drivetrain_output_float_fbs",
+ ":drivetrain_position_float_fbs",
+ ":drivetrain_status_float_fbs",
+ ],
+ }),
)
genrule(
@@ -370,6 +345,7 @@
"down_estimator.cc",
],
cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
+ target_compatible_with = ["@platforms//os:linux"],
tools = [
"//frc971/control_loops/python:down_estimator",
],
@@ -384,6 +360,7 @@
hdrs = [
"down_estimator.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//frc971/control_loops:state_feedback_loop",
],
@@ -397,6 +374,7 @@
hdrs = [
"drivetrain.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":down_estimator",
":drivetrain_goal_fbs",
@@ -433,6 +411,7 @@
],
"arm": [],
}),
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_goal_fbs",
@@ -471,6 +450,7 @@
"arm": [],
}),
linkstatic = True,
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_lib",
@@ -506,7 +486,6 @@
"integral_haptic_trigger.cc",
],
cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
- compatible_with = mcu_cpus,
tools = [
"//frc971/control_loops/python:haptic_wheel",
],
@@ -514,26 +493,6 @@
)
cc_library(
- name = "haptic_input_uc",
- srcs = [
- "haptic_trigger.cc",
- "haptic_wheel.cc",
- "integral_haptic_trigger.cc",
- "integral_haptic_wheel.cc",
- ],
- hdrs = [
- "haptic_trigger.h",
- "haptic_wheel.h",
- "integral_haptic_trigger.h",
- "integral_haptic_wheel.h",
- ],
- restricted_to = mcu_cpus,
- deps = [
- "//frc971/control_loops:state_feedback_loop_uc",
- ],
-)
-
-cc_library(
name = "haptic_wheel",
srcs = [
"haptic_trigger.cc",
@@ -556,6 +515,7 @@
name = "spline",
srcs = ["spline.cc"],
hdrs = ["spline.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//frc971/control_loops:binomial",
"@org_tuxfamily_eigen//:eigen",
@@ -566,6 +526,7 @@
name = "spline.so",
srcs = ["libspline.cc"],
linkshared = True,
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":distance_spline",
":spline",
@@ -582,7 +543,7 @@
srcs = [
"spline_test.cc",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":spline",
"//aos/testing:googletest",
@@ -595,6 +556,7 @@
name = "distance_spline",
srcs = ["distance_spline.cc"],
hdrs = ["distance_spline.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":spline",
"//aos/logging",
@@ -616,6 +578,7 @@
"arm": [],
}),
linkstatic = True,
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":distance_spline",
"//aos/testing:googletest",
@@ -633,6 +596,7 @@
name = "trajectory",
srcs = ["trajectory.cc"],
hdrs = ["trajectory.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":distance_spline",
":drivetrain_config",
@@ -650,7 +614,7 @@
srcs = [
"trajectory_plot.cc",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":distance_spline",
":trajectory",
@@ -676,6 +640,7 @@
"arm": [],
}),
linkstatic = True,
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":trajectory",
":drivetrain_test_lib",
@@ -700,6 +665,7 @@
hdrs = [
"improved_down_estimator.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_config",
":drivetrain_status_fbs",
@@ -718,6 +684,7 @@
srcs = [
"improved_down_estimator_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":drivetrain_test_lib",
"//aos/controls:quaternion_utils",
@@ -731,6 +698,7 @@
cc_library(
name = "camera",
srcs = ["camera.h"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos/containers:sized_array",
@@ -741,6 +709,7 @@
cc_test(
name = "camera_test",
srcs = ["camera_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":camera",
"//aos/testing:googletest",
diff --git a/frc971/control_loops/python/BUILD b/frc971/control_loops/python/BUILD
index 7953474..7851397 100644
--- a/frc971/control_loops/python/BUILD
+++ b/frc971/control_loops/python/BUILD
@@ -6,7 +6,7 @@
"haptic_wheel.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
"//external:python-gflags",
"//external:python-glog",
@@ -28,7 +28,7 @@
"//third_party/cddlib:_cddlib.so",
"@python_repo//:scipy",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":python_init",
"//external:python-glog",
@@ -42,7 +42,7 @@
"polytope_test.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":controls",
":python_init",
@@ -55,7 +55,7 @@
"down_estimator.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":controls",
":python_init",
@@ -68,7 +68,7 @@
srcs = [
"drivetrain.py",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":controls",
":python_init",
@@ -84,6 +84,7 @@
data = [
"//frc971/control_loops/drivetrain:spline.so",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":python_init",
],
@@ -94,6 +95,7 @@
srcs = [
"lib_spline_test.py",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":libspline",
":python_init",
@@ -105,7 +107,7 @@
srcs = [
"polydrivetrain.py",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":controls",
":drivetrain",
@@ -117,6 +119,7 @@
py_library(
name = "python_init",
srcs = ["__init__.py"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = ["//frc971/control_loops:python_init"],
)
@@ -127,7 +130,7 @@
"spline.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
"//external:python-gflags",
"//external:python-glog",
@@ -140,7 +143,7 @@
py_library(
name = "linear_system",
srcs = ["linear_system.py"],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:public"],
deps = [
":controls",
@@ -153,7 +156,7 @@
py_library(
name = "angular_system",
srcs = ["angular_system.py"],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:public"],
deps = [
":controls",
@@ -175,7 +178,7 @@
"spline_writer.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:public"],
deps = [
":basic_window",
@@ -192,7 +195,7 @@
"basic_window.py",
"color.py",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:public"],
deps = [
":python_init",
@@ -205,7 +208,7 @@
srcs = [
"color.py",
],
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
visibility = ["//visibility:public"],
deps = [
":python_init",
@@ -218,7 +221,7 @@
"static_zeroing_single_dof_profiled_subsystem_test.py",
],
legacy_create_init = False,
- restricted_to = ["//tools:k8"],
+ target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":controls",
":linear_system",
diff --git a/frc971/control_loops/voltage_cap/BUILD b/frc971/control_loops/voltage_cap/BUILD
index 2aa1dea..1bf2b8d 100644
--- a/frc971/control_loops/voltage_cap/BUILD
+++ b/frc971/control_loops/voltage_cap/BUILD
@@ -8,6 +8,7 @@
hdrs = [
"voltage_cap.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -15,6 +16,7 @@
srcs = [
"voltage_cap_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":voltage_cap",
"//aos/testing:googletest",
diff --git a/frc971/downloader.bzl b/frc971/downloader.bzl
index 7f188dd..aebcb87 100644
--- a/frc971/downloader.bzl
+++ b/frc971/downloader.bzl
@@ -8,7 +8,7 @@
data = [],
dirs = None,
default_target = None,
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["@//tools/platforms/hardware:roborio"],
target_type = "roborio"):
"""Sets up the standard robot download targets.
@@ -29,7 +29,7 @@
dirs = dirs,
target_type = target_type,
default_target = default_target,
- restricted_to = restricted_to,
+ target_compatible_with = target_compatible_with,
)
aos_downloader(
@@ -44,5 +44,5 @@
dirs = dirs,
target_type = target_type,
default_target = default_target,
- restricted_to = restricted_to,
+ target_compatible_with = target_compatible_with,
)
diff --git a/frc971/downloader/BUILD b/frc971/downloader/BUILD
index 1aab653..58f8cdc 100644
--- a/frc971/downloader/BUILD
+++ b/frc971/downloader/BUILD
@@ -8,5 +8,6 @@
"@ssh",
"@ssh//:scp",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
diff --git a/frc971/queues/BUILD b/frc971/queues/BUILD
index 4005092..44ee59e 100644
--- a/frc971/queues/BUILD
+++ b/frc971/queues/BUILD
@@ -8,6 +8,7 @@
"gyro.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -16,4 +17,5 @@
"gyro_uid.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
diff --git a/frc971/shooter_interpolation/BUILD b/frc971/shooter_interpolation/BUILD
index cce93e1..8a63f5d 100644
--- a/frc971/shooter_interpolation/BUILD
+++ b/frc971/shooter_interpolation/BUILD
@@ -6,6 +6,7 @@
hdrs = [
"interpolation.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
@@ -14,6 +15,7 @@
srcs = [
"interpolation_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":interpolation",
"//aos/testing:googletest",
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index 21472f8..e7c52bf 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -9,6 +9,7 @@
"logging.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -19,7 +20,7 @@
hdrs = [
"encoder_and_potentiometer.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":dma",
":dma_edge_counting",
@@ -37,7 +38,7 @@
hdrs = [
"dma_edge_counting.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":dma",
"//aos/logging",
@@ -53,7 +54,7 @@
hdrs = [
"interrupt_edge_counting.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos:init",
"//aos/logging",
@@ -73,7 +74,7 @@
"buffered_pcm.h",
"buffered_solenoid.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos/logging",
"//third_party:wpilib",
@@ -90,7 +91,7 @@
],
# This library uses some deprecated parts of the SPI API.
copts = ["-Wno-deprecated-declarations"],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos/logging",
"//aos/time",
@@ -106,7 +107,7 @@
hdrs = [
"gyro_sender.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":gyro_interface",
"//aos:init",
@@ -128,6 +129,7 @@
"loop_output_handler_test.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
aos_config(
@@ -137,6 +139,7 @@
":pdp_values_fbs",
":logging_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
aos_config(
@@ -145,6 +148,7 @@
flatbuffers = [
":loop_output_handler_test_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/events:config",
],
@@ -158,6 +162,7 @@
hdrs = [
"loop_output_handler.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:init",
"//aos/events:event_loop",
@@ -176,6 +181,7 @@
data = [
":loop_output_handler_test_config",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":loop_output_handler",
":loop_output_handler_test_fbs",
@@ -193,7 +199,7 @@
hdrs = [
"joystick_sender.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos:init",
"//aos/events:shm_event_loop",
@@ -212,7 +218,7 @@
hdrs = [
"wpilib_interface.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos/events:event_loop",
"//aos/robot_state:robot_state_fbs",
@@ -226,6 +232,7 @@
"pdp_values.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -236,7 +243,7 @@
hdrs = [
"pdp_fetcher.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":pdp_values_fbs",
"//aos:init",
@@ -252,7 +259,7 @@
hdrs = [
"wpilib_robot_base.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//third_party:wpilib",
],
@@ -264,6 +271,7 @@
"imu.fbs",
],
gen_reflections = 1,
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -275,6 +283,7 @@
includes = [
":imu_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -285,7 +294,7 @@
hdrs = [
"ADIS16470.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":fpga_time_conversion",
":imu_batch_fbs",
@@ -309,7 +318,7 @@
],
# This library uses some deprecated parts of the SPI API.
copts = ["-Wno-deprecated-declarations"],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":fpga_time_conversion",
":imu_fbs",
@@ -332,7 +341,7 @@
hdrs = [
"dma.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//third_party:wpilib",
],
@@ -346,6 +355,7 @@
hdrs = [
"spi_rx_clearer.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/logging",
],
@@ -359,7 +369,7 @@
hdrs = [
"sensor_reader.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":dma",
":dma_edge_counting",
@@ -386,7 +396,7 @@
hdrs = [
"drivetrain_writer.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
":loop_output_handler",
"//aos:math",
@@ -404,7 +414,7 @@
hdrs = [
"fpga_time_conversion.h",
],
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos/time",
"//aos/util:compiler_memory_barrier",
diff --git a/frc971/wpilib/ahal/BUILD b/frc971/wpilib/ahal/BUILD
index 44341b7..350aa90 100644
--- a/frc971/wpilib/ahal/BUILD
+++ b/frc971/wpilib/ahal/BUILD
@@ -8,13 +8,14 @@
"const char *WPILibVersion = \"2018-frc971\";",
"EOF",
]),
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
name = "ahal",
srcs = glob(["*.cc"]) + [":wpilib_version"],
hdrs = glob(["*.h"]),
- restricted_to = ["//tools:roborio"],
+ target_compatible_with = ["//tools/platforms/hardware:roborio"],
visibility = ["//third_party:__pkg__"],
deps = [
"//aos:make_unique",
diff --git a/frc971/zeroing/BUILD b/frc971/zeroing/BUILD
index df85290..cd90e8d 100644
--- a/frc971/zeroing/BUILD
+++ b/frc971/zeroing/BUILD
@@ -1,12 +1,11 @@
package(default_visibility = ["//visibility:public"])
-load("//tools:environments.bzl", "mcu_cpus")
-
cc_library(
name = "averager",
hdrs = [
"averager.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"@com_github_google_glog//:glog",
"@org_tuxfamily_eigen//:eigen",
@@ -18,6 +17,7 @@
srcs = [
"averager_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":averager",
"//aos/testing:googletest",
@@ -33,6 +33,7 @@
hdrs = [
"imu_zeroer.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":averager",
"//frc971/control_loops:control_loops_fbs",
@@ -48,6 +49,7 @@
srcs = [
"imu_zeroer_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":imu_zeroer",
"//aos:flatbuffers",
@@ -59,22 +61,23 @@
cc_library(
name = "zeroing",
srcs = [
+ "absolute_and_absolute_encoder.cc",
"absolute_encoder.cc",
"hall_effect_and_position.cc",
"pot_and_absolute_encoder.cc",
"pot_and_index.cc",
"pulse_index.cc",
- "absolute_and_absolute_encoder.cc",
],
hdrs = [
+ "absolute_and_absolute_encoder.h",
"absolute_encoder.h",
"hall_effect_and_position.h",
"pot_and_absolute_encoder.h",
"pot_and_index.h",
"pulse_index.h",
"zeroing.h",
- "absolute_and_absolute_encoder.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":wrap",
"//aos/logging",
@@ -87,15 +90,16 @@
cc_test(
name = "zeroing_test",
srcs = [
+ "absolute_and_absolute_encoder_test.cc",
"absolute_encoder_test.cc",
"hall_effect_and_position_test.cc",
"pot_and_absolute_encoder_test.cc",
"pot_and_index_test.cc",
"pulse_index_test.cc",
"relative_encoder_test.cc",
- "absolute_and_absolute_encoder_test.cc",
"zeroing_test.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":zeroing",
"//aos/testing:googletest",
@@ -113,7 +117,6 @@
hdrs = [
"wrap.h",
],
- compatible_with = mcu_cpus,
)
cc_test(
@@ -121,6 +124,7 @@
srcs = [
"wrap_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":wrap",
"//aos/testing:googletest",
@@ -132,6 +136,7 @@
srcs = [
"unwrap_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":wrap",
"//aos/testing:googletest",