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/BUILD b/aos/network/BUILD
index c725ab7..4818aa2 100644
--- a/aos/network/BUILD
+++ b/aos/network/BUILD
@@ -11,6 +11,7 @@
includes = [
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_ts_library(
@@ -19,6 +20,7 @@
includes = [
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -28,6 +30,7 @@
includes = [
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -38,6 +41,7 @@
":message_bridge_server_fbs_includes",
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_cc_library(
@@ -47,6 +51,7 @@
includes = [
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
@@ -57,6 +62,7 @@
hdrs = [
"team_number.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos/util:string_to_num",
"@com_github_google_glog//:glog",
@@ -68,6 +74,7 @@
srcs = [
"team_number_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":team_number",
"//aos:configuration",
@@ -87,6 +94,7 @@
# The casts required to read datastructures from sockets trip -Wcast-align.
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:unique_malloc_ptr",
"//aos/util:file",
@@ -106,6 +114,7 @@
copts = [
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":sctp_lib",
"//third_party/lksctp-tools:sctp",
@@ -120,6 +129,7 @@
hdrs = [
"message_bridge_protocol.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":connect_fbs",
"//aos:configuration",
@@ -137,6 +147,7 @@
hdrs = [
"message_bridge_server_status.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":message_bridge_client_fbs",
":message_bridge_server_fbs",
@@ -160,6 +171,7 @@
copts = [
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":connect_fbs",
":message_bridge_client_fbs",
@@ -181,6 +193,7 @@
srcs = [
"message_bridge_server.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":message_bridge_server_lib",
"//aos:init",
@@ -200,6 +213,7 @@
copts = [
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":sctp_lib",
"//third_party/lksctp-tools:sctp",
@@ -214,6 +228,7 @@
hdrs = [
"message_bridge_client_status.h",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":message_bridge_client_fbs",
":message_bridge_server_fbs",
@@ -235,6 +250,7 @@
copts = [
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":connect_fbs",
":message_bridge_client_fbs",
@@ -256,6 +272,7 @@
copts = [
"-Wno-cast-align",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":message_bridge_client_lib",
"//aos:init",
@@ -275,18 +292,21 @@
"//aos/network:message_bridge_server_fbs",
"//aos/network:timestamp_fbs",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = ["//aos/events:config"],
)
aos_config(
name = "message_bridge_test_server_config",
src = "message_bridge_test_server.json",
+ target_compatible_with = ["@platforms//os:linux"],
deps = [":message_bridge_test_common_config"],
)
aos_config(
name = "message_bridge_test_client_config",
src = "message_bridge_test_client.json",
+ target_compatible_with = ["@platforms//os:linux"],
deps = [":message_bridge_test_common_config"],
)
@@ -300,6 +320,7 @@
":message_bridge_test_server_config",
],
shard_count = 5,
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":message_bridge_client_lib",
":message_bridge_server_lib",
@@ -320,6 +341,7 @@
":connect_fbs_includes",
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
flatbuffer_ts_library(
@@ -329,12 +351,14 @@
":connect_fbs_includes",
"//aos:configuration_fbs_includes",
],
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_library(
name = "web_proxy_utils",
srcs = ["web_proxy_utils.cc"],
hdrs = ["web_proxy_utils.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":connect_fbs",
":web_proxy_fbs",
@@ -352,6 +376,7 @@
"-DWEBRTC_POSIX",
"-Wno-unused-parameter",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":connect_fbs",
":web_proxy_fbs",
@@ -370,6 +395,7 @@
include = ["www_defaults/**/*"],
exclude = ["www/**/*"],
),
+ target_compatible_with = ["@platforms//os:linux"],
)
cc_binary(
@@ -384,6 +410,7 @@
"//aos/network/www:main_bundle.min.js",
"@com_github_google_flatbuffers//:flatjs",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":gen_embedded",
":web_proxy",
@@ -399,6 +426,7 @@
name = "timestamp_filter",
srcs = ["timestamp_filter.cc"],
hdrs = ["timestamp_filter.h"],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
"//aos:configuration",
"//aos/time",
@@ -412,6 +440,7 @@
srcs = [
"timestamp_filter_test.cc",
],
+ target_compatible_with = ["@platforms//os:linux"],
deps = [
":timestamp_filter",
"//aos:json_to_flatbuffer",