Commit Graph

176 Commits

Author SHA1 Message Date
Eric Huss 74498c17e0 Update cargo 2020-12-18 07:30:23 -08:00
bors 44ae0b8b2d Auto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichton
Fix cross compiling dist/build invocations

I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build.

Both commits are standalone; together they should resolve #76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in #76549.
2020-09-22 06:02:21 +00:00
Mark Rousskov 1aac99de25 Provide bootstrap tools with RUSTC in environment 2020-09-20 16:39:13 -04:00
Pietro Albini b9af3e30a9
bootstrap: move the version number to a plaintext file
The Rust version number is currently embedded in bootstrap's source
code, which makes it hard to update it automatically or access it
outside of ./x.py (as you'd have to parse the source code).

This commit moves the version number to a standalone plaintext file,
which makes accessing or updating it trivial.
2020-09-18 14:58:22 +02:00
Mark Rousskov bd4e0af0b5 Build rustdoc for cross-compiled targets
This isn't an issue for most folks who use x.py dist, which will directly depend
on this. But for x.py build, if we don't properly set target here rustdoc will
not be built.

Currently, there is not a default-on step for generating a rustc for a given
target either, so we will fail to build a rustc as well.
2020-09-16 17:25:39 -04:00
Eric Huss 45c1e0ae07 Auto-generate lint documentation. 2020-09-13 08:48:03 -07:00
Mark Rousskov 3193d52a21 Remove host parameter from step configurations
rustc is a natively cross-compiling compiler, and generally none of our steps
should care whether they are using a compiler built of triple A or B, just the
--target directive being passed to the running compiler. e.g., when building for
some target C, you don't generally want to build two stds: one with a host A
compiler and the other with a host B compiler. Just one std is sufficient.
2020-09-11 08:59:01 -04:00
Mark Rousskov 2656d3414c Make bootstrap build on stable
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-06 21:26:09 -04:00
bors 47ea6d90b0 Auto merge of #74091 - richkadel:llvm-coverage-map-gen-4, r=tmandry
Generating the coverage map

@tmandry @wesleywiser

rustc now generates the coverage map and can support (limited)
coverage report generation, at the function level.

Example commands to generate a coverage report:
```shell
$ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu
$ $BUILD/stage1/bin/rustc -Zinstrument-coverage \
$HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs
$ LLVM_PROFILE_FILE="main.profraw" ./main
called
$ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata
$ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main
```
![rust coverage report only 20200706](https://user-images.githubusercontent.com/3827298/86697299-1cbe8f80-bfc3-11ea-8955-451b48626991.png)

r? @wesleywiser

Rust compiler MCP rust-lang/compiler-team#278
Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-07-19 07:25:18 +00:00
Rich Kadel a6f8b8a211 Generating the coverage map
rustc now generates the coverage map and can support (limited)
coverage report generation, at the function level.

Example:

$ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu
$ $BUILD/stage1/bin/rustc -Zinstrument-coverage \
$HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs
$ LLVM_PROFILE_FILE="main.profraw" ./main
called
$ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata
$ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main
    1|      1|pub fn will_be_called() {
    2|      1|    println!("called");
    3|      1|}
    4|       |
    5|      0|pub fn will_not_be_called() {
    6|      0|    println!("should not have been called");
    7|      0|}
    8|       |
    9|      1|fn main() {
   10|      1|    let less = 1;
   11|      1|    let more = 100;
   12|      1|
   13|      1|    if less < more {
   14|      1|        will_be_called();
   15|      1|    } else {
   16|      1|        will_not_be_called();
   17|      1|    }
   18|      1|}
2020-07-17 11:49:35 -07:00
Jake Goulding e2b337dc57 Teach bootstrap about target files vs target triples
`rustc` allows passing in predefined target triples as well as JSON
target specification files. This change allows bootstrap to have the
first inkling about those differences. This allows building a
cross-compiler for an out-of-tree architecture (even though that
compiler won't work for other reasons).

Even if no one ever uses this functionality, I think the newtype
around the `Interned<String>` improves the readability of the code.
2020-07-17 10:08:04 -04:00
Aleksey Kladov 058c1b60a5 Add rust-analyzer submodule
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-07-03 16:55:35 +02:00
Eric Huss 0b9bc79738 Tests for number of times rustdoc is built with x.py test and doc. 2020-07-01 15:51:35 -07:00
Eric Huss 9154863647 Compile rustdoc less often. 2020-06-29 22:35:02 -07:00
Eric Huss 6654c5852f Remove mdbook-linkcheck. 2020-06-26 07:45:28 -07:00
Eric Huss 75983e137e Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
Joshua Nelson 936ecadcec Add src/librustdoc as an alias for src/tools/rustdoc
No one actually works with src/tools/librustdoc, it's almost empty.
2020-06-17 09:33:27 -04:00
Ralf Jung 416b010f40 x.py: do not build Miri by default 2020-06-12 09:41:27 +02:00
Ralf Jung 759e495bbf bump Miri, update for cargo-miri being a separate project 2020-06-01 20:17:26 +02:00
Igor Matuszewski 489b7e4123
Set CFG_RELEASE for tools in bootstrap/tool.rs
Since rustc-ap-* v659 we now need to set CFG_RELEASE for
rustc-ap-rustc_attr for `#[cfg(version(...))]` to work.

Co-authored-by: Eric Huss <ehuss@users.noreply.github.com>
2020-05-28 15:46:59 +02:00
Oliver Scherer a1824505d8 Gate on clippy on CI 2020-05-02 09:46:42 +02:00
Mateusz Mikuła 9296d3ba82 Do not build tools if user do not want them 2020-04-20 20:30:13 +02:00
Pietro Albini 9beb8f5477
ci: add github actions configuration 2020-03-24 15:36:07 +01:00
Josh Stone 71f5aed385 Rename add_lib_path to add_dylib_path 2020-03-18 13:49:53 -07:00
Matthias Krüger 5f979e9afa bootstrap: fix clippy warnings 2020-02-03 20:26:36 +01:00
Josh Stone 51b7044347 Build compiletest with in-tree libtest 2020-01-08 10:04:18 -08:00
Josh Stone 7c52718ba2 Remove obsolete llvm_tools flag 2020-01-08 09:44:45 -08:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Samuel Holland c648ad587c Use rustc-workspace-hack for rustbook
As rustbook now depends transitively on openssl, it needs access to the
rustc-workspace-hack/all-static feature to pick up openssl-sys/vendored.
This fixes the rust build with `all-static = true` on systems where
openssl is not installed (e.g. when cross-compiling).
2019-10-28 22:34:43 -05:00
Alex Crichton 385470b8bb Move handling of `-Cprefer-dynamic` into `builder.rs`
This logic is *super* old and can be tweaked and moved into `builder.rs`
2019-09-23 09:34:44 -07:00
Alex Crichton 0b6766d8d7 Allow adding `RUSTFLAGS` after `Builder::cargo`
This commit changes the return type of `Builder::cargo` to return a
builder that allows dynamically adding more `RUSTFLAGS` values
after-the-fact. While not used yet, this will later be used to delete
more of `rustc.rs`
2019-09-23 09:34:44 -07:00
Alex Crichton b47c9690d2 bootstrap: Merge the libtest build step with libstd
Since its inception rustbuild has always worked in three stages: one for
libstd, one for libtest, and one for rustc. These three stages were
architected around crates.io dependencies, where rustc wants to depend
on crates.io crates but said crates don't explicitly depend on libstd,
requiring a sysroot assembly step in the middle. This same logic was
applied for libtest where libtest wants to depend on crates.io crates
(`getopts`) but `getopts` didn't say that it depended on std, so it
needed `std` built ahead of time.

Lots of time has passed since the inception of rustbuild, however,
and we've since gotten to the point where even `std` itself is depending
on crates.io crates (albeit with some wonky configuration). This
commit applies the same logic to the two dependencies that the `test`
crate pulls in from crates.io, `getopts` and `unicode-width`. Over the
many years since rustbuild's inception `unicode-width` was the only
dependency picked up by the `test` crate, so the extra configuration
necessary to get crates building in this crate graph is unlikely to be
too much of a burden on developers.

After this patch it means that there are now only two build phasese of
rustbuild, one for libstd and one for rustc. The libtest/libproc_macro
build phase is all lumped into one now with `std`.

This was originally motivated by rust-lang/cargo#7216 where Cargo was
having to deal with synthesizing dependency edges but this commit makes
them explicit in this repository.
2019-08-23 16:46:11 -07:00
Mateusz Mikuła c7e16c5f47 Check links on all platforms when running locally 2019-08-09 10:32:34 +02:00
Alex Crichton 3dd00bac7c ci: Remove Travis/AppVeyor configuration
Now that we've fully moved to Azure Pipelines and bors has been updated
to only gate on Azure this commit removes the remaining Travis/AppVeyor
support contained in this repository. Most of the deletions here are
related to producing better output on Travis by folding certain
sections. This isn't supported by Azure so there's no need to keep it
around, and if Azure ever adds support we can always add it back!
2019-07-15 09:18:32 -07:00
Alex Crichton 278e5fd215 rustbuild: Improve assert about building tools once
In developing #61557 I noticed that there were two parts of our tools
that were rebuilt twice on CI. One was rustfmt fixed in #61557, but
another was Cargo. The actual fix for Cargo's double compile was
rust-lang/cargo#7010 and took some time to propagate here. In an effort
to continue to assert that Cargo is itself not compiled twice, I updated
the assertion in rustbuild at the time of working on #61557 but couldn't
land it because the fix wouldn't be ready until the next bootstrap.

The next bootstrap is now here, so the fix can now land! This does not
change the behavior of rustbuild but it is intended to catch the
previous iteration of compiling cargo twice. The main update here was to
consider more files than those in `$target/release/deps` but also
consider those in `$target/release`. That's where, for example,
`libcargo.rlib` shows up and it's the file we learn about, and that's
what we want to deduplicate.
2019-07-12 13:51:56 -07:00
Mark Rousskov 7234d8cb5e Inline prepare_tool_cmd
Removing the tool argument in the previous commit means it's no longer
restricted to just bootstrap tools despite being written as such.
Inlining it prevents accidental use.
2019-06-13 08:57:55 -06:00
Mark Rousskov 0e14818321 Delete unnecessary command 2019-06-13 08:57:55 -06:00
Alex Crichton f708228508 rustbuild: Include `rustfmt` in deduplicated dependencies
Currently `rustfmt` is excluded from the "don't build dependencies
twice" check but it's currently building dependencies twice! Namely big
dependencies like `rustc-ap-syntax` are built once for rustfmt and once
for the RLS. This commit includes `rustfmt` in these checks and then
fixes the resulting feature mismatches for winapi.
2019-06-05 12:40:02 -07:00
bors 19e0ddbb9f Auto merge of #61212 - alexcrichton:skip-rustc, r=pietroalbini
ci: Attempt to skip a full rustc compile on dist*

Currently when we're preparing cross-compiled compilers it can take
quite some time because we have to build the compiler itself three
different times. The first is the normal bootstrap, the second is a
second build for the build platform, and the third is the actual target
architecture compiler. The second compiler was historically built
exclusively for procedural macros, and long ago we didn't actually need
it.

This commit tries out avoiding that second compiled compiler, meaning we
only compile rustc for the build platform only once. Some local testing
shows that this is promising, but bors is of course the ultimate test!
2019-05-30 00:38:51 +00:00
Alex Crichton ad52c77a46 ci: Attempt to skip a full rustc compile on dist*
Currently when we're preparing cross-compiled compilers it can take
quite some time because we have to build the compiler itself three
different times. The first is the normal bootstrap, the second is a
second build for the build platform, and the third is the actual target
architecture compiler. The second compiler was historically built
exclusively for procedural macros, and long ago we didn't actually need
it.

This commit tries out avoiding that second compiled compiler, meaning we
only compile rustc for the build platform only once. Some local testing
shows that this is promising, but bors is of course the ultimate test!
2019-05-26 07:39:14 -07:00
ljedrz 2f3533b758 Add clippy and fix commands to x.py 2019-05-25 15:30:16 +02:00
Vadim Petrochenkov 28405cabd5 rustbuild: Simplify debuginfo configuration 2019-05-24 11:49:30 +03:00
Andy Russell b2f71fb540
remove unneeded `extern crate`s from build tools 2019-05-09 12:03:13 -04:00
Michael Woerister c95f5e31c7 bootstrap: Don't add LLVM's bin directory to the PATH for tool invocations. 2019-04-29 14:55:29 +02:00
Josh Stone 49b65e683d Don't ignore git for LLVM info 2019-03-30 11:14:02 -07:00
bors 33b3b136c5 Auto merge of #58897 - Mark-Simulacrum:tool-rework, r=alexcrichton
Rework how bootstrap tools are built

This makes bootstrap tools buildable and testable in stage 0 with the downloaded bootstrap compiler, futhermore, it makes it such that they cannot be built in any other stage.

Notably, this will also mean that compiletest may need to wait a cycle before it can use changes to `libtest`, as it no longer depends on the in-tree libtest.
2019-03-20 23:02:17 +00:00
bjorn3 0e0488fa53 Fix formatting 2019-03-16 10:54:38 +01:00
bjorn3 1c7d368ebe [bootstrap] Remove llvm.enabled config 2019-03-16 10:54:38 +01:00
John Kåre Alsaker f2ef283b72 Make Cargo a rustc tool again 2019-03-06 18:48:08 +01:00
John Kåre Alsaker e501a87e89 Bootstrap changes 2019-03-05 00:36:24 +01:00