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/aos/containers/BUILD b/aos/containers/BUILD
index 9e527cd..70d98f1 100644
--- a/aos/containers/BUILD
+++ b/aos/containers/BUILD
@@ -1,12 +1,11 @@
package(default_visibility = ["//visibility:public"])
-load("//tools:environments.bzl", "mcu_cpus")
-
cc_library(
name = "ring_buffer",
hdrs = [
"ring_buffer.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -14,6 +13,7 @@
srcs = [
"ring_buffer_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":ring_buffer",
"//aos/testing:googletest",
@@ -25,6 +25,7 @@
hdrs = [
"priority_queue.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_test(
@@ -32,6 +33,7 @@
srcs = [
"priority_queue_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":priority_queue",
"//aos/testing:googletest",
@@ -43,7 +45,6 @@
hdrs = [
"sized_array.h",
],
- compatible_with = mcu_cpus,
)
cc_test(
@@ -51,6 +52,7 @@
srcs = [
"sized_array_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":sized_array",
"//aos/testing:googletest",
@@ -62,6 +64,7 @@
hdrs = [
"resizeable_buffer.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"@com_github_google_glog//:glog",
],
@@ -72,6 +75,7 @@
srcs = [
"resizeable_buffer_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":resizeable_buffer",
"//aos/testing:googletest",