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/ipc_lib/BUILD b/aos/ipc_lib/BUILD
index 0fb307a..7799cdc 100644
--- a/aos/ipc_lib/BUILD
+++ b/aos/ipc_lib/BUILD
@@ -9,6 +9,7 @@
linkopts = [
"-lpthread",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos:macros",
@@ -27,6 +28,7 @@
hdrs = [
"core_lib.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":aos_sync",
@@ -45,6 +47,7 @@
linkopts = [
"-lrt",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":aos_sync",
@@ -61,6 +64,7 @@
hdrs = [
"shared_mem_types.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":aos_sync",
],
@@ -74,6 +78,7 @@
tags = [
"manual",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":core_lib",
"//aos:die",
@@ -93,6 +98,7 @@
"ipc_comparison.cc",
],
linkopts = ["-lrt"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:condition",
"//aos:event",
@@ -112,6 +118,7 @@
hdrs = [
"signalfd.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"@com_github_google_glog//:glog",
@@ -123,6 +130,7 @@
srcs = [
"signalfd_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":signalfd",
"//aos/testing:googletest",
@@ -135,6 +143,7 @@
name = "index",
srcs = ["index.cc"],
hdrs = ["index.h"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"@com_github_google_glog//:glog",
@@ -144,6 +153,7 @@
cc_test(
name = "index_test",
srcs = ["index_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":index",
"//aos/testing:googletest",
@@ -158,6 +168,7 @@
"lockless_queue_memory.h",
],
hdrs = ["lockless_queue.h"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":aos_sync",
@@ -181,6 +192,7 @@
hdrs = [
"queue_racer.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":lockless_queue",
"//aos:event",
@@ -192,6 +204,7 @@
name = "lockless_queue_test",
timeout = "eternal",
srcs = ["lockless_queue_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":lockless_queue",
":queue_racer",
@@ -206,6 +219,7 @@
cc_test(
name = "lockless_queue_death_test",
srcs = ["lockless_queue_death_test.cc"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":lockless_queue",
":queue_racer",
@@ -224,6 +238,7 @@
hdrs = [
"data_alignment.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"@com_github_google_glog//:glog",
@@ -234,6 +249,7 @@
name = "latency_lib",
srcs = ["latency_lib.cc"],
hdrs = ["latency_lib.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:realtime",
"//aos/logging",
@@ -247,6 +263,7 @@
srcs = [
"signal_stress.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":latency_lib",
"//aos:init",
@@ -260,6 +277,7 @@
srcs = [
"futex_latency.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":latency_lib",
"//aos:condition",
@@ -274,6 +292,7 @@
srcs = [
"named_pipe_latency.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":latency_lib",
"//aos:init",
@@ -287,6 +306,7 @@
srcs = [
"eventfd_latency.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":latency_lib",
"//aos:init",
@@ -300,6 +320,7 @@
srcs = [
"print_lockless_queue_memory.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
":lockless_queue",