1515package com .google .devtools .build .lib .starlarkbuildapi ;
1616
1717import com .google .devtools .build .docgen .annot .DocCategory ;
18+ import com .google .devtools .build .lib .cmdline .Label ;
1819import com .google .devtools .build .lib .collect .nestedset .Depset ;
1920import com .google .devtools .build .lib .packages .semantics .BuildLanguageOptions ;
2021import net .starlark .java .annot .Param ;
@@ -465,6 +466,25 @@ void symlink(
465466 + " <code>--experimental_action_resource_set</code> is false, the default"
466467 + " values are used.<p>The callback must be top-level (lambda and nested"
467468 + " functions aren't allowed)." ),
469+ @ Param (
470+ name = "toolchain" ,
471+ allowedTypes = {
472+ @ ParamType (type = Label .class ),
473+ @ ParamType (type = String .class ),
474+ @ ParamType (type = NoneType .class ),
475+ },
476+ defaultValue = "None" ,
477+ named = true ,
478+ positional = false ,
479+ doc =
480+ "<p>Toolchain type of the executable or tools used in this action. The parameter"
481+ + " must be set, so that, the action executes on the correct execution"
482+ + " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
483+ + " toolchain is used, because it will be required in the future Bazel"
484+ + " releases.</p><p>Note that the rule which creates this action needs to"
485+ + " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
486+ + " and `exec_group` parameters are both set, `exec_group` will be used. An"
487+ + " error is raised in case the `exec_group` doesn't specify the same." ),
468488 })
469489 void run (
470490 Sequence <?> outputs ,
@@ -481,7 +501,8 @@ void run(
481501 Object inputManifestsUnchecked ,
482502 Object execGroupUnchecked ,
483503 Object shadowedAction ,
484- Object resourceSetUnchecked )
504+ Object resourceSetUnchecked ,
505+ Object toolchainUnchecked )
485506 throws EvalException ;
486507
487508 @ StarlarkMethod (
@@ -682,6 +703,26 @@ void run(
682703 doc =
683704 "A callback function for estimating resource usage if run locally. See"
684705 + "<a href=\" #run.resource_set\" ><code>ctx.actions.run()</code></a>." ),
706+ @ Param (
707+ name = "toolchain" ,
708+ allowedTypes = {
709+ @ ParamType (type = Label .class ),
710+ @ ParamType (type = String .class ),
711+ @ ParamType (type = NoneType .class ),
712+ },
713+ defaultValue = "None" ,
714+ named = true ,
715+ positional = false ,
716+ doc =
717+ "<p>Toolchain type of the executable or tools used in this action. The parameter"
718+ + " must be set, so that, the action executes on the correct execution"
719+ + " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
720+ + " toolchain is used, because it will be required in the future Bazel"
721+ + " releases.</p><p>Note that the rule which creates this action needs to"
722+ + " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
723+ + " and `exec_group` parameters are both set, `exec_group` will be used. An"
724+ + " error is raised in case the `exec_group` doesn't specify the same."
725+ + " toolchain.</p>" ),
685726 })
686727 void runShell (
687728 Sequence <?> outputs ,
@@ -697,7 +738,8 @@ void runShell(
697738 Object inputManifestsUnchecked ,
698739 Object execGroupUnchecked ,
699740 Object shadowedAction ,
700- Object resourceSetUnchecked )
741+ Object resourceSetUnchecked ,
742+ Object toolchainUnchecked )
701743 throws EvalException ;
702744
703745 @ StarlarkMethod (
0 commit comments