Skip to content

Conversation

@limdor
Copy link
Contributor

@limdor limdor commented Nov 13, 2025

Hi, this is just a draft how a proposal could look like to implement #517 on the legacy toolchain approach but injecting features defined with the new rules-based toolchain approach. In my opinion it looks much more elegant than #523 and it would also be easier for users to later migrate to the new rules-based toolchain approach.

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

This is a draft proposal to inject rules-based toolchain features
into the legacy toolchain.
@limdor limdor force-pushed the inject_rules_based_features branch from f8959db to 4295909 Compare November 13, 2025 12:33
@limdor limdor changed the title Draft proposal to inject extra features (rule-based features) Support for injecting custom toolchain features (rule-based approach with example) Nov 13, 2025
@limdor limdor changed the title Support for injecting custom toolchain features (rule-based approach with example) Support for injecting custom toolchain features (approach injecting rule-based features with example) Nov 13, 2025
Copy link
Collaborator

@fmeum fmeum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a maintainer, but this is a slick path for incremental migrations - looks great and would also help toolchains_llvm.

cc @keith

@keith
Copy link
Member

keith commented Nov 17, 2025

yea i think something like this would be great. i wouldn't be surprised if there was a bit of pushback on using the new API in the older style toolchains

Copy link
Collaborator

@armandomontanez armandomontanez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea. While this isn't necessarily an ideal state for anyone to live in long term, I think it's still overall a net positive.

@@ -0,0 +1,6 @@
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intended to be built with the toolchain in //examples/inject_extra_features/toolchain? The toolchain isn't registered.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armandomontanez it was intended that it is not register. For the moment I just wanted to add an example in the draft in this way people could play around with the command line that I mentioned in the PR description.
If between #523 and #524 you also agree that #524 is the preferred approach, then I would just close both of them and we can continue the discussion in #525. You will see that in #525 I did not add any example, I believe that it is quite simple as to need an example, but if you want one let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants