diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java index 306e37de6f21e3..a78e07c6362559 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkActionFactory.java @@ -369,7 +369,8 @@ public void run( Object inputManifestsUnchecked, Object execGroupUnchecked, Object shadowedActionUnchecked, - Object resourceSetUnchecked) + Object resourceSetUnchecked, + Object toolchainUnchecked) throws EvalException { context.checkMutable("actions.run"); @@ -480,7 +481,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(); diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java index 832b11ccdc69c8..b25b482f5d749d 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java @@ -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 com.google.devtools.build.lib.packages.semantics.BuildLanguageOptions; import net.starlark.java.annot.Param; @@ -465,6 +466,25 @@ void symlink( + " --experimental_action_resource_set is false, the default" + " values are used.

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 = + "

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.

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.

Note that the rule which creates this action needs to" + + " define this toolchain inside its 'rule()' function.

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, @@ -481,7 +501,8 @@ void run( Object inputManifestsUnchecked, Object execGroupUnchecked, Object shadowedAction, - Object resourceSetUnchecked) + Object resourceSetUnchecked, + Object toolchainUnchecked) throws EvalException; @StarlarkMethod( @@ -682,6 +703,26 @@ void run( doc = "A callback function for estimating resource usage if run locally. See" + "ctx.actions.run()."), + @Param( + name = "toolchain", + allowedTypes = { + @ParamType(type = Label.class), + @ParamType(type = String.class), + @ParamType(type = NoneType.class), + }, + defaultValue = "None", + named = true, + positional = false, + doc = + "

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.

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.

Note that the rule which creates this action needs to" + + " define this toolchain inside its 'rule()' function.

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.

"), }) void runShell( Sequence outputs, @@ -697,7 +738,8 @@ void runShell( Object inputManifestsUnchecked, Object execGroupUnchecked, Object shadowedAction, - Object resourceSetUnchecked) + Object resourceSetUnchecked, + Object toolchainUnchecked) throws EvalException; @StarlarkMethod(