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

support local bootstrap profiles #138934

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

onur-ozkan
Copy link
Member

Copied from the rustc-dev-guide addition:

When working on different tasks, you might need to switch between different bootstrap >configurations.
Sometimes you may want to keep an old configuration for future use. But saving raw config >values in
random files and manually copying and pasting them can quickly become messy, especially if you >have a
long history of different configurations.

To simplify managing multiple configurations, you can create local profiles and switch between >them easily.

For example, you can create cross profile by creating cross.toml file this:

[build]
build = "x86_64-unknown-linux-gnu"
host = ["i686-unknown-linux-gnu"]
target = ["i686-unknown-linux-gnu"]


[llvm]
download-ci-llvm = false

[target.x86_64-unknown-linux-gnu]
llvm-config = "/path/to/llvm-19/bin/llvm-config"

Then, use this profile in your bootstrap.toml:

profile = "cross"

You can also define recursive profiles, meaning that local profiles can inherit other profiles.

For example, you can:

  1. Create some-config1 profile in some-config1.toml.
  2. Create some-config2 profile in some-config2.toml and inherit some-config1.
  3. Create some-config3 profile in some-config3.toml and inherit some-config2.
  4. ...

You can chain profiles like this as deep as you need without any limitations.

Note: The outer configuration file always overrides the inner one.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@rustbot
Copy link
Collaborator

rustbot commented Mar 25, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 25, 2025

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @jieyouxu, @Kobzol

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@TimNN
Copy link
Contributor

TimNN commented Mar 25, 2025

Some thoughts (aside from the fact that I like this feature):

  1. Consider being explicit about the fact that the additional files must be in the root repository directory, both in the PR description and the docs.

  2. Consider changing that, I'd personally prefer having all custom profiles in a single directory (so they are grouped in the file list, and to make it easier to .gitignore them all).

  3. As an alternative, switch from custom profiles to "includes", i.e. referencing files instead of profile names.

    • This would clearly differentiate built-in profiles from custom includes.
    • This would make it easy to use a custom directory for custom profiles, possibly even shared between multiple rust checkouts.
    • We could differentiate profiles and includes by checking for the .toml extension, or by having profile and include be separate fields.
    • Relative includes would need somewhat careful handling (should probably be relative to the current file).
    • Includes could open up the possibility of including multiple files (e.g. one to apply my "general" default configuration, and one to switch between different LLVM configurations). Though this may be better left for a follow-up.

@jieyouxu
Copy link
Member

Rerolling review due to bandwidth because I'm still slowly testing #119899.
r? bootstrap

@rustbot rustbot assigned albertlarsan68 and unassigned jieyouxu Mar 26, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Mar 26, 2025

r? kobzol

Will take a look tomorrow.

@rustbot rustbot assigned Kobzol and unassigned albertlarsan68 Mar 26, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Mar 26, 2025

I haven't looked too closely, but based on description

Create some-config1 profile in some-config1.toml.
Create some-config2 profile in some-config2.toml and inherit some-config1.
Create some-config3 profile in some-config3.toml and inherit some-config2.

can this infinite loop? I guess even if it does, just don't do that 😆

@onur-ozkan
Copy link
Member Author

I'm planning to rework on this next week.

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants