incompatible_disallow_ctx_resolve_tools #22249
Labels
incompatible-change
Incompatible/breaking change
migration-ready
Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green
This flag disallows uses of the
ctx.resolve_tools
API, which is awkward to use and redundant with other existing APIs.To migrate, replace this pattern:
with one of
or
When using
ctx.actions.run_shell
, the latter form is required. Otherwise, when usingctx.actions.run
, prefer the former (i.e., if the tool in question is theexecutable
for the action, there's no need to also pass it undertools
).Note that
ctx.executable._my_tool
refers solely to the executable file, but passing it to theexecutable
ortools
argument automatically includes its associated runfiles in the action inputs, as long as the tool is a direct dependency of the target callingctx.actions.run/ctx.actions.run_shell
. If you want to pass the tool around (e.g., in a returned provider) for other targets to use, you must obtain aFilesToRunProvider
viactx.attr._my_tool[DefaultInfo].files_to_run
, and pass it around instead.The text was updated successfully, but these errors were encountered: