summary refs log tree commit diff
path: root/src/bootstrap/bootstrap.py
AgeCommit message (Collapse)AuthorLines
2020-12-13Rollup merge of #79970 - bjorn3:no_unnecessary_llvm_checkout, r=Mark-SimulacrumYuki Okushi-5/+9
Misc rustbuild improvements when the LLVM backend isn't used * Don't checkout llvm-project * Don't require cmake and ninja Fixes #78564
2020-12-12Don't checkout llvm-project when the LLVM backend isn't builtbjorn3-5/+9
2020-12-08Fix rustup support in default_build_triple for python3Joshua Nelson-3/+8
bootstrap completely ignores all errors when detecting a rustup version, so this wasn't noticed before. Fixes the following error: ``` rustup not detected: a bytes-like object is required, not 'str' falling back to auto-detect ``` This also takes the opportunity to only call rustup and other external commands only once during startup.
2020-11-19Rollup merge of #79156 - jyn514:relative-llvm, r=Mark-SimulacrumDylan DPC-2/+5
Allow using `download-ci-llvm` from directories other than the root Previously, bootstrap.py would attempt to find the LLVM commit from `src/llvm-project`. However, it assumed it was always being run from the top-level directory, which isn't always the case. Before: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz curl: (22) The requested URL returned error: 404 failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz Build completed unsuccessfully in 0:00:02 ``` After: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ###################################################################################################################################################################### 100.0% extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ``` r? ```@Mark-Simulacrum``` cc ```@pnkfelix```
2020-11-17Allow using `download-ci-llvm` from directories other than the rootJoshua Nelson-2/+5
Previously, bootstrap.py would attempt to find the LLVM commit from `src/llvm-project`. However, it assumed it was always being run from the top-level directory, which isn't always the case. Before: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz curl: (22) The requested URL returned error: 404 failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz Build completed unsuccessfully in 0:00:02 ``` After: ``` downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ###################################################################################################################################################################### 100.0% extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz ```
2020-11-17bootstrap: use the same version number for rustc and cargoPietro Albini-25/+4
Historically the stable tarballs were named after the version number of the specific tool, instead of the version number of Rust. For example, both of the following tarballs were part of the same release: rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz PR #77336 changed the dist code to instead use Rust's version number for all the tarballs, regardless of the tool they contain: rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz Because of that there is no need anymore to have a separate `cargo` field in src/stage0.txt, as the Cargo version will always be the same as the rustc version. This PR removes the field, simplifying the code and the maintenance work required while producing releases.
2020-11-05Infer the default host target from the host toolchain if possibleJoshua Nelson-2/+17
This fixes ongoing issues where x.py will detect the wrong host triple between MSVC and GNU. - Add line to changelog
2020-10-26Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrumbors-2/+6
Add cg_clif as optional codegen backend Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases. This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`. MCP: https://github.com/rust-lang/compiler-team/issues/270 r? `@Mark-Simulacrum`
2020-10-26Add support for using cg_clif to bootstrap rustcbjorn3-2/+6
2020-10-23Rollup merge of #78153 - est31:downloaded_llvm_maybe_sync, r=Mark-SimulacrumYuki Okushi-1/+6
Sync LLVM submodule if it has been initialized Since having enabled the download-ci-llvm option, and having rebased on top of #76864, I've noticed that I had to update the llvm-project submodule manually if it was checked out. Orignally, the submodule update logic was introduced to reduce the friction for contributors to manage the submodules, or in other words, to prevent getting PRs that have unwanted submodule rollbacks because the contributors didn't run git submodule update. This commit adds logic to ensure there is no inadvertent LLVM submodule rollback in a PR if download-ci-llvm (or llvm-config) is enabled. It will detect whether the llvm-project submodule is initialized, and if so, update it in any case. If it is not initialized, behaviour is kept to not do any update/initialization. An alternative to the chosen implementation would be to not pass the --init command line arg to `git submodule update` for the src/llvm-project submodule. This would show a confusing error message however on all builds with an uninitialized repo. We could pass the --silent param, but we still want it to print something if it is initialized and has to update something. So we just do a manual check for whether the submodule is initialized.
2020-10-20Sync LLVM submodule if it has been initializedest31-1/+6
Since having enabled the download-ci-llvm option, and having rebased on top of f05b47ccdfa63f8b4b9fb47a9aa92381801d3ff1, I've noticed that I had to update the llvm-project submodule manually if it was checked out. Orignally, the submodule update logic was introduced to reduce the friction for contributors to manage the submodules, or in other words, to prevent getting PRs that have unwanted submodule rollbacks because the contributors didn't run git submodule update. This commit adds logic to ensure there is no inadvertent LLVM submodule rollback in a PR if download-ci-llvm (or llvm-config) is enabled. It will detect whether the llvm-project submodule is initialized, and if so, update it in any case. If it is not initialized, behaviour is kept to not do any update/initialization. An alternative to the chosen implementation would be to not pass the --init command line arg to `git submodule update` for the src/llvm-project submodule. This would show a confusing error message however on all builds with an uninitialized repo. We could pass the --silent param, but we still want it to print something if it is initialized and has to update something. So we just do a manual check for whether the submodule is initialized.
2020-10-20Make users of `download-ci-llvm` download a new versionSimon Sapin-1/+3
2020-10-13Handle included config in bootstrap.pyAntoine Martin-0/+10
2020-10-13Implement "if-available" option for download-ci-llvmAntoine Martin-2/+3
2020-09-23Re-download LLVM on submodule updates onlyMark Rousskov-2/+13
2020-09-23Auto merge of #76864 - est31:downloaded_llvm_no_clone_sources, r=Mark-Simulacrumbors-2/+3
Don't download/sync llvm-project submodule if download-ci-llvm is set llvm-project takes > 1GB storage space and a long time to download. It's better to not download it unless needed.
2020-09-20Discover Rust toolchain without PythonMark Rousskov-4/+0
2020-09-20Remove support for different src directoryMark Rousskov-3/+1
This requires that bootstrap is run from the same worktree as the sources it'll build, but this is basically required for the build to work anyway. You can still run it from a different directory, just that the files it builds must be beside it.
2020-09-20Set BUILD_TRIPLE via build scriptMark Rousskov-1/+0
This moves build triple discovery for rustbuild from bootstrap.py into a build script, meaning it will "just work" if building rustbuild via Cargo rather than Python.
2020-09-18Don't download/sync llvm-project submodule if download-ci-llvm is setest31-2/+3
llvm-project takes > 1GB storage space and a long time to download. It's better to not download it unless needed.
2020-09-13Fix CI LLVM to work on NixOS out of the boxAleksey Kladov-0/+2
2020-09-12Download LLVM from CI to bootstrapMark Rousskov-24/+83
2020-09-11Auto merge of #76381 - petrochenkov:nomingwcomp, r=Mark-Simulacrumbors-8/+0
rustbuild: Do not use `rust-mingw` component when bootstrapping windows-gnu targets Addresses https://github.com/rust-lang/rust/pull/76326#issuecomment-687273473 (ancient `x86_64-w64-mingw32-gcc` is selected as a linker wrapper, which is not usable in `use_lld=true` mode). Perhaps the comment about incompatible mingw was true in the past, but many things changed since then. With this change I was able to build everything successfully locally using a newer mingw toolchain, if it passes through the older toolchain on CI, then it should be good, I think.
2020-09-06Make bootstrap build on stableMark Rousskov-1/+0
This is generally a good idea, and will help with being able to build bootstrap without Python over time as it means we can "just" build with cargo +beta build rather than needing the user to set environment variables. This is a minor step, but a necessary one on that road.
2020-09-05rustbuild: Do not use `rust-mingw` component when bootstrapping windows-gnu ↵Vadim Petrochenkov-8/+0
targets
2020-07-17bootstrap.py: patch RPATH on NixOS to handle the new zlib dependency.Eduard-Mihai Burtescu-13/+30
2020-07-17bootstrap.py: guard against GC in NixOS patching support.Eduard-Mihai Burtescu-31/+42
2020-07-03Add rust-analyzer submoduleAleksey Kladov-1/+1
The current plan is that submodule tracks the `release` branch of rust-analyzer, which is updated once a week. rust-analyzer is a workspace (with a virtual manifest), the actual binary is provide by `crates/rust-analyzer` package. Note that we intentionally don't add rust-analyzer to `Kind::Test`, for two reasons. *First*, at the moment rust-analyzer's test suite does a couple of things which might not work in the context of rust repository. For example, it shells out directly to `rustup` and `rustfmt`. So, making this work requires non-trivial efforts. *Second*, it seems unlikely that running tests in rust-lang/rust repo would provide any additional guarantees. rust-analyzer builds with stable and does not depend on the specifics of the compiler, so changes to compiler can't break ra, unless they break stability guarantee. Additionally, rust-analyzer itself is gated on bors, so we are pretty confident that test suite passes.
2020-06-25Bootstrap: fallback detection of WindowsAndrew Paverd-0/+6
2020-06-22bootstrap: no `config.toml` exists regressionDavid Wood-5/+9
This commit fixes a regression introduced in #73317 where an oversight meant that `config.toml` was assumed to exist. Signed-off-by: David Wood <david@davidtw.co>
2020-06-16bootstrap: read config from $RUST_BOOTSTRAP_CONFIGDavid Wood-1/+2
This commit modifies bootstrap so that `config.toml` is read first from `RUST_BOOTSTRAP_CONFIG`, then `--config` and finally `config.toml` in the current directory. This is a subjective change, intended to improve the ergnomics when using "development shells" for rustc development (for example, using tools such as Nix) which set environment variables to ensure a reproducible environment (these development shells can then be version controlled). By optionally reading `config.toml` from an environment variable, a `config.toml` can be defined in the development shell and a path to it exposed in the `RUST_BOOTSTRAP_CONFIG` environment variable - avoiding the need to manually symlink the contents of this file to `config.toml` in the working directory. Signed-off-by: David Wood <david@davidtw.co>
2020-05-12Fix bootstrap failing on win32Joshua Cotton-3/+6
2020-05-08x.py: allow configuring the build directoryJoshua Nelson-2/+9
This allows configuring the directory for build artifacts, instead of having it always be ./build. This means you can set it to a constant location, letting you reuse the same cache while working in several different directories. The configuration lives in config.toml under build.build-dir. By default, it keeps the existing default of ./build, but it can be configured to any relative or absolute path. Additionally, it allows making outputs relative to the root of the git repository using $ROOT.
2020-05-03x.py: Give a more helpful error message if curl isn't installedJoshua Nelson-23/+25
This also abstracts checking for a command into `require`. Before: ``` Updating only changed submodules Submodules updated in 0.01 seconds Traceback (most recent call last): File "./x.py", line 11, in <module> bootstrap.main() ... File "/home/joshua/src/rust/src/bootstrap/bootstrap.py", line 137, in run ret = subprocess.Popen(args, **kwargs) File "/usr/lib/python2.7/subprocess.py", line 394, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory ``` After: ``` error: unable to run `curl --version`: [Errno 2] No such file or directory Please make sure it's installed and in the path. ```
2020-04-25Detect git version before attempting to use --progressDillon Amburgey-11/+15
Otherwise each update is run twice and errors are printed
2020-03-21Remove CARGO_BUILD_TARGET from bootstrap.pylzutao-0/+4
2020-02-07PEP8 format spacingChris Simpkins-4/+3
2020-02-07remove unnecessary local variable assignment in context managerChris Simpkins-1/+1
2020-01-31Correctly reinstall rustfmt on channel changeMark Rousskov-4/+4
2019-12-21bootstrap.py fetches rustfmt.Adam Perry-3/+42
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
2019-12-01rustbuild: don't clobber RUSTFLAGS, append to itXimin Luo-5/+7
2019-11-12bootstrap: don't call support_xz in hot-pathGuanqun Lu-21/+22
2019-11-10download .tar.xz if python3 is usedGuanqun Lu-9/+23
2019-10-21Remove `src/llvm-emscripten` submoduleAlex Crichton-4/+0
With #65251 landed there's no need to build two LLVM backends and ship them with rustc, every target we have now uses the same LLVM backend! This removes the `src/llvm-emscripten` submodule and additionally removes all support from rustbuild for building the emscripten LLVM backend. Multiple codegen backend support is left in place for now, and this is intended to be an easy 10-15 minute win on CI times by avoiding having to build LLVM twice.
2019-09-09check git in bootstrap.py when trying to update submoduleGuanqun Lu-0/+8
2019-09-09use 'get_toml' instead of regular expressionGuanqun Lu-5/+15
2019-09-07Rollup merge of #64098 - Mark-Simulacrum:always-warn, r=alexcrichtonMazdak Farrokhzad-1/+2
Ensure edition lints and internal lints are enabled with deny-warnings=false Previously we only passed the deny command line flags if deny-warnings was enabled, but now we either pass -W... or -D... for each of the flags as appropriate. This is also a breaking change to x.py as it changes `--warnings=allow` to `--warnings=warn` which is what that flag actually did; we don't have an allow warnings mode.
2019-09-06it's more pythonic to use 'is not None' in python filesGuanqun Lu-1/+1
2019-09-04Ensure all warnings are emitted even on warnings=warnMark Rousskov-1/+2
2019-08-29Rollup merge of #63953 - crlf0710:bootstrap_mirroring, r=Mark-SimulacrumMazdak Farrokhzad-2/+14
bootstrap: allow specifying mirror for bootstrap compiler download.