98 Commits

Author SHA1 Message Date
Eric Huss
d8673d93d2 Fix env/cfg set for cargo test and cargo run. 2021-02-01 19:20:54 -08:00
Alex Crichton
21a5efb483 Fix links vars showing up for testing packages
If a package is tested and the library for the package wasn't built
(e.g. only tested or it wasn't present) then the `links` env vars from
dependencies weren't showing up to the build script by accident. This
was an accidental regression from #8969.

The intention of #8969 was to exclude connections to build scripts
connected via dev-dependencies, but it only applied a heuristic because
the unit graph doesn't retain information about dev-dependencies. The
fix here is to instead actually retain information about
dev-dependencies which is only used for constructing the unit graph and
connecting build script executions to one another.

Closes #9063
2021-01-12 06:59:54 -08:00
Alex Crichton
6f49ce636f Revert "Run rustdoc doctests relative to the workspace"
This reverts commit 2cc2ae8c963298143b71dceab0014dc09d4f65a8.
2020-12-18 08:06:43 -08:00
Eric Huss
cee088b0db Check if rerun-if-changed points to a directory. 2020-12-12 14:14:54 -08:00
Alex Crichton
4761ada30f Fix the unit dependency graph with dev-dependency links
This commit fixes #8966 by updating the unit generation logic to avoid
generating an erroneous circular dependency between the execution of two
build scripts. This has been present for Cargo in a long time since #5651
(an accidental regression), but the situation appears rare enough that
we didn't get to it until now!

Closes #8966
2020-12-11 09:59:33 -08:00
Arpad Borsos
2cc2ae8c96 Run rustdoc doctests relative to the workspace
By doing so, rustdoc will also emit workspace-relative filenames for
the doctests.

fixes #8097
2020-12-06 23:21:06 +01:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Camelid
82c834cec2 Update tests 2020-09-07 10:57:00 -07:00
Eric Huss
51e0c71c5f Allow package.exclude patterns to match directories. 2020-04-22 11:26:19 -07:00
Eric Huss
9ed56cad00 Add some more context to errors walking path sources. 2020-04-22 11:21:27 -07:00
Eric Huss
b19d6ac2a7 Update tests and comments for testing windows-gnu. 2020-04-21 11:00:37 -07:00
Mateusz Mikuła
9f742466f1 Update tests for windows-gnu 2020-04-21 17:25:25 +02:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss
4367ec4d11 Use Path methods instead of fs::metadata. 2020-04-16 22:00:22 -07:00
Alex Crichton
bac300bda0 Add support for -Cembed-bitcode=no
This commit is the Cargo half of support necessary for
rust-lang/rust#70458. Today the compiler emits embedded bytecode in
rlibs by default, but compresses it. This is both extraneous disk space
and wasted build time for almost all builds, so the PR in question there
is changing rustc to have a `-Cembed-bitcode` flag which, when enabled,
places the bitcode in the object file rather than an auxiliary file (no
extra compression), but also enables `-Cembed-bitcode=no` to disable
bitcode emission entirely.

This Cargo support changes Cargo to pass `-Cembed-bitcode=no` for almost
all compilations. Cargo will keep `lto = true` and such working by not
passing this flag (and thus allowing bitcode to get embedded), but by
default `cargo build` and `cargo build --release` will no longer have
any bitcode in rlibs which should result in speedier builds!

Most of the changes here were around the test suite and various
assertions about the `rustc` command lines we spit out. One test was
hard-disabled until we can get `-Cembed-bitcode=no` into nightly, and
then we can make it a nightly-only test. The test will then be stable
again once `-Cembed-bitcode=no` hits stable.

Note that this is intended to land before the upstream `-Cembed-bitcode`
change. The thinking is that we'll land everything in rust-lang/rust all
at once so there's no build time regressions for anyone. If we were to
land the `-Cembed-bitcode` PR first then there would be a build time
regression until we land Cargo changes because rustc would be emitting
uncompressed bitcode by default and Cargo wouldn't be turning it off.
2020-04-01 14:31:06 -07:00
Alex Tokarev
590c803ff1 Print colored warnings when build script panics
Fixes #3672
2020-03-18 22:08:17 +03:00
Eric Huss
0a2f691381 Switch azure to macOS 10.15. 2020-02-19 16:46:29 -08:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss
4dbc63ef1e Update some tests that now support stable. 2019-11-07 11:16:18 -08:00
Eric Huss
bd73e8dab5 Stabilize cache-messages 2019-09-30 14:04:10 -07:00
Dan Aloni
375a46f18b Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-18 08:56:13 +03:00
Jonas Schievink
26229cd8ad Uncapitalize "Could not compile" error message
"could not compile ..." matches other Cargo and rustc errors and
warnings better.
2019-09-17 00:50:49 +02:00
Alex Crichton
ebd10526f3 Run rustfmt 2019-09-16 12:00:12 -07:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Aaron Hill
5bc05b40f0
Add tests 2019-09-12 13:38:10 -04:00
Dan Aloni
f0896975be Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-08 21:43:41 +03:00
Eric Huss
1f14fa3172 Basic standard library support. 2019-09-03 13:53:59 -07:00
Robert Morrison
18c604f5bc
Added tests for #7217 2019-08-16 22:25:53 -04:00
Dan Aloni
23e613d552 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-08-09 11:50:55 +03:00
Eric Huss
4a37adc104 Fix an old test. 2019-08-04 11:09:25 -07:00
Alex Crichton
daa1bce283 Enable pipelined compilation by default
This commit enables pipelined compilation by default in Cargo now that
the requisite support has been stablized in rust-lang/rust#62766. This
involved minor updates in a number of locations here and there, but
nothing of meat has changed from the original implementation (just
tweaks to how rustc is called).
2019-07-31 14:56:24 -07:00
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Eric Huss
a4e9611453 Fix some formatting for some strings. 2019-07-13 16:00:47 -07:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Dan Aloni
e25f6a4255 tests: fix finished line for 'cargo test' 2019-06-07 21:47:45 +03:00
bors
2e09266f66 Auto merge of #6883 - alexcrichton:pipelining-v2, r=ehuss
Implement the Cargo half of pipelined compilation (take 2)

This commit starts to lay the groundwork for #6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.

Initially attempted in #6864 with a pretty invasive refactoring this
iteration is much more lightweight and fits much more cleanly into
Cargo's backend. The approach taken here is to update the
`DependencyQueue` structure to carry a piece of data on each dependency
edge. This edge information represents the artifact that one node
requires from another, and then we a node has no outgoing edges it's
ready to build.

A dependency on a metadata file is modeled as just that, a dependency on
just the metadata and not the full build itself. Most of cargo's backend
doesn't really need to know about this edge information so it's
basically just calculated as we insert nodes into the `DependencyQueue`.
Once that's all in place it's just a few pieces here and there to
identify compilations that *can* be pipelined and then they're wired up
to depend on the rmeta file instead of the rlib file.

Closes #6660
2019-05-10 14:36:30 +00:00
Zach Lute
782266aaee Changed RUST_LOG usage to CARGO_LOG to avoid confusion. 2019-05-08 10:53:02 -07:00
Alex Crichton
4617f78dbc Parse rmeta directives coming from rustc
This commit updates Cargo to process JSON directives emitted by rustc
when we're pipelining compilation. In this mode Cargo will attempt to
start subsequent compilations of crates as soon as possible, fully
completing the features of pipelined compilations in Cargo!
2019-05-08 08:10:26 -07:00
Alex Crichton
1a6e452407 Refactor routing output from rustc/rustdoc
This commit refactors slightly how we actually spawn rustc/rustdoc
processes and how their output is routed. Over time lots has changed
around this, but it turns out that we unconditionally capture all output
from the compiler/rustdoc today, no exceptions. As a result simplify the
various execution functions in the `Executor` trait as well as branches
for emitting json messages. Instead throw everything in the same bucket
and just always look for lines that start with `{` which indicate a
JSON message.

This also fixes a few issues where output printed in each thread is now
routed through the main coordinator thread to handle updating the
progress bar if necessary.
2019-05-08 08:10:26 -07:00
Alex Crichton
127fdfeb89 Implement the Cargo half of pipelined compilation
This commit starts to lay the groundwork for #6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.

Initially attempted in #6864 with a pretty invasive refactoring this
iteration is much more lightweight and fits much more cleanly into
Cargo's backend. The approach taken here is to update the
`DependencyQueue` structure to carry a piece of data on each dependency
edge. This edge information represents the artifact that one node
requires from another, and then we a node has no outgoing edges it's
ready to build.

A dependency on a metadata file is modeled as just that, a dependency on
just the metadata and not the full build itself. Most of cargo's backend
doesn't really need to know about this edge information so it's
basically just calculated as we insert nodes into the `DependencyQueue`.
Once that's all in place it's just a few pieces here and there to
identify compilations that *can* be pipelined and then they're wired up
to depend on the rmeta file instead of the rlib file.
2019-05-08 08:10:26 -07:00
Eric Huss
dcad83d583 Better error if PathSource::walk can't access something. 2019-04-11 18:28:45 -07:00
Alex Crichton
8df842f594 Purge mtime information from Fingerprint
This has proven to be a very unreliable piece of information to hash, so
let's not! Instead we track what files are supposed to be relative to,
and we check both mtimes when necessary.
2019-04-10 10:42:08 -07:00
Alex Crichton
e9428cbadd Remove Freshness from DependencyQueue
Ever since the inception of Cargo and the advent of incremental
compilation at the crate level via Cargo, Cargo has tracked whether it
needs to recompile something at a unit level in its "dependency queue"
which manages when items are ready for execution. Over time we've fixed
lots and lots of bugs related to incremental compilation, and perhaps
one of the most impactful realizations was that the model Cargo started
with fundamentally doesn't handle interrupting Cargo halfway through and
resuming the build later.

The previous model relied upon implicitly propagating "dirtiness" based
on whether the one of the dependencies of a build was rebuilt or not.
This information is not available, however, if Cargo is interrupted and
resumed (or performs a subset of steps and then later performs more).
We've fixed this in a number of places historically but the purpose of
this commit is to put a nail in this coffin once and for all.

Implicit propagation of whether a unit is fresh or dirty is no longer
present at all. Instead Cargo should always know, irrespective of it's
in-memory state, whether a unit needs to be recompiled or not. This
commit actually turns up a few bugs in the test suite, so later commits
will be targeted at fixing this.

Note that this required a good deal of work on the `fingerprint` module
to fix some longstanding bugs (like #6780) and some serious hoops had to
be jumped through for others (like #6779). While these were fallout from
this change they weren't necessarily the primary motivation, but rather
to help make `fingerprints` a bit more straightforward in what's an
already confusing system!

Closes #6780
2019-04-10 10:42:08 -07:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Eh2406
4be99b2e8d Some CI setups are much slower then the equipment used by Cargo itself 2019-01-24 12:28:21 -05:00
Eric Huss
2a1adb3d6c Rename method. 2019-01-18 08:39:25 -08:00
Eric Huss
394ec96f79 Fix spurious Windows errors with switch_features_rerun. 2019-01-17 16:39:04 -08:00
Michael Wright
81390379df Display environment variables for rustc commands
This picks up on the work done in PR #5683.

The extra output is only displayed with `-vv`.

The Windows output has the form `set FOO=foo && BAR=bar rustc ...` instead of
the form that suggested in #5683 to make escaping easier and since it's
simpler.
2018-12-27 16:32:34 +02:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00