Support multiple toolchains in subrules
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the feature request:
Subrules currently only support a single toolchain at a time, which limits their utility.
I understand that under automatic exec groups (which `subrule`s require for toolchain support) support for multiple toolchains in ordinary rules relies on [declaring explicit exec groups](https://github.com/bazelbuild/bazel/issues/19981#issuecomment-1895166984), so I suppose the request really is an ask for exec group declaration support in `subrule`s.
### Which category does this issue belong to?
Rules API
### What underlying problem are you trying to solve with this feature?
We have a set of helpers with which custom "sync" test rules (diff generated files against source files, with a `bazel run`-able update subcommand). This uses a copy-file and copy-to-directory toolchain (both from `@aspect_bazel_lib`), meaning it cannot be rewritten into a `subrule`.
### Which operating system are you running Bazel on?
Linux
### What is the output of `bazel info release`?
release 8.6.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start by reading the subrule and automatic exec group behavior in the Rules API, then review the explicit exec group discussion linked from issue #19981. Use the copy-file and copy-to-directory toolchains from @aspect_bazel_lib as the motivating case. Done means subrules can declare and use multiple toolchains through explicit exec groups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- build-system
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100