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/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",