-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
bootstrap: allow setting --jobs
in config.toml
#131838
Conversation
This PR modifies If appropriate, please update This PR modifies If appropriate, please update |
This comment has been minimized.
This comment has been minimized.
@rustbot author |
8302cba
to
e057ca5
Compare
@rustbot ready |
if let Some(jobs) = jobs { | ||
if jobs > 0 { | ||
config.jobs = Some(jobs); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should handle it here:
rust/src/bootstrap/src/core/config/config.rs
Line 1293 in e057ca5
config.jobs = Some(threads_from_config(flags.jobs as u32)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there's two layers of precedence, the line there is the top priority --jobs
flag. I changed the logic to better reflect the precedence such that:
config.jobs
andflags.jobs
are initiallyNone
.config.jobs
isSome
based on--jobs=N
ifN > 0
and stillNone
otherwise.- If
config.jobs
is stillNone
, then we fallback to--set build.jobs
then[build] jobs
. Note that thebuild
toml section is read below this.
I added a precedence test to check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Remark: I found this config layering somewhat hard to follow)
4adaf51
to
2fdc3b1
Compare
This comment has been minimized.
This comment has been minimized.
@rustbot author |
@rustbot ready |
@rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with/without the nit suggestion
Thanks! @bors r+ |
bootstrap: allow setting `--jobs` in config.toml Allow setting `--jobs` in config.toml's `[build]` section. ```toml [build] jobs = 0 ``` If this is unset or set to zero in config.toml, we look at `--jobs` flag. If that is also unset, then we fallback to `std::thread::available_parallelism`. If that is not available, then we default to `1`. The flags and `available_parallelism` fallback are already setup, this PR just adds a config.toml option to wire that up. Closes rust-lang#131836. r? bootstrap
…kingjubilee Rollup of 8 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131871 (x86-32 float return for 'Rust' ABI: treat all float types consistently) - rust-lang#131876 (compiler: Use LLVM's Comdat support) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) r? `@ghost` `@rustbot` modify labels: rollup
bootstrap: allow setting `--jobs` in config.toml Allow setting `--jobs` in config.toml's `[build]` section. ```toml [build] jobs = 0 ``` If this is unset or set to zero in config.toml, we look at `--jobs` flag. If that is also unset, then we fallback to `std::thread::available_parallelism`. If that is not available, then we default to `1`. The flags and `available_parallelism` fallback are already setup, this PR just adds a config.toml option to wire that up. Closes rust-lang#131836. r? bootstrap
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131871 (x86-32 float return for 'Rust' ABI: treat all float types consistently) - rust-lang#131876 (compiler: Use LLVM's Comdat support) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) - rust-lang#131916 (small interpreter error cleanup) - rust-lang#131919 (zero-sized accesses are fine on null pointers) r? `@ghost` `@rustbot` modify labels: rollup
bootstrap: allow setting `--jobs` in config.toml Allow setting `--jobs` in config.toml's `[build]` section. ```toml [build] jobs = 0 ``` If this is unset or set to zero in config.toml, we look at `--jobs` flag. If that is also unset, then we fallback to `std::thread::available_parallelism`. If that is not available, then we default to `1`. The flags and `available_parallelism` fallback are already setup, this PR just adds a config.toml option to wire that up. Closes rust-lang#131836. r? bootstrap
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131871 (x86-32 float return for 'Rust' ABI: treat all float types consistently) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) - rust-lang#131916 (small interpreter error cleanup) - rust-lang#131919 (zero-sized accesses are fine on null pointers) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127462 (std: uefi: Add basic Env variables) - rust-lang#131537 (Fix range misleading field access) - rust-lang#131838 (bootstrap: allow setting `--jobs` in config.toml) - rust-lang#131890 (Update `use` keyword docs to describe precise capturing) - rust-lang#131899 (Mark unexpected variant res suggestion as having placeholders) - rust-lang#131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) - rust-lang#131916 (small interpreter error cleanup) - rust-lang#131919 (zero-sized accesses are fine on null pointers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131838 - jieyouxu:boopjob, r=onur-ozkan bootstrap: allow setting `--jobs` in config.toml Allow setting `--jobs` in config.toml's `[build]` section. ```toml [build] jobs = 0 ``` If this is unset or set to zero in config.toml, we look at `--jobs` flag. If that is also unset, then we fallback to `std::thread::available_parallelism`. If that is not available, then we default to `1`. The flags and `available_parallelism` fallback are already setup, this PR just adds a config.toml option to wire that up. Closes rust-lang#131836. r? bootstrap
Allow setting
--jobs
in config.toml's[build]
section.If this is unset or set to zero in config.toml, we look at
--jobs
flag. If that is also unset, then we fallback tostd::thread::available_parallelism
. If that is not available, then we default to1
. The flags andavailable_parallelism
fallback are already setup, this PR just adds a config.toml option to wire that up.Closes #131836.
r? bootstrap