Support for injecting custom toolchain features (approach injecting legacy features with example) #523
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.
Hi, this is just a draft how a proposal could look like to implement #517 on the legacy toolchain approach defining legacy toolchain features. Because there is no rule for that, rules for the providers should be created.
Another approach would be to support the injection of toolchain features in a legacy toolchain but require that such injected feature should be a rule-base feature and then the implementation just calls https://github.com/bazelbuild/rules_cc/blob/main/cc/toolchains/impl/legacy_converter.bzl#L105 before injecting it.
Let me know your opinion
If you want to try it out just run:
bazel build //examples/inject_extra_features:main --extra_toolchains=//examples/inject_extra_features/toolchain:my_linux_toolchain --toolchain_resolution_debug=.* --subcommands=pretty_print --features=foo