about summary refs log tree commit diff
path: root/src/bootstrap
AgeCommit message (Collapse)AuthorLines
2024-08-13separate inner function (`get_toml`) of `Config::parse`onur-ozkan-34/+36
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-13copy `builder-config` file into ci-rustc sysrootonur-ozkan-4/+7
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-13Rollup merge of #128983 - Kobzol:bootstrap-target, r=onur-ozkanMatthias Krüger-70/+70
Slightly refactor `TargetSelection` in bootstrap Mostly a drive-by refactoring of `TargetSelection` to reduce some manual "windows-gnu" detection and also accesses to the `triple` field. r? `@onur-ozkan`
2024-08-13Rollup merge of #128841 - lqd:rustc-args, r=onur-ozkanMatthias Krüger-16/+13
bootstrap: don't use rustflags for `--rustc-args` r? `@onur-ozkan` This is going to require a bit of context. https://github.com/rust-lang/rust/pull/47558 has added `--rustc-args` to `./x test` to allow passing flags when building `compiletest` tests. It was made specifically because using `RUSTFLAGS` would rebuild the compiler/stdlib, which would in turn require the flag you want to build tests with to successfully bootstrap. #113178 made the request that it also works for other tests and doctests. This is not trivial to support across the board for `library`/`compiler` unit-tests/doctests and across stages. This issue was closed in #113948 by using `RUSTFLAGS`, seemingly incorrectly since https://github.com/rust-lang/rust/pull/123489 fixed that part to make it work. Unfortunately #123489/#113948 have regressed the goals of `--rustc-args`: - now we can't use rustc args that don't bootstrap, to run the UI tests: we can't test incomplete features. The new trait solver doesn't bootstrap, in-progress borrowck/polonius changes don't bootstrap, some other features are similarly incomplete, etc. - using the flag now rebuilds everything from scratch: stage0 stdlib, stage1 compiler, stage1 stdlib. You don't need to re-do all this to compile UI tests, you only need the latter to run stdlib tests with a new flag, etc. This happens for contributors, but also on CI today. (Not to mention that in doing that it will rebuild things with flags that are not meant to be used, e.g. stdlib cfgs that don't exist in the compiler; or you could also imagine that this silently enables flags that were not meant to be enabled in this way). Since then, https://github.com/rust-lang/rust/pull/125011/commits/bd71c71ea04b4a4f954e579c2a6d44113274846a has started using it to test a stdlib feature, relying on the fact that it now rebuilds everything. So #125011 also regressed CI times more than necessary because it rebuilds everything instead of just stage 1 stdlib. It's not easy for me to know how to properly fix #113178 in bootstrap, but #113948/#123489 are not it since they regress the initial intent. I'd think bootstrap would have to know from the list of test targets that are passed that the `library` or `compiler` paths that are passed could require rebuilding these crates with different rustflags, probably also depending on stages. Therefore I would not be able to fix it, and will just try in this PR to unregress the situation to unblock the initial use-case. It seems miri now also uses `./x miri --rustc-args` in this incorrect meaning to rebuild the `library` paths they support to run with the new args. I've not made any bootstrap changes related to `./x miri` in this PR, so `--rustc-args` wouldn't work there anymore. I'd assume this would need to use rustflags again but I don't know how to make that work properly in bootstrap, hence opening as draft, so you can tell me how to do that. I assume we don't want to break their use-case again now that it exists, even though there are ways to use `./x test` to do exactly that. `RUSTFLAGS_NOT_BOOTSTRAP=flag ./x test library/std` is a way to run unit tests with a new flag without rebuilding everything, while with #123489 there is no way anymore to run tests with a flag that doesn't bootstrap. --- edit: after review, this PR: - renames `./x test --rustc-args` to `./x test --compiletest-rustc-args` as it only applies there, and cannot use rustflags for this purpose. - fixes the regression that using these args rebuilt everything from scratch - speeds up some CI jobs via the above point - removes `./x miri --rustc-args` as only library tests are supported, needs to rebuild libstd, and `./x miri --compiletest-rustc-args` wouldn't work since compiletests are not supported.
2024-08-13Implement `AsRef<Path>` for `TargetSelection`Jakub Beránek-61/+57
2024-08-13Create a `TargetSelection` method for recognizing `*-windows-gnu` targetsJakub Beránek-9/+13
2024-08-12Rollup merge of #129000 - RalfJung:miri-bootstrap-clear, r=onur-ozkanMatthias Krüger-6/+8
bootstrap: clear miri ui-test deps when miri sysroot gets rebuilt Second attempt after https://github.com/rust-lang/rust/pull/128683: seems like it's not the compiler changing that we care about, but the sysroot changing. I did some local testing with sysroot rebuilds and it works fine for at least those cases I checked. r? ``@onur-ozkan``
2024-08-12add change tracker noticeRémy Rakic-0/+5
2024-08-12rename `./x test`'s `--rustc-args` to `--compiletest-rustc-args`Rémy Rakic-7/+7
2024-08-12remove unexpected `--rustc-args` from `./x miri`Rémy Rakic-4/+1
2024-08-12clarify that `--rustc-args` is for compiletest testsRémy Rakic-1/+1
2024-08-12 don't use rustflags for `--rustc-args`Rémy Rakic-5/+0
2024-08-12Rollup merge of #128878 - Kobzol:refactor-flags, r=onur-ozkanGuillaume Gomez-29/+48
Slightly refactor `Flags` in bootstrap The next step for https://github.com/rust-lang/rust/issues/126819 is to track commands executed inside `Config::parse`. This is quite challenging, because (tracked) command execution needs to access some state that is stored inside `Config`, which creates a sort of a chicken-and-egg problem. I would like to first untangle `Config::parse` a little bit, which is what this PR starts with. Tracking issue: https://github.com/rust-lang/rust/issues/126819 r? `@onur-ozkan`
2024-08-12bootstrap: clear miri ui-test deps when miri sysroot gets rebuiltRalf Jung-6/+8
2024-08-11Auto merge of #122362 - Zoxc:rustc_driver_static_std, ↵bors-4/+34
r=oli-obk,lqd,bjorn3,Kobzol Link `std` statically in `rustc_driver` This makes `rustc_driver` statically link to `std`. This is done by not passing `-C prefer-dynamic` when building `rustc_driver`. However building `rustc-main` won't work currently as it tries to dynamically link to both `rustc_driver` and `std` resulting in a crate graph with `std` duplicated. To fix that new command line option `-Z prefer_deps_of_dynamic` is added which prevents linking to a dylib if there's a static variant of it already statically linked into another dylib dependency. The main motivation for this change is to enable `#[global_allocator]` to be used in `rustc_driver` allowing overriding the allocator used in rustc on all platforms. --- Instead of adding `-Z prefer_deps_of_dynamic`, this PR is changed to crate opt-in to the linking change via the `rustc_private` feature instead, as that would be typically needed to link to `rustc_driver` anyway. --- try-job: aarch64-apple try-job: x86_64-msvc try-job: i686-mingw try-job: dist-x86_64-msvc try-job: aarch64-gnu
2024-08-11Rollup merge of #128592 - evelynharthbrooke:master, r=Mark-SimulacrumMatthias Krüger-1/+1
Promote aarch64-apple-darwin to Tier 1 This promotes aarch64-apple-darwin to Tier 1 status as per rust-lang/rfcs#3671 and tracking issue #73908. Not sure what else is necessary for this to impement the aforementioned RFC, however I figured I'd try. I did read in previous issues and PRs that the necessary infrastructure was already in place for the aarch64-apple-darwin target, and the RFC mentions the same. So this should be all thats necessary in order for the target to be promoted. This is a recreation of my previous PR because I accidentally did an incorrect git rebase which caused unnecessary changes to various commit SHAs. So this PR is a recreation of my previous PR without said stumble. My bad.
2024-08-11Keep rustc's std copyJohn Kåre Alsaker-12/+1
2024-08-11Exclude just `std` from rustc depsJohn Kåre Alsaker-9/+5
2024-08-11Don't statically link `std` into `rustc_driver` for `windows-gnu`John Kåre Alsaker-4/+30
2024-08-11Link `std` statically in `rustc_driver`John Kåre Alsaker-5/+24
2024-08-10Distribute rustc_codegen_cranelift for Windowsbjorn3-12/+3
2024-08-09Auto merge of #125642 - khuey:zstd, r=Kobzolbors-4/+21
Enable zstd for debug compression. Set LLVM_ENABLE_ZSTD alongside LLVM_ENABLE_ZLIB so that --compress-debug-sections=zstd is an option. See #120953 try-job: x86_64-gnu-tools
2024-08-09Rollup merge of #128874 - Kobzol:cmd-verbose-logging, r=onur-ozkanMatthias Krüger-5/+14
Disable verbose bootstrap command failure logging by default One of my recent bootstrap command refactoring PRs enabled verbose logging of command failures by default. While this is great for debugging bootstrap, in many situations it's just too verbose and prevents the user from seeing the actual printed stdout/stderr, which usually contains much more useful information. This PR reverts that logic, and only prints a detailed error when `-v` is passed to bootstrap. r? ````@onur-ozkan````
2024-08-09Rollup merge of #128822 - onur-ozkan:add-build-config-in-tarballs, r=KobzolMatthias Krüger-1/+11
add `builder-config` into tarball sources This will be useful for certain scenarios where developers want to know how the tarball sources were generated. We also want this to check for CI rustc incompatible options on bootstrap. Blocker for #122709 r? Kobzol
2024-08-09Pass `Flags` to `Config::parse` explicitlyJakub Beránek-19/+24
2024-08-09Move verbose help parsing to `main`Jakub Beránek-10/+24
To remove a side effect (process exit) when parsing config.
2024-08-09Do not print verbose error when a bootstrap command fails without verbose modeJakub Beránek-4/+12
2024-08-09Enable zstd for debug compression.Kyle Huey-4/+21
Set LLVM_ENABLE_ZSTD alongside LLVM_ENABLE_ZLIB so that --compress-debug-sections=zstd is an option. Use static linking to avoid a new runtime dependency. Add an llvm.libzstd bootstrap option for LLVM with zstd. Set it off by default except for the dist builder. Handle llvm-config --system-libs output that contains static libraries.
2024-08-09Make `Build::run` comment more accurateJakub Beránek-1/+2
2024-08-09don't try to find target tools on certain commandsonur-ozkan-9/+23
For commands like check/clean there is no need to check for target tools. Avoiding this check can also speed up the process. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-09call `Cargo::configure_linker` only for specific commandsonur-ozkan-1/+9
Calling `Cargo::configure_linker` unconditionally slows down certain commands (e.g., "check" command) without providing any benefit. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-09use absolute path for `config.toml`onur-ozkan-1/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-09add `builder-config` into tarball sourcesonur-ozkan-0/+6
This will be useful for certain scenarios where developers want to know how the tarball sources were generated. We also want this to check for CI rustc incompatible options on bootstrap. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-07Rollup merge of #128353 - ↵Matthias Krüger-1/+3
ferrocene:jonathanpallant/add-dependencies-to-copyright-file, r=Kobzol Change generate-copyright to generate HTML, with cargo dependencies included `x.py run generate-copyright` now produces `build/COPYRIGHT.html`. This includes a new format for in-tree dependencies, and also adds out-of-tree cargo dependencies. After consulting expert opinion, I have elected to include every top-level: * `*NOTICE*` * `*AUTHOR*` * `*LICENSE*` * `*LICENCE*`, and * `*COPYRIGHT*` file I can find - case-insensitive. This is because the cargo package metadata's `author` field is not a list of copyright holders and does not meet the requirements of the Apache-2.0 license (which says you must include a NOTICE file with the binary if one was supplied by the author) nor the MIT license (which says you must include 'the above copyright notice'). I believe it would be appropriate to include this file with every Rust release, in order to do an even better job of appropriately recognising the efforts of the authors of the first-party and third-party libraries we are using here. The output includes something like 524 copies of the Apache-2.0 text because they are not all identical. I think I count about 50 different variations by shasum - some differ in whitespace, while some have the boilerplate block at the bottom erroneously modified (don't modify the copy in the license, modify the copy you paste into your own source code!). Running `gzip` on the HTML file largely makes this problem go away, and the average browser is far happier with a ~6 MiB HTML file than the average Markdown viewer is with a ~6 MiB markdown file. But, if someone wants to, do they could submit a follow-up which de-dups the license text files and adds back-links to earlier identical copies (for some value of 'identical copy'). ```console $ xpy run generate-copyright $ cd build $ gzip -c COPYRIGHT.html > COPYRIGHT.gz $ xz -c COPYRIGHT.html > COPYRIGHT.xz $ ls -lh COPYRIGHT.* -rw-r--r-- 1 jonathan staff 241K 29 Jul 17:19 COPYRIGHT.gz -rw-r--r--@ 1 jonathan staff 6.6M 29 Jul 11:30 COPYRIGHT.html -rw-r--r-- 1 jonathan staff 59K 29 Jul 17:19 COPYRIGHT.xz ``` Here's an example [COPYRIGHT.gz](https://github.com/user-attachments/files/16416147/COPYRIGHT.gz).
2024-08-07bootstrap: clear miri's ui test deps when rustc changesRalf Jung-0/+8
2024-08-06Rollup merge of #128685 - bjorn3:rust_src_remove_leftover, r=onur-ozkanMatthias Krüger-4/+0
Remove the root Cargo.lock from the rust-src component The Cargo.lock in library/ should be used instead. Including the Cargo.lock for the root workspace is both unnecessary and confusing. Missed in https://github.com/rust-lang/rust/pull/128534
2024-08-06improve rustup check in `x setup`onur-ozkan-4/+15
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-06remove redundant FIXMEsonur-ozkan-17/+6
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-06unify path syncing logic for vendor and distonur-ozkan-35/+31
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-06generate-copyright: Produce HTML, not MarkdownJonathan Pallant-1/+1
This format works better with large amounts of structured data. We also mark which deps are in the stdlib
2024-08-06Update generate-copyrightJonathan Pallant-0/+2
This tool now scans for cargo dependencies and includes any important looking license files. We do this because cargo package metadata is not sufficient - the Apache-2.0 license says you have to include any NOTICE file, for example. And authors != copyright holders (cargo has the former, we must include the latter).
2024-08-05Rollup merge of #128686 - onur-ozkan:unnecessary-type-cast, r=KobzolMatthias Krüger-2/+1
fix the invalid argument type It was obviously wrong..
2024-08-05Rollup merge of #128631 - onur-ozkan:hotfix, r=Mark-SimulacrumMatthias Krüger-2/+12
handle crates when they are not specified for std docs Fixes a regression from https://github.com/rust-lang/rust/pull/128182. Resolves #128610
2024-08-05fix the invalid argument type in `helpers::get_closest_merge_base_commit`onur-ozkan-2/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-05Remove the root Cargo.lock from the rust-src componentbjorn3-4/+0
The Cargo.lock in library/ should be used instead. Including the Cargo.lock for the root workspace is both unnecessary and confusing.
2024-08-05Rollup merge of #127974 - onur-ozkan:force-std-builds, r=Mark-SimulacrumMatthias Krüger-8/+31
force compiling std from source if modified This allows the standard library to be compiled even with `download-rustc` enabled. Which means it's no longer a requirement to compile `rustc` in order to compile `std`. Ref. https://github.com/rust-lang/rust/pull/127322#discussion_r1666418280. Blocker for https://github.com/rust-lang/rust/pull/122709.
2024-08-04Auto merge of #128534 - bjorn3:split_stdlib_workspace, r=Mark-Simulacrumbors-2/+8
Move the standard library to a separate workspace This ensures that the Cargo.lock packaged for it in the rust-src component is up-to-date, allowing rust-analyzer to run cargo metadata on the standard library even when the rust-src component is stored in a read-only location as is necessary for loading crates.io dependencies of the standard library. This also simplifies tidy's license check for runtime dependencies as it can now look at all entries in library/Cargo.lock without having to filter for just the dependencies of runtime crates. In addition this allows removing an exception in check_runtime_license_exceptions that was necessary due to the compiler enabling a feature on the object crate which pulls in a dependency not allowed for the standard library. While cargo workspaces normally enable dependencies of multiple targets to be reused, for the standard library we do not want this reusing to prevent conflicts between dependencies of the sysroot and of tools that are built using this sysroot. For this reason we already use an unstable cargo feature to ensure that any dependencies which would otherwise be shared get a different -Cmetadata argument as well as using separate build dirs. This doesn't change the situation around vendoring. We already have several cargo workspaces that need to be vendored. Adding another one doesn't change much. There are also no cargo profiles that are shared between the root workspace and the library workspace anyway, so it doesn't add any extra work when changing cargo profiles.
2024-08-04Update incorrect commentbjorn3-1/+1
2024-08-04Rollup merge of #128589 - onur-ozkan:llvm-configs, r=cuviperMatthias Krüger-3/+17
allow setting `link-shared` and `static-libstdcpp` with CI LLVM These options also affect `compiler/rustc_llvm` builds. They should be configurable even when using CI LLVM. r? ```@cuviper```
2024-08-04handle crates when they are not specified for std docsonur-ozkan-2/+12
This fixes a regression from https://github.com/rust-lang/rust/pull/128182. Signed-off-by: onur-ozkan <work@onurozkan.dev>