Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4.0]Add 'toolchain' parameter to actions.{run,run_shell} #16964

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ public void run(
Object inputManifestsUnchecked,
Object execGroupUnchecked,
Object shadowedActionUnchecked,
Object resourceSetUnchecked)
Object resourceSetUnchecked,
Object toolchainUnchecked)
throws EvalException {
context.checkMutable("actions.run");

Expand Down Expand Up @@ -455,7 +456,8 @@ public void runShell(
Object inputManifestsUnchecked,
Object execGroupUnchecked,
Object shadowedActionUnchecked,
Object resourceSetUnchecked)
Object resourceSetUnchecked,
Object toolchainUnchecked)
throws EvalException {
context.checkMutable("actions.run_shell");
RuleContext ruleContext = getRuleContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.google.devtools.build.lib.starlarkbuildapi;

import com.google.devtools.build.docgen.annot.DocCategory;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.Depset;
import net.starlark.java.annot.Param;
import net.starlark.java.annot.ParamType;
Expand Down Expand Up @@ -457,6 +458,25 @@ void symlink(
+ " <code>--experimental_action_resource_set</code> is false, the default"
+ " values are used.<p>The callback must be top-level (lambda and nested"
+ " functions aren't allowed)."),
@Param(
name = "toolchain",
allowedTypes = {
@ParamType(type = Label.class),
@ParamType(type = String.class),
@ParamType(type = NoneType.class),
},
defaultValue = "None",
named = true,
positional = false,
doc =
"<p>Toolchain type of the executable or tools used in this action. The parameter"
+ " must be set, so that, the action executes on the correct execution"
+ " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
+ " toolchain is used, because it will be required in the future Bazel"
+ " releases.</p><p>Note that the rule which creates this action needs to"
+ " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
+ " and `exec_group` parameters are both set, `exec_group` will be used. An"
+ " error is raised in case the `exec_group` doesn't specify the same."),
})
void run(
Sequence<?> outputs,
Expand All @@ -473,7 +493,8 @@ void run(
Object inputManifestsUnchecked,
Object execGroupUnchecked,
Object shadowedAction,
Object resourceSetUnchecked)
Object resourceSetUnchecked,
Object toolchainUnchecked)
throws EvalException;

@StarlarkMethod(
Expand Down Expand Up @@ -674,6 +695,26 @@ void run(
doc =
"A callback function for estimating resource usage if run locally. See"
+ "<a href=\"#run.resource_set\"><code>ctx.actions.run()</code></a>."),
@Param(
name = "toolchain",
allowedTypes = {
@ParamType(type = Label.class),
@ParamType(type = String.class),
@ParamType(type = NoneType.class),
},
defaultValue = "None",
named = true,
positional = false,
doc =
"<p>Toolchain type of the executable or tools used in this action. The parameter"
+ " must be set, so that, the action executes on the correct execution"
+ " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
+ " toolchain is used, because it will be required in the future Bazel"
+ " releases.</p><p>Note that the rule which creates this action needs to"
+ " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
+ " and `exec_group` parameters are both set, `exec_group` will be used. An"
+ " error is raised in case the `exec_group` doesn't specify the same."
+ " toolchain.</p>"),
})
void runShell(
Sequence<?> outputs,
Expand All @@ -689,7 +730,8 @@ void runShell(
Object inputManifestsUnchecked,
Object execGroupUnchecked,
Object shadowedAction,
Object resourceSetUnchecked)
Object resourceSetUnchecked,
Object toolchainUnchecked)
throws EvalException;

@StarlarkMethod(
Expand Down