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/network/www/BUILD b/aos/network/www/BUILD
index 4987a30..8142e24 100644
--- a/aos/network/www/BUILD
+++ b/aos/network/www/BUILD
@@ -1,5 +1,5 @@
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
-load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary")
+load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
load("//aos:config.bzl", "aos_config")
filegroup(
@@ -17,6 +17,7 @@
"config_handler.ts",
"proxy.ts",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos:configuration_ts_fbs",
@@ -32,6 +33,7 @@
"main.ts",
"ping_handler.ts",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":proxy",
"//aos/events:ping_ts_fbs",
@@ -42,6 +44,7 @@
name = "main_bundle",
enable_code_splitting = False,
entry_point = "main.ts",
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//aos:__subpackages__"],
deps = [
":main",
@@ -57,6 +60,7 @@
"flatbuffers.js",
],
cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//aos:__subpackages__"],
)
@@ -65,6 +69,7 @@
srcs = [
"reflection_test_main.ts",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":reflection_ts",
"//aos:configuration_ts_fbs",
@@ -77,6 +82,7 @@
ts_library(
name = "reflection_ts",
srcs = ["reflection.ts"],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
"//aos:configuration_ts_fbs",
@@ -90,6 +96,7 @@
srcs = [
"plotter.ts",
],
+ target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
@@ -98,6 +105,7 @@
srcs = [
"graph_main.ts",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":plotter",
":proxy",
@@ -112,6 +120,7 @@
name = "graph_main_bundle",
enable_code_splitting = False,
entry_point = "graph_main.ts",
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":graph_main",
],
@@ -124,6 +133,7 @@
"//aos:configuration_fbs",
"//aos:json_to_flatbuffer_flatbuffer",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/events:config",
],
@@ -133,6 +143,7 @@
name = "reflection_test_bundle",
enable_code_splitting = False,
entry_point = "reflection_test_main.ts",
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":reflection_test_main",
],
@@ -150,4 +161,5 @@
"//aos/network:web_proxy_main",
"//y2020:config",
],
+ target_compatible_with = ["@platforms//os:linux"],
)