Updated `attr.label` attribute defaults to use `Label` constructor (#1422)
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index 3299c5c..c1c8747 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -650,21 +650,33 @@
default = "0.0.0",
),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ doc = (
+ "In order to use find_cc_toolchain, your rule has to depend " +
+ "on C++ toolchain. See `@rules_cc//cc:find_cc_toolchain.bzl` " +
+ "docs for details."
+ ),
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_collect_cc_coverage": attr.label(
- default = "//util:collect_coverage",
+ default = Label("//util:collect_coverage"),
executable = True,
cfg = "exec",
),
- "_error_format": attr.label(default = "//:error_format"),
- "_extra_exec_rustc_flags": attr.label(default = "//:extra_exec_rustc_flags"),
- "_extra_rustc_flags": attr.label(default = "//:extra_rustc_flags"),
+ "_error_format": attr.label(
+ default = Label("//:error_format"),
+ ),
+ "_extra_exec_rustc_flags": attr.label(
+ default = Label("//:extra_exec_rustc_flags"),
+ ),
+ "_extra_rustc_flags": attr.label(
+ default = Label("//:extra_rustc_flags"),
+ ),
"_import_macro_dep": attr.label(
- default = "@rules_rust//util/import",
+ default = Label("//util/import"),
cfg = "exec",
),
"_process_wrapper": attr.label(
+ doc = "A process wrapper for running rustc on all platforms.",
default = Label("//util/process_wrapper"),
executable = True,
allow_single_file = True,
diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl
index 86c2acd..a35bcd7 100644
--- a/rust/private/rustdoc.bzl
+++ b/rust/private/rustdoc.bzl
@@ -283,7 +283,7 @@
),
"_cc_toolchain": attr.label(
doc = "In order to use find_cpp_toolchain, you must define the '_cc_toolchain' attribute on your rule or aspect.",
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_dir_zipper": attr.label(
doc = "A tool that orchestrates the creation of zip archives for rustdoc outputs.",
diff --git a/rust/private/rustdoc_test.bzl b/rust/private/rustdoc_test.bzl
index f7bc97b..3a1124e 100644
--- a/rust/private/rustdoc_test.bzl
+++ b/rust/private/rustdoc_test.bzl
@@ -187,7 +187,7 @@
"on C++ toolchain. See @rules_cc//cc:find_cc_toolchain.bzl " +
"docs for details."
),
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_process_wrapper": attr.label(
doc = "A process wrapper for running rustdoc on all platforms",
diff --git a/rust/toolchain.bzl b/rust/toolchain.bzl
index 9a05459..8e25653 100644
--- a/rust/toolchain.bzl
+++ b/rust/toolchain.bzl
@@ -656,13 +656,13 @@
),
),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
"_rename_first_party_crates": attr.label(
- default = "@rules_rust//rust/settings:rename_first_party_crates",
+ default = Label("//rust/settings:rename_first_party_crates"),
),
"_third_party_dir": attr.label(
- default = "@rules_rust//rust/settings:third_party_dir",
+ default = Label("//rust/settings:third_party_dir"),
),
},
toolchains = [
diff --git a/test/process_wrapper/process_wrapper_tester.bzl b/test/process_wrapper/process_wrapper_tester.bzl
index 9a102a8..cf7e519 100644
--- a/test/process_wrapper/process_wrapper_tester.bzl
+++ b/test/process_wrapper/process_wrapper_tester.bzl
@@ -83,7 +83,7 @@
cfg = "exec",
),
"_process_wrapper_tester": attr.label(
- default = "//test/process_wrapper:process_wrapper_tester",
+ default = Label("//test/process_wrapper:process_wrapper_tester"),
executable = True,
cfg = "exec",
),
diff --git a/test/unit/consistent_crate_name/with_modified_crate_name.bzl b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
index f30d8be..a9d2590 100644
--- a/test/unit/consistent_crate_name/with_modified_crate_name.bzl
+++ b/test/unit/consistent_crate_name/with_modified_crate_name.bzl
@@ -57,13 +57,17 @@
implementation = _with_modified_crate_name_impl,
attrs = {
"deps": attr.label_list(),
- "src": attr.label(allow_single_file = [".rs"]),
- "_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ "src": attr.label(
+ allow_single_file = [".rs"],
),
- "_error_format": attr.label(default = "@rules_rust//:error_format"),
+ "_cc_toolchain": attr.label(
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
+ ),
+ "_error_format": attr.label(
+ default = Label("//:error_format"),
+ ),
"_process_wrapper": attr.label(
- default = Label("@rules_rust//util/process_wrapper"),
+ default = Label("//util/process_wrapper"),
executable = True,
allow_single_file = True,
cfg = "exec",
diff --git a/test/unit/force_all_deps_direct/generator.bzl b/test/unit/force_all_deps_direct/generator.bzl
index e8ab445..b44364f 100644
--- a/test/unit/force_all_deps_direct/generator.bzl
+++ b/test/unit/force_all_deps_direct/generator.bzl
@@ -76,11 +76,13 @@
attrs = {
"deps": attr.label_list(),
"_cc_toolchain": attr.label(
- default = "@bazel_tools//tools/cpp:current_cc_toolchain",
+ default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
),
- "_error_format": attr.label(default = "@rules_rust//:error_format"),
+ "_error_format": attr.label(
+ default = Label("//:error_format"),
+ ),
"_process_wrapper": attr.label(
- default = Label("@rules_rust//util/process_wrapper"),
+ default = Label("//util/process_wrapper"),
executable = True,
allow_single_file = True,
cfg = "exec",