-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add x.py setup
#76631
Add x.py setup
#76631
Conversation
Example output:
|
This comment has been minimized.
This comment has been minimized.
f221466
to
95bab52
Compare
This comment has been minimized.
This comment has been minimized.
c4be7f5
to
8e9c40b
Compare
This comment has been minimized.
This comment has been minimized.
In my personal workflow, I cp config.toml.example to config.toml and then adjust the settings I want adjusted. That way their documentation is next to them and I always know what they do. I regularly re-do this step so that it doesn't bitrot too much as new options are being added/old ones removed. But maybe it is smarter to just have that single line instead plus 1 comment. |
This is the main reason for having the defaults in a separate file tracked by git - I don't want people to have to rerun this command as options are changed. I also want to avoid overwhelming people with too many options, I've had a lot of people say |
Done. |
037aa4b
to
0557dca
Compare
Ooh, this could also link to https://rustc-dev-guide.rust-lang.org/building/suggested.html once it finishes. |
@Mark-Simulacrum do you have suggestions for setting diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 47673ce1e87..ac213b55873 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -34,6 +34,8 @@ def v(*args):
o("debug", "rust.debug", "enables debugging environment; does not affect optimization of bootstrapped code (use `--disable-optimize` for that)")
o("docs", "build.docs", "build standard library documentation")
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
+v("profile", "profile", "the latest version of the x.py changelog viewed")
o("optimize-tests", "rust.optimize-tests", "build tests with optimizations")
o("parallel-compiler", "rust.parallel-compiler", "build a multi-threaded rustc")
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests")
@@ -279,6 +281,7 @@ def set(key, value):
arr = config
parts = key.split('.')
for i, part in enumerate(parts):
+ print(i, part)
if i == len(parts) - 1:
arr[part] = value
else:
@@ -362,6 +365,7 @@ set('build.configure-args', sys.argv[1:])
sections = {}
cur_section = None
sections[None] = []
+sections[0] = ["profile"]
section_order = [None]
targets = {}
@@ -392,6 +396,8 @@ for target in configured_targets:
targets[target] = sections['target'][:]
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
+# Set the default profile to 'user', since contributors won't be using `configure`
+set("profile", "user")
def is_number(value):
try:
|
The other option is to leave that for later so we can land this quickly and then improve the defaults for distro maintainers in a follow-up. |
Yeah, I'm not sure. I would leave it to a future PR. |
- Suggest `x.py setup` if config.toml doesn't exist yet (twice, once before and once after the build) - Prompt for a profile if not given on the command line - Print the configuration file that will be used - Print helpful starting commands after setup - Link to the dev-guide after finishing - Note that distro maintainers will see the changelog warning
Ok, in that case I think this is ready to merge :) |
Because github isn't showing it, the last change I made was commit 7304b64d28415841c6d1b07501194471109f917e
Author: Joshua Nelson <[email protected]>
Date: Thu Sep 24 10:31:54 2020 -0400
Note that distro maintainers will see the changelog warning
My previous TODO was incorrect
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs
index 8290420ec06..669dd7a33de 100644
--- a/src/bootstrap/bin/main.rs
+++ b/src/bootstrap/bin/main.rs
@@ -15,7 +15,8 @@ fn main() {
let changelog_suggestion = check_version(&config);
- // TODO: `./configure` should show a warning about the changelog, not `x.py setup`
+ // NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
+ // changelog warning, not the `x.py setup` message.
let suggest_setup = !config.config.exists() && !matches!(config.cmd, Subcommand::Setup { .. });
if suggest_setup {
println!("warning: you have not made a `config.toml`"); |
@bors r+ |
📌 Commit 9baa601 has been approved by |
Add `x.py setup` Closes rust-lang#76503. - Suggest `x.py setup` if config.toml doesn't exist yet - Prompt for a profile if not given on the command line - Print the configuration that will be used - Print helpful starting commands after setup - Link to the dev-guide after finishing
Add `x.py setup` Closes rust-lang#76503. - Suggest `x.py setup` if config.toml doesn't exist yet - Prompt for a profile if not given on the command line - Print the configuration that will be used - Print helpful starting commands after setup - Link to the dev-guide after finishing
Rollup of 12 pull requests Successful merges: - rust-lang#75454 (Explicitly document the size guarantees that Option makes.) - rust-lang#76631 (Add `x.py setup`) - rust-lang#77076 (Add missing code examples on slice iter types) - rust-lang#77093 (merge `need_type_info_err(_const)`) - rust-lang#77122 (Add `#![feature(const_fn_floating_point_arithmetic)]`) - rust-lang#77127 (Update mdBook) - rust-lang#77161 (Remove TrustedLen requirement from BuilderMethods::switch) - rust-lang#77166 (update Miri) - rust-lang#77181 (Add doc alias for pointer primitive) - rust-lang#77204 (Remove stray word from `ClosureKind::extends` docs) - rust-lang#77207 (Rename `whence` to `span`) - rust-lang#77211 (Remove unused #[allow(...)] statements from compiler/) Failed merges: - rust-lang#77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`) r? `@ghost`
…n514 Fix suggestions for x.py setup rust-lang#76631 introduced a new `setup` command to x.py By default the command prompts for a profile to use: ``` Welcome to the Rust project! What do you want to do with x.py? a) Contribute to the standard library b) Contribute to the compiler c) Contribute to the compiler, and also modify LLVM or codegen d) Install Rust from source ``` and then displays command suggestions, depending on which profile was chosen. However [the mapping between chosen profile](https://github.com/rust-lang/rust/blob/9cba260df0f1c67ea3690035cd5611a7465a1560/src/bootstrap/setup.rs#L75-L85) and [suggestion](https://github.com/rust-lang/rust/blob/9cba260df0f1c67ea3690035cd5611a7465a1560/src/bootstrap/setup.rs#L42-L47) isn't exact, leading to suggestions not being shown if the user presses `c` or `d`. (because "c" is translated to "llvm" and "d" to "maintainer", but suggestions trigger for "codegen" and "user" respectively) A more thorough refactor would stop using "strings-as-type" to make sure this kind of error doesn't happen, but it may be overkill for that kind of "script" program? Tagging the setup command author: @jyn514
Closes #76503.
x.py setup
if config.toml doesn't exist yet