Fix buildifier warnings in @rules_cc
Fixes:
* Enabled buildifier on the Bazel CI again
* Added Skydocs where missing
* Moved public files out of .../private/... (e.g. cc_toolchain_config_lib.bzl)
* Reformatted
* Removed unused loads
* Using relative labels for cc_configure related files
* Added development dependency on rules_proto
* they're not in the federation yet, so hand rolling in rules_cc's WORKSPACE file
* Added development dependency on rules_python (from federation)
* Cleaned up copybara (notable change - not using @rules_cc in labels inside rules_cc repo)
* Made cc_flags_supplier usable internally
* Moved load statements to the top of the bzl file
* Moved runfiles to the tools directory
* Unified toolchain_utils.bzl and find_cc_toolchain.bzl
RELNOTES: None.
PiperOrigin-RevId: 276479521
diff --git a/tools/cpp/BUILD.empty b/tools/cpp/BUILD.empty
index fd95fc4..286ea0f 100644
--- a/tools/cpp/BUILD.empty
+++ b/tools/cpp/BUILD.empty
@@ -35,8 +35,6 @@
cc_toolchain(
name = "local",
- toolchain_identifier = "local",
- toolchain_config = ":local_config",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -45,6 +43,8 @@
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
+ toolchain_config = ":local_config",
+ toolchain_identifier = "local",
)
cc_toolchain_config(name = "local_config")
diff --git a/tools/cpp/BUILD.static.freebsd b/tools/cpp/BUILD.static.freebsd
index ded0f537..d9a3b5c 100644
--- a/tools/cpp/BUILD.static.freebsd
+++ b/tools/cpp/BUILD.static.freebsd
@@ -41,8 +41,6 @@
cc_toolchain(
name = "cc-compiler-freebsd",
- toolchain_identifier = "local_freebsd",
- toolchain_config = ":local_freebsd",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -52,6 +50,8 @@
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
+ toolchain_config = ":local_freebsd",
+ toolchain_identifier = "local_freebsd",
)
cc_toolchain_config(
@@ -75,8 +75,6 @@
cc_toolchain(
name = "cc-compiler-armeabi-v7a",
- toolchain_identifier = "stub_armeabi-v7a",
- toolchain_config = ":stub_armeabi-v7a",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
@@ -86,6 +84,8 @@
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
+ toolchain_config = ":stub_armeabi-v7a",
+ toolchain_identifier = "stub_armeabi-v7a",
)
cc_toolchain_config(
diff --git a/tools/cpp/BUILD.toolchains.tpl b/tools/cpp/BUILD.toolchains.tpl
index a5c2eb2..6cffe1b 100644
--- a/tools/cpp/BUILD.toolchains.tpl
+++ b/tools/cpp/BUILD.toolchains.tpl
@@ -1,4 +1,5 @@
load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
+
toolchain(
name = "cc-toolchain-%{name}",
exec_compatible_with = HOST_CONSTRAINTS,
@@ -17,4 +18,3 @@
toolchain = "@local_config_cc//:cc-compiler-armeabi-v7a",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
-
diff --git a/tools/cpp/osx_cc_configure.bzl b/tools/cpp/osx_cc_configure.bzl
index 1ead7d6..5fab306 100644
--- a/tools/cpp/osx_cc_configure.bzl
+++ b/tools/cpp/osx_cc_configure.bzl
@@ -24,7 +24,6 @@
load(
"@bazel_tools//tools/cpp:unix_cc_configure.bzl",
"configure_unix_toolchain",
- "find_cc",
"get_env",
"get_escaped_cxx_inc_directories",
)