Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate toolchain configuration to rules_toolchains #3178

Open
matts1 opened this issue Jan 9, 2025 · 0 comments
Open

Migrate toolchain configuration to rules_toolchains #3178

matts1 opened this issue Jan 9, 2025 · 0 comments

Comments

@matts1
Copy link
Contributor

matts1 commented Jan 9, 2025

@armandomontanez and I have been working on improving toolchain configuration for C++, and we presented our work at bazelcon last year (youtube video, slides). Recently, I started working on decoupling this work from rules_cc.

I recommend looking at the example lang_library definition here and the toolchain definition here to see how rules_rust would makke use of it. It is most definitely not ready for use yet, but I wanted to ask whether rules_rust would be interested in onboarding.

The TLDR of how it works is that rules_rust would come up with a bunch of different actions (eg. compile, link, proc_macro_compile), and then rather than running ctx.actions.run, you would just call run_action(action_type = compile, variables = struct(source_files = [main.rs], libraries = [foo.dylib], output_file = [main], features = ["foo"], static = False, sysroot = path/to/sysroot), and the toolchain config would then calculate what tool to use, what input files it requires, and the command-line invocation to run.

A quick skim of issues on the issue tracker reveals that it can solve a variety of issues that commonly pop up, such as #2833, #1711, #1034, #3045, #2701 and #1623.

I believe that in the future, most toolchains will migrate to this, as it makes rulesets significantly easier to write, and makes toolchains far more customizable with zero effort from the ruleset maintainer.

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

No branches or pull requests

1 participant