Commit Graph

281 Commits

Author SHA1 Message Date
Michael Howell fdb3e820b1 Add a `disable-minification` option for rustdoc
This way, you can debug rustdoc's JavaScript and CSS file
with normal F12 Dev Tools and you'll have useful line numbers
to work with.
2021-03-12 12:25:16 -07:00
Felix S. Klock II 0d8bf72a36 Created experimental build.print_step_rusage setting
Intended to piggy-back on output from existing build.print_step_timings setting.
2021-02-25 11:38:51 -05:00
Guillaume Gomez 50b39b2b65 Add new rustdoc-gui test suite 2021-02-21 14:21:04 +01:00
Joshua Nelson 6457845219 Absolute bare minimum for downloading rustc from CI
- Use the same compiler for stage0 and stage1. This should be fixed at
  some point (so bootstrap isn't constantly rebuilt).
- Make sure `x.py build` and `x.py check` work.
- Use `git merge-base` to determine the most recent commit to download.
- Copy stage0 to the various sysroots in `Sysroot`, and delegate to
  Sysroot in Assemble. Leave all other code unchanged.
- Rename date -> key

  This can also be a commit hash, so 'date' is no longer a good name.

- Add the commented-out option to config.toml.example
- Disable all steps by default when `download-rustc` is enabled

  Most steps don't make sense when downloading a compiler, because they'll
  be pre-built in the sysroot. Only enable the ones that might be useful,
  in particular Rustdoc and all `check` steps.

  At some point, this should probably enable other tools, but rustdoc is
  enough to test out `download-rustc`.

- Don't print 'Skipping' twice in a row

  Bootstrap forcibly enables a dry run if it isn't already set, so
  previously it would print the message twice:

  ```
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  Skipping bootstrap::compile::Std because it is not enabled for `download-rustc`
  ```

  Now it correctly only prints once.

 ## Future work

- Add FIXME about supporting beta commits
- Debug logging will never work. This should be fixed.
2021-02-08 23:15:36 -05:00
Mara Bos 92dbfb541a
Rollup merge of #81064 - Mark-Simulacrum:support-stage1-check, r=jyn514
Support non-stage0 check

Seems to work locally - a full stage 1 check succeeds, building std (because we can't get away with checking it), and then checking the compiler and other tools. This ran into the problem that a unconditional x.py check in stage 1 *both* checks and builds stage 1 std, and then has to clean up because for some reason the rmeta and rlib artifacts conflict (though I'm not actually entirely sure why, but it doesn't seem worth digging in in too much detail).

Ideally we wouldn't be building and checking like that but it's a minor worry as checking std is pretty fast and you can avoid it if you're aiming for speed by passing the compiler (e.g., compiler/rustc) explicitly.

r? ```@jyn514```
2021-01-17 12:24:53 +00:00
Joshua Nelson 53989e449d Allow configuring the default stage for `x.py check` 2021-01-16 10:07:09 -05:00
Joshua Nelson 6766070422 Allow downloading LLVM on Windows
- Don't ignore packaging `llvm/lib/` for `rust-dev` when LLVM is linked
statically
- Add `link-type.txt` so bootstrap knows whether llvm was linked
  statically or dynamically
- Don't assume CI LLVM is linked dynamically in `bootstrap::config`
- Fall back to dynamic linking if `link-type.txt` doesn't exist
- Fix existing bug that split the output of `llvm-config` on lines, not spaces
- Enable building LLVM tests

  This works around the following llvm bug:

  ```
  llvm-config: error: component libraries and shared library

  llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libgtest.a
  llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libgtest_main.a
  llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libLLVMTestingSupport.a
  thread 'main' panicked at 'command did not execute successfully: "/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-config" "--libfiles"
  ```

  I'm not sure why llvm-config thinks these are required, but to avoid
  the error, this builds them anyway.

- Temporarily set windows as the try builder. This should be reverted
  before merging.

- Bump version of `download-ci-llvm-stamp`

  `src/llvm-project` hasn't changed, but the generated tarball has.

- Only special case MacOS when dynamic linking. Static linking works fine.
- Store `link-type.txt` to the top-level of the tarball

  This allows writing the link type unconditionally. Previously, bootstrap
  had to keep track of whether the file IO *would* succeed (it would fail
  if `lib/` didn't exist), which was prone to bugs.

- Make `link-type.txt` required

  Anyone downloading this from CI should be using a version of bootstrap
  that matches the version of the uploaded artifacts. So a missing
  link-type indicates a bug in x.py.
2021-01-15 22:07:38 -05:00
Dylan DPC 30c4e6da85
Rollup merge of #80532 - tmiasko:rm;, r=Mark-Simulacrum
remove unnecessary trailing semicolon from bootstrap
2020-12-31 22:20:56 +01:00
Tomasz Miąsko 83322c067e remove unnecessary trailing semicolon from bootstrap 2020-12-30 00:00:00 +00:00
Pietro Albini 0a2034dca4
bootstrap: add the dist.compression-formats option
The option allows to add or remove compression formats used while
producing dist tarballs.
2020-12-29 11:56:25 +01:00
bors 3ffea60dd5 Auto merge of #80262 - Mark-Simulacrum:pgo-rustc, r=pietroalbini
Utilize PGO for rustc linux dist builds

This implements support for applying PGO to the rustc compilation step (not
standard library or any tooling, including rustdoc). Expanding PGO to more tools
is not terribly difficult but will involve more work and greater CI time
commitment.

For the same reason of avoiding greater implementation time commitment,
implementing for platforms outside of x86_64-unknown-linux-gnu is skipped.
In practice it should be quite simple to extend over time to more platforms. The
initial implementation is intentionally minimal here to avoid too much work
investment before we start seeing wins for a subset of Rust users.

The choice of workloads to profile here is somewhat arbitrary, but the general
rationale was to aim for a small set that largely avoided time regressions on
perf.rust-lang.org's full suite of crates. The set chosen is libcore, cargo (and
its dependencies), and a few ad-hoc stress tests from perf.rlo. The stress tests
are arguably the most controversial, but they benefit those cases (avoiding
regressions) and do not really remove wins from other benchmarks.

The primary next step after this PR lands is to implement support for PGO in
LLVM. It is unclear whether we can afford a full LLVM rebuild in CI, though, so
the approach taken there may need to be more staggered. rustc-only PGO seems
well affordable on linux at least, giving us up to 20% wall time wins on some
crates for 15 minutes of extra CI time (1 hour with this PR, up from 45 minutes).

The PGO data is uploaded to allow others to reuse it if attempting to reproduce
the CI build or potentially, in the future, on other platforms where an
off-by-one strategy is used for dist builds at minimal performance cost.

r? `@michaelwoerister` (but tell me if you don't want to / don't feel comfortable approving and we can find others)
2020-12-23 12:54:56 +00:00
Mark Rousskov a448f88b69 Utilize PGO for rustc linux dist builds
This implements support for applying PGO to the rustc compilation step (not
standard library or any tooling, including rustdoc). Expanding PGO to more tools
is not terribly difficult but will involve more work and greater CI time
commitment.

For the same reason of avoiding greater time commitment, this currently avoids
implementing for platforms outside of x86_64-unknown-linux-gnu, though in
practice it should be quite simple to extend over time to more platforms. The
initial implementation is intentionally minimal here to avoid too much work
investment before we start seeing wins for a subset of Rust users.

The choice of workloads to profile here is somewhat arbitrary, but the general
rationale was to aim for a small set that largely avoided time regressions on
perf.rust-lang.org's full suite of crates. The set chosen is libcore, cargo (and
its dependencies), and a few ad-hoc stress tests from perf.rlo. The stress tests
are arguably the most controversial, but they benefit those cases (avoiding
regressions) and do not really remove wins from other benchmarks.

The primary next step after this PR lands is to implement support for PGO in
LLVM. It is unclear whether we can afford a full LLVM rebuild in CI, though, so
the approach taken there may need to be more staggered. rustc-only PGO seems
well affordable on linux at least, giving us up to 20% wall time wins on some
crates for 15 minutes of extra CI time (1 hour up from 45 minutes).

The PGO data is uploaded to allow others to reuse it if attempting to reproduce
the CI build or potentially, in the future, on other platforms where an
off-by-one strategy is used for dist builds at minimal performance cost.
2020-12-22 12:23:37 -05:00
J. Ryan Stinnett e628fcfcb5 Skip `dsymutil` by default for compiler bootstrap
`dsymutil` adds time to builds on Apple platforms for no clear benefit, and also
makes it more difficult for debuggers to find debug info. The compiler currently
defaults to running `dsymutil` to preserve its historical default, but when
compiling the compiler itself, we skip it by default since we know it's safe to
do so in that case.
2020-12-20 02:55:35 +00:00
nooberfsh 331d52643a Fix a bootstrap comment 2020-11-29 10:02:24 +08:00
bors d806d65657 Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum
x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-21 15:43:09 +00:00
12101111 36972b0d63 fix handling the default config for profiler and sanitizers 2020-11-18 10:33:07 +08:00
Josh Stone 5f08568042 x.py: allow a custom string appended to the version
This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.
2020-11-16 14:08:21 -08:00
Joshua Nelson 31741aad39 Add `--color` support to bootstrap
This allows using bootstrap with https://github.com/Canop/bacon.
2020-11-12 16:31:21 -05:00
Jonas Schievink 194b96852f
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
Support enable/disable sanitizers/profiler per target

This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target.
If these options are empty, the global options under `[build]` will take effect.

Fix #78329
2020-11-11 20:58:56 +01:00
Dylan DPC 7ac079f047
Rollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum
Enable LLVM Polly via llvm-args.

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a `-Z` flag for each one of them.

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

I noticed that `-lto` seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615
2020-11-09 19:06:51 +01:00
Jake Goulding 8cae2f167c Honor the rustfmt setting in config.toml
Prior to this, setting the rustfmt configuration was ignored:

```
% mkdir example

% cd example

% ../configure --set build.rustfmt=/usr/bin/true

% ../x.py fmt
./x.py fmt is not supported on this channel
failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt
Build completed unsuccessfully in 0:00:01
```

And after:

```
% ../x.py fmt
Build completed successfully in 0:00:11
```
2020-11-07 13:36:42 -05:00
Joseph Rafael Ferrer 301bb123f4 Enable LLVM Polly via llvm-args. 2020-10-30 18:23:02 +08:00
12101111 b989d46b48 Support enable/disable sanitizers/profiler per target 2020-10-26 10:34:07 +08:00
Marc-Antoine Perennou 66fa42a946 allow using the system-wide llvm-libunwind as the unwinder
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-10-21 14:45:58 +02:00
Antoine Martin ab614b0f01 Implement "if-available" option for download-ci-llvm 2020-10-13 18:00:25 +02:00
Pietro Albini 60ae018bf1
bootstrap: add --include-default-paths to ./x.py 2020-10-12 19:53:25 +02:00
Thom Chiovoloni afe83d4c1c Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml} 2020-10-04 18:35:16 -07:00
bors d92d28e523 Auto merge of #77298 - jyn514:bootstrap-config, r=Mark-Simulacrum
Don't warn if the config file is somewhere other than `config.toml`

Previously, `config.config` was always hardcoded as `"config.toml"`.
I thought that it was being overridden with the actual value later, but
it turns out `flags.config` was being completely discarded. This keeps
`config.config` in sync with `flags.config`.

Fixes https://github.com/rust-lang/rust/issues/77293
r? `@Mark-Simulacrum`
cc `@davidtwco`
2020-09-30 15:03:09 +00:00
Tyler Mandry 52ca5ca7b7 Remove skip_only_host_steps
And make tests explicitly list their hosts and targets.
2020-09-28 19:32:46 +00:00
Tyler Mandry e715c7f234 bootstrap: Always build for host, even when target is given
This changes the behavior from *not* building for host whenever an
explicit target is specified. I find this much less confusing.

You can still disable host steps by passing an explicit empty list for
host.

Fixes #76990.
2020-09-28 19:32:46 +00:00
Joshua Nelson d537067c97 Don't warn if the config file is somewhere other than `config.toml`
Previously, `config.config` was always hardcoded as `"config.toml"`.
I thought that it was being overridden with the actual value later, but
it turns out `flags.config` was being completely discarded. This keeps
`config.config` in sync with `flags.config`.
2020-09-28 10:28:15 -04:00
Ralf Jung c39598aeea
Rollup merge of #76631 - jyn514:x.py-setup, r=Mark-Simulacrum
Add `x.py setup`

Closes #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
2020-09-26 12:58:13 +02:00
Joshua Nelson 9baa601afd Add `x.py setup`
- 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
2020-09-24 10:32:45 -04:00
Dylan MacKenzie bcbd2ccc8d Add `keep-stage-std` to `x.py`
This keeps only the `std` artifacts compiled by the given stage, not the
compiler. This is useful when working on the latter stages of the
compiler in tandem with the standard library, since you don't have to
rebuild the *entire* compiler when the standard library changes.
2020-09-23 14:25:23 -07:00
Joshua Nelson fe6fc555ac Add a changelog for x.py
- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added
2020-09-21 09:08:18 -04:00
Ralf Jung 8fa75a2b3a
Rollup merge of #76628 - jyn514:default-config-files, r=Mark-Simulacrum
Add sample defaults for config.toml

- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`.
- Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set.
- Combine config files using the `merge` dependency.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.

Closes #76619
2020-09-21 10:40:28 +02:00
Joshua Nelson c9c8fb88cf Add sample defaults for config.toml
- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`
- Add default config files
- Combine config files using the merge dependency.
- Add comments to default config files
- Add a README asking to open an issue if the defaults are bad
- Give a loud error if trying to merge `.target`, since it's not
  currently supported
- Use an exhaustive match
- Use `<none>` in config.toml.example to avoid confusion
- Fix bugs in `Merge` derives

Previously, it would completely ignore the profile defaults if there
were any settings in `config.toml`. I sent an email to the `merge` maintainer
asking them to make the behavior in this commit the default.

This introduces a new dependency on `merge` that hasn't yet been vetted.

I want to improve the output when `include = "x"` isn't found:

```
thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy
Build completed unsuccessfully in 0:00:00
```

However that seems like it could be fixed in a follow-up.
2020-09-20 16:18:58 -04:00
Mark Rousskov a625ab77e8 Discover Rust toolchain without Python 2020-09-20 16:18:58 -04:00
Mark Rousskov e21eb613e0 Remove support for different src directory
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-20 16:18:58 -04:00
Mark Rousskov 6d19561587 Set BUILD_TRIPLE via build script
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-20 16:18:58 -04:00
Ralf Jung 404cce0685
Rollup merge of #76796 - jyn514:wrong-stage, r=shepmaster
Give a better error message when x.py uses the wrong stage for CI

r? @shepmaster
2020-09-19 11:47:54 +02:00
Joshua Nelson be37265708 Give a better error message when x.py uses the wrong stage for CI 2020-09-16 12:00:56 -04:00
Joshua Nelson d04ca008e1 Remove unnecessary `clone()`s in bootstrap
The performance difference is negligible, but it makes me feel better.

Note that this does not remove some clones in `config`, because it would
require changing the logic around (and performance doesn't matter
for bootstrap).
2020-09-16 08:51:42 -04:00
bors 1e11660d1e Auto merge of #76625 - jyn514:default-stages, r=Mark-Simulacrum
Make the default stage for x.py configurable

This also allows configuring each sub-command individually.

Possibly #76617 should land before this? I don't feel strongly either way, I don't mind waiting.

Closes https://github.com/rust-lang/rust/issues/76165.
r? `@Mark-Simulacrum`
2020-09-16 04:05:22 +00:00
Joshua Nelson 328c61c157 Make the default stage for x.py configurable
This allows configuring the default stage for each sub-command individually.

- Normalize the stage as early as possible, so there's no confusion
  about which to use.
- Don't add an explicit `stage` option in config.toml

  This offers no more flexibility than `*_stage` and makes it confusing
  which takes precedence.

- Always give `--stage N` precedence over config.toml
- Fix bootstrap tests

  This changes the tests to go through `Config::parse` so that they test
  the actual defaults, not the dummy ones provided by `default_opts`.  To
  make this workable (and independent of the environment), it does not
  read `config.toml` for tests.
2020-09-15 11:19:55 -04:00
bors 4e48010b95 Auto merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Add a dedicated debug-logging option to config.toml

`@Mark-Simulacrum` and I were talking in zulip and we found that turning on debug/trace logging in rustc is fairly confusing, as it effectively depends on debug-assertions and is not documented as such. `@Mark-Simulacrum` mentioned that we should probably have a separate option for logging anyways.

this diff adds that, having the option follow debug-assertions (so everyone's existing config.toml should be fine) and if the option is false

to test I ran ./x.py test <something> twice, once with `debug-logging = false` and once with `debug-logging = true` and made sure i only saw trace's when it was true
2020-09-13 07:21:31 +00:00
Mark Rousskov 2e87a6e78d Set link-shared if LLVM ThinLTO is enabled in config.rs
This avoids missing a shared build when uplifting LLVM artifacts into the
sysroot. We were already producing a shared link anyway, though, so this is not
a visible change from the end user's perspective.
2020-09-12 15:10:55 -04:00
Mark Rousskov a7b092f418 Download LLVM from CI to bootstrap 2020-09-12 15:10:09 -04:00
Mark Rousskov 78125ec6b3 Stop implicitly appending triples to config.toml hosts and targets
Previously, the CLI --target/--host definitions and configured options differed
in their effect: when setting these on the CLI, only the passed triples would be
compiled for, while in config.toml we would also compile for the build triple
and any host triples. This is needlessly confusing; users expect --target and
--host to be identical to editing the configuration file.

The new behavior is to respect --host and --target when passed as the *only*
configured triples (no triples are implicitly added). The default for --host is
the build triple, and the default for --target is the host triple(s), either
configured or the default build triple.
2020-09-11 08:59:01 -04:00
Gus Wynn 15aa6f31b9 add debug-logging to config.toml 2020-09-10 16:39:04 -07:00