about summary refs log tree commit diff
path: root/src/bootstrap/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-12-17Remove special cases for setup subcommandBenjamin Tong-4/+0
- Remove setup special-casing in Flags::parse
2022-12-17Symlink `build/host` -> `build/x86_64-unknown-linux-gnu` (as appropriate per ↵Joshua Nelson-1/+18
target) This allows us to use a consistent path in the documentation, without having to worry about which platform people are using.
2022-12-10Rollup merge of #104512 - jyn514:download-ci-llvm-default, r=Mark-SimulacrumMatthias Krüger-2/+2
Set `download-ci-llvm = "if-available"` by default when `channel = dev` See https://github.com/rust-lang/compiler-team/issues/566. The motivation for changing the default is to avoid downloading and building LLVM when someone runs `x build` before running `x setup`. The motivation for only doing it on `channel = "dev"` is to avoid breaking distros or users installing from source. It works because `dev` is also the default channel. The diff looks larger than it is; most of it is moving the `llvm` branch below the `rust` so `config.channel` is set. r? `@Mark-Simulacrum` cc `@oli-obk` `@bjorn3` `@cuviper`
2022-12-05Rollup merge of #104953 - jyn514:fewer-submodule-updates, r=Mark-SimulacrumMatthias Krüger-3/+3
Ensure required submodules at the same time as updating existing submodules In practice, this would always happen at the same time, but putting them next to each other makes that more obvious and ensures it doesn't change in the future. It also avoids the difference affecting `cargo metadata` somehow. This is based on https://github.com/rust-lang/rust/pull/104952 for convenience to avoid merge conflicts, but doesn't depend on that PR.
2022-12-05Rollup merge of #104952 - jyn514:setup, r=Mark-SimulacrumMatthias Krüger-19/+25
Streamline the user experience for `x.py setup` ## Don't update submodules for x setup Before, the submodule handling was very jank and would update *between two interactive prompts*: ``` ; x setup Building rustbuild Finished dev [unoptimized] target(s) in 0.05s Welcome to the Rust project! What do you want to do with x.py? a) library: Contribute to the standard library Please choose one (a/b/c/d/e): a Updating submodule library/backtrace Submodule 'library/backtrace' (https://github.com/rust-lang/backtrace-rs.git) registered for path 'library/backtrace' error: you asked `x.py` to setup a new config file, but one already exists at `config.toml` Build completed unsuccessfully in 0:00:02 ``` That's not a great user experience because you need to wait a long time between prompts. It would be possible to move the submodule handling either before or after the prompt, but it seems better to just not require submodules to be checked out at all, to minimize the time spend waiting just to create a new configuration. ## Revamp the order setup executes - Create `config.toml` last. It's the most likely to error, and used to stop later steps from executing - Don't print an error message + exit if the git hook already exists; that's expected
2022-12-03Don't exit with an error if there are no changes to submodulesJoshua Nelson-2/+15
2022-11-27suggested changesPratush Rai-1/+0
2022-11-27suggested changesPratush Rai-2/+2
2022-11-26Ensure required submodules at the same time as updating existing submodulesJoshua Nelson-3/+3
In practice, this would always happen at the same time, but putting them next to each other makes that more obvious and ensures it doesn't change in the future. It also avoids the difference avoiding `cargo metadata` somehow.
2022-11-26Don't update submodules for `x setup`Joshua Nelson-19/+25
Before, the submodule handling was very jank and would update *between two interactive prompts*: ``` ; x setup Building rustbuild Finished dev [unoptimized] target(s) in 0.05s Welcome to the Rust project! What do you want to do with x.py? a) library: Contribute to the standard library Please choose one (a/b/c/d/e): a Updating submodule library/backtrace Submodule 'library/backtrace' (https://github.com/rust-lang/backtrace-rs.git) registered for path 'library/backtrace' error: you asked `x.py` to setup a new config file, but one already exists at `config.toml` Build completed unsuccessfully in 0:00:02 ``` That's not a great user experience because you need to wait a long time between prompts. It would be possible to move the submodule handling either before or after the prompt, but it seems better to just not require submodules to be checked out at all, to minimize the time spend waiting just to create a new configuration.
2022-11-25bootstrapPratush Rai-2/+4
2022-11-19Set `download-ci-llvm = "if-available"` by default when `channel = "dev"`Joshua Nelson-2/+2
See https://github.com/rust-lang/compiler-team/issues/566. The motivation for changing the default is to avoid downloading and building LLVM when someone runs `x build` before running `x setup`. The motivation for only doing it on `channel = "dev"` is to avoid breaking distros or users installing from source. It works because `dev` is also the default channel. The diff looks larger than it is; most of it is moving the `llvm` branch below the `rust` so `config.channel` is set.
2022-11-13Make all download functions need only Config, not BuilderJoshua Nelson-67/+34
This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.
2022-11-12Print "Checking/Building ..." message even when --dry-run is passedJoshua Nelson-3/+5
This makes it a lot easier to understand what commands will be run without having to parse the `-vv` output, which isn't meant to be user facing.
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-23/+23
2022-10-26check lld version to choose correct flag for testsDaniil Belov-2/+2
2022-10-10Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrumbors-0/+1
Use BOLT in CI to optimize LLVM This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap. Steps: - [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT - [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`) - [x] Gather profile data using instrumented LLVM - [x] Apply profile to LLVM that has already been PGOfied - [x] Run with BOLT profiling on more benchmarks - [x] Decide on the order of optimization (PGO -> BOLT?) - [x] Decide how we should get `bolt` (currently we use the host `bolt`) - [x] Clean up The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.
2022-10-09Use BOLT in x64 dist CI to optimize LLVMJakub Beránek-0/+1
2022-10-02Auto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrumbors-4/+10
fix: use git-commit-info for version information Fixes #33286. Fixes #86587. This PR changes the current `git-commit-hash` file that `./x.py` dist puts in the `rustc-{version}-src.tar.{x,g}z` to contain the hash, the short hash, and the commit date from which the tarball was created, assuming git was available when it was. It uses this for reading the version so that rustc has all the appropriate metadata. # Testing Testing this is kind of a pain. I did it with something like ```sh ./x.py dist # ensure that `ignore-git` is `false` in config.toml cp ./build/dist/rustc-1.65.0-dev-src.tar.gz ../rustc-1.65.0-dev-src.tar.gz cd .. && tar -xzf rustc-1.65.0-dev-src && cd rustc-1.65.0-dev-src ./x.py build ``` Then, the output of `rustc -vV` with the stage1 compiler should have the `commit-hash` and `commit-date` fields filled, rather than be `unknown`. To be completely sure, you can use `rustc --sysroot` with the stdlib that the original `./x.py dist` made, which will require that the metadata matches.
2022-10-02Rollup merge of #102557 - Joshument:master, r=jyn514Matthias Krüger-2/+3
fix issue with x.py setup running into explicit panic Fixes problem with [Issue #102555](https://github.com/rust-lang/rust/issues/102555) causing `x.py` setup to fail. Simply requires `rustfmt` be downloaded a little later.
2022-10-02Rollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-SimulacrumMatthias Krüger-0/+2
Allow passing rustix_use_libc cfg using RUSTFLAGS Before this would error with ``` error: unexpected `rustix_use_libc` as condition name | = note: `-D unexpected-cfgs` implied by `-D warnings` = help: was set with `--cfg` but isn't in the `--check-cfg` expected names ``` I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.
2022-10-01fix issue with x.py setup running into explicit panicJoshument-2/+3
2022-10-01fix: use git-commit-info for version informationdawnofmidnight-4/+10
This PR adds support for fetching version information from the `git-commit-info` file when building the compiler from a source tarball.
2022-10-01Auto merge of #101969 - reez12g:issue-101306, r=reez12gbors-0/+2
Make fmt downloaded on every invocation of bootstrap Fixes https://github.com/rust-lang/rust/issues/101306
2022-10-01Add a comment to downloading fmt statementRento Ezoe-0/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-09-27Allow passing rustix_use_libc cfg using RUSTFLAGSbjorn3-0/+2
Before this would error with ``` error: unexpected `rustix_use_libc` as condition name | = note: `-D unexpected-cfgs` implied by `-D warnings` = help: was set with `--cfg` but isn't in the `--check-cfg` expected names ``` I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.
2022-09-26fix check_cfgPietro Albini-0/+1
2022-09-26Make fmt downloaded on every invocation of bootstrapreez12g-0/+1
2022-09-24Auto merge of #98483 - dvtkrlbs:bootstrap-dist, r=jyn514bors-13/+12
Distribute bootstrap in CI This pre-compiles bootstrap from source and adds it to the existing `rust-dev` component. There are two main goals here: 1. Make it faster to build rust from source, both the first time and incrementally 2. Make it easier to add non-python entrypoints, since they can call out to bootstrap directly rather than having to figure out the right flags to pre-compile it. This second part is still in a bit of flux, see the tracking issue below for more information. There are also several changes to make bootstrap able to run on a machine other than the one it was built (particularly around `config.src` and `config.out` detection). I (`@jyn514)` am slightly concerned these will regress unless tested - maybe we should add an automated test that runs bootstrap in a chroot or something? Unclear whether the effort is worth the test coverage. Helps with https://github.com/rust-lang/rust/issues/94829.
2022-09-22Auto merge of #102028 - oli-obk:miri_subtree, r=oli-obkbors-7/+2
Make miri a subtree instead of a submodule r? `@RalfJung` fixes #101867 fixes https://github.com/rust-lang/rust/issues/100134
2022-09-21Remove miri from the submodule list and require it for CI to passOli Scherer-7/+2
2022-09-21Rollup merge of #89891 - ojeda:modular-alloc, r=Mark-SimulacrumDylan DPC-0/+2
`alloc`: add unstable cfg features `no_rc` and `no_sync` In Rust for Linux we are using these to make `alloc` a bit more modular. See https://github.com/rust-lang/rust/pull/86048 and https://github.com/rust-lang/rust/pull/84266 for similar requests. Of course, the particular names are not important.
2022-09-19Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514bors-0/+5
Distribute json doc # Overview We add a new component, `rust-json-docs`, to distribute the JSON version of rustdoc's output for public compiler crates (i.e. `std`, `alloc`, `proc_macro`, `core` and `test`). As discussed in #101383, we do not bundle this up as part of the existing `rust-docs` component since `rustdoc`'s JSON format is still unstable. # Open questions / Doubts I tried my best, but I never touched this codebase and I couldn't find much documentation on how `dist` works - I pattern-matched existing code, which might have led to some non-sensical choices in the eyes of people more familiar with the codebase. In particular, I am not sure if my choice of adding a new config flag is appropriate or if the decision to build/not build the JSON docs is more appropriately gated by one of the existing flags. Any suggestion is more than welcome. Closes #101383
2022-09-17Add a new component, `rust-json-docs`, to distribute the JSON-formatted ↵Luca Palmieri-0/+5
documentation for std crates in nightly toolchains. We also add a new flag to `x doc`, `--json`, to render the JSON-formatted version alongside the HTML-formatted one.
2022-09-16Remove the allow-list for dynamic linking of LLVM toolsChris Wailes-4/+0
This commit removes an allow-list for the dynamic linking of the LLVM tools and instead relies on the builder's linking preference only.
2022-09-14Give a better error messages when the rustc shim is missingJoshua Nelson-1/+4
2022-09-14Fix pre-existing bug in exe checkJoshua Nelson-1/+1
2022-09-14Don't hardcode the path to `bootstrap_out`Joshua Nelson-13/+9
The `rust-dev` dist component puts binaries in `bootstrap/bin`, but we expected them to be in `bootstrap/debug` to match cargo's behavior. Rather than making the dist component inconsistent with other components, make bootstrap slightly smarter and allow using any path as long as all the binaries are in the same directory. As a bonus, this greatly simplifies the logic, and makes it possible for the shell scripts to start avoiding python. Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-09-02Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-SimulacrumMatthias Krüger-0/+3
Change implementation of `-Z gcc-ld` and `lld-wrapper` again This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.
2022-09-01Rollup merge of #101072 - tmandry:llvm-is-vanilla, r=Mark-SimulacrumMatthias Krüger-5/+7
bootstrap: Add llvm-has-rust-patches target option This is so you can check out an upstream commit in src/llvm-project and have everything just work. This simplifies the logic in `is_rust_llvm` a bit; it doesn't need to check for download-ci-llvm because we would have already errored if both that and llvm-config were specified on the host platform.
2022-09-01Rollup merge of #100852 - Samyak2:samyak/100459, r=Mark-SimulacrumMatthias Krüger-4/+9
Use `getuid` to check instead of `USER` env var in rustbuild This makes it consistent with `x.py` as changed in #95671 Fixes #100459
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Avoid bootstrap from updating rls submoduleRaoul Strackx-1/+0
2022-08-29bootstrap: Add llvm-has-rust-patches target optionTyler Mandry-5/+7
This is so you can check out an upstream commit in src/llvm-project and have everything just work.
2022-08-27Sunset RLSEric Huss-3/+0
2022-08-26Use getuid to check instead of USER env var in rustbuildSamyak Sarnayak-4/+9
This makes it consistent with `x.py` as changed in #95671 Fixes #100459
2022-08-26`alloc`: add unstable cfg features `no_rc` and `no_sync`Miguel Ojeda-0/+2
In Rust for Linux we are using these to make `alloc` a bit more modular. A `run-make-fulldeps` test is added for each of them, so that enabling each of them independently is kept in a compilable state. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-08-15Revert "Revert "Remove num_cpus dependency from bootstrap, build-manifest ↵The 8472-1/+3
and rustc_session"" This reverts commit 1ae4b258267462da0b1aae1badcf83578153c799.
2022-08-10added some commentsshourya5-1/+2
2022-08-09replaced resume_unwind with process::exit to fixshourya5-5/+2
bootstrap panic when running x fmt --check. running x fmt --check