Allow the Swift toolchain to be associated with an execution group and pass an optional execution group name down to actions that use it #1318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the following APIs:
swift_common.get_toolchain
now takes anexec_group
argument, which is will look up the toolchain underctx.exec_groups[NAME]
instead ofctx
.swift_common.{compile,compile_module_interface,precompile_clang_module}
now take anexec_group
argument, which is passed down to the underlyingctx.actions.run
call for actions using the toolchain.In all cases the default value of the argument is
None
, so omitting it retains the current behavior.Most importantly, this lets us declare the Swift toolchain somewhere other than the rule/aspect's
ctx
, which ensures that in a multiple toolchain scenario, the Swift toolchain doesn't fully decide the execution platform for all actions (even non-Swift actions).Since execution groups are somewhat in flux right now, this may not be the final form—it would be nice to have the coupling between the execution group and the toolchain automated. I considered just having each action be its own execution group (like C++ link actions use
cpp_link
), but that seems worse; Swift actions should almost never be split across different toolchains/platforms, and it would force the user to have to declare multiple exec groups if they wanted to use the feature with multiple actions. This lets them share something like a single "swift" execution group across multiple actions, with the only caveat being that they have to pass that name explicitly.PiperOrigin-RevId: 502638394
(cherry picked from commit aeee2bb)