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 net .starlark .java .annot .Param ;
2021import net .starlark .java .annot .ParamType ;
@@ -457,6 +458,25 @@ void symlink(
457458 + " <code>--experimental_action_resource_set</code> is false, the default"
458459 + " values are used.<p>The callback must be top-level (lambda and nested"
459460 + " functions aren't allowed)." ),
461+ @ Param (
462+ name = "toolchain" ,
463+ allowedTypes = {
464+ @ ParamType (type = Label .class ),
465+ @ ParamType (type = String .class ),
466+ @ ParamType (type = NoneType .class ),
467+ },
468+ defaultValue = "None" ,
469+ named = true ,
470+ positional = false ,
471+ doc =
472+ "<p>Toolchain type of the executable or tools used in this action. The parameter"
473+ + " must be set, so that, the action executes on the correct execution"
474+ + " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
475+ + " toolchain is used, because it will be required in the future Bazel"
476+ + " releases.</p><p>Note that the rule which creates this action needs to"
477+ + " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
478+ + " and `exec_group` parameters are both set, `exec_group` will be used. An"
479+ + " error is raised in case the `exec_group` doesn't specify the same." ),
460480 })
461481 void run (
462482 Sequence <?> outputs ,
@@ -473,7 +493,8 @@ void run(
473493 Object inputManifestsUnchecked ,
474494 Object execGroupUnchecked ,
475495 Object shadowedAction ,
476- Object resourceSetUnchecked )
496+ Object resourceSetUnchecked ,
497+ Object toolchainUnchecked )
477498 throws EvalException ;
478499
479500 @ StarlarkMethod (
@@ -674,6 +695,26 @@ void run(
674695 doc =
675696 "A callback function for estimating resource usage if run locally. See"
676697 + "<a href=\" #run.resource_set\" ><code>ctx.actions.run()</code></a>." ),
698+ @ Param (
699+ name = "toolchain" ,
700+ allowedTypes = {
701+ @ ParamType (type = Label .class ),
702+ @ ParamType (type = String .class ),
703+ @ ParamType (type = NoneType .class ),
704+ },
705+ defaultValue = "None" ,
706+ named = true ,
707+ positional = false ,
708+ doc =
709+ "<p>Toolchain type of the executable or tools used in this action. The parameter"
710+ + " must be set, so that, the action executes on the correct execution"
711+ + " platform. </p><p>It's a no-op right now, but we recommend to set it when a"
712+ + " toolchain is used, because it will be required in the future Bazel"
713+ + " releases.</p><p>Note that the rule which creates this action needs to"
714+ + " define this toolchain inside its 'rule()' function.</p><p>When `toolchain`"
715+ + " and `exec_group` parameters are both set, `exec_group` will be used. An"
716+ + " error is raised in case the `exec_group` doesn't specify the same."
717+ + " toolchain.</p>" ),
677718 })
678719 void runShell (
679720 Sequence <?> outputs ,
@@ -689,7 +730,8 @@ void runShell(
689730 Object inputManifestsUnchecked ,
690731 Object execGroupUnchecked ,
691732 Object shadowedAction ,
692- Object resourceSetUnchecked )
733+ Object resourceSetUnchecked ,
734+ Object toolchainUnchecked )
693735 throws EvalException ;
694736
695737 @ StarlarkMethod (
0 commit comments