aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotlaja <kotlaja@google.com>2023-10-04 19:20:45 +0200
committerGitHub <noreply@github.com>2023-10-04 19:20:45 +0200
commitf6bba6e43d7f21ca1fe1f301df3136e740df8393 (patch)
tree976470f2a429e750f319c021a11abf3b510f7639
parentaa4b3a862a8200c9422b7f7e050b12c7ef2c2a61 (diff)
downloadbazelbuild-rules_rust-f6bba6e43d7f21ca1fe1f301df3136e740df8393.tar.gz
Add `toolchain` parameter to the affected actions (#2140)
This is part of the migration of Automatic Exec Groups ([AEGs design doc](https://docs.google.com/document/d/1-rbP_hmKs9D639YWw5F_JyxPxL2bi6dSmmvj_WXak9M/edit#heading=h.5mcn15i0e1ch)). In this PR I've added a `toolchain` param to the affected actions (actions for which we can't detect if their tools/executable are coming from a toolchain). That's why sometimes it's set to None. The `toolchain` param is visible from Bazel 6.0, which rules_rust already supports. **Important note to reviewers**: Please check if the correct toolchain type is added for each action. I’ve done my best, but additional precaution is not harmful. 🙂 Also note that this toolchain param is not used right now since AEGs are still not enabled (there should be no errors). This is mostly step forward for the internal changes, and I will focus on enabling AEGs in Bazel after it's fully tested inside Google.
-rw-r--r--cargo/private/cargo_build_script.bzl1
-rw-r--r--rust/private/clippy.bzl1
-rw-r--r--rust/private/rustc.bzl3
3 files changed, 5 insertions, 0 deletions
diff --git a/cargo/private/cargo_build_script.bzl b/cargo/private/cargo_build_script.bzl
index b017f331..4609b5bc 100644
--- a/cargo/private/cargo_build_script.bzl
+++ b/cargo/private/cargo_build_script.bzl
@@ -256,6 +256,7 @@ def _cargo_build_script_impl(ctx):
mnemonic = "CargoBuildScriptRun",
progress_message = "Running Cargo build script {}".format(pkg_name),
env = env,
+ toolchain = None,
)
return [
diff --git a/rust/private/clippy.bzl b/rust/private/clippy.bzl
index 071ca29c..0f1f35ab 100644
--- a/rust/private/clippy.bzl
+++ b/rust/private/clippy.bzl
@@ -178,6 +178,7 @@ See https://github.com/bazelbuild/rules_rust/pull/1264#discussion_r853241339 for
tools = [toolchain.clippy_driver],
arguments = args.all,
mnemonic = "Clippy",
+ toolchain = "@rules_rust//rust:toolchain_type",
)
return [
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
index e76c20bd..501e1403 100644
--- a/rust/private/rustc.bzl
+++ b/rust/private/rustc.bzl
@@ -1268,6 +1268,7 @@ def rustc_compile_action(
formatted_version,
len(crate_info.srcs.to_list()),
),
+ toolchain = "@rules_rust//rust:toolchain_type",
)
if args_metadata:
ctx.actions.run(
@@ -1283,6 +1284,7 @@ def rustc_compile_action(
formatted_version,
len(crate_info.srcs.to_list()),
),
+ toolchain = "@rules_rust//rust:toolchain_type",
)
else:
# Run without process_wrapper
@@ -1301,6 +1303,7 @@ def rustc_compile_action(
formatted_version,
len(crate_info.srcs.to_list()),
),
+ toolchain = "@rules_rust//rust:toolchain_type",
)
if experimental_use_cc_common_link: