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