Commit graph

2045 commits

Author SHA1 Message Date
Eric Huss 025e23b83e Update tests now that cargo check does not re-check bins. 2018-04-27 13:42:30 -07:00
Eric Huss b9181ef3b5 Add some more tests. 2018-04-27 13:42:30 -07:00
Eric Huss 10a6da6298 Add thorough tests for target/profile selection. 2018-04-27 13:42:30 -07:00
Eric Huss 9ca36de444 Move profile override tests to a dedicated file. 2018-04-27 13:42:30 -07:00
Eric Huss ec7be849e3 Some test cleanup for profiles. 2018-04-27 13:42:30 -07:00
Eric Huss c667fc231d Add more profile override validation tests. 2018-04-27 13:42:30 -07:00
Eric Huss ba537d73b9 Add test for profile override on non-dev/release. 2018-04-27 13:42:30 -07:00
Eric Huss 36b8769025 Add warning if panic is set in test or bench profile. 2018-04-27 13:42:30 -07:00
Eric Huss a0a880c36e Add warnings for unknown profile overrides. 2018-04-27 13:42:30 -07:00
Eric Huss 7dc9e071c7 Minor tweaks on how examples are handled with tests, and some panic propagation. 2018-04-27 13:42:30 -07:00
Eric Huss 7051b630c8 Update for some review comments. 2018-04-27 13:42:29 -07:00
Eric Huss 62d6f0d023 Minor cleanup. 2018-04-27 13:22:01 -07:00
Eric Huss 575d6e819c Profile Overrides (RFC #2282 Part 1) 2018-04-27 13:22:00 -07:00
Alex Crichton ce5bbbc7d6 Fix renaming crates as they come from 2 sources
Previously there was a verification in manifest parsing that the same dependency
must come from the same source, but this erroneously triggered an error to get
emitted when the `package` key was used to rename crates. The first change here
was to update that clause to key off the `rename` field rather than the `name`
field.

Afterwards, though, this exposed an existing bug in the implementation. During
compilation we have a `Resolve` which is a graph of crates, but we don't know
*why* each edge in the dependency graph exists. In other words we don't know,
when looking at an edge of the graph, what `Dependency` caused that edge to be
drawn. We need to know this when passing `--extern` flags because the
`Dependency` is what lists what's being renamed.

This commit then primarily refactors `Resolve::deps` from an iterator of package
ids to an iterator of a tuples. The first element is the package id from before
and the second element is a list of `Dependency` directives which caused the
edge to ber driven.

This refactoring cleaned up a few places in the backend where we had to work
around the lack of this knowledge. Namely this also fixes the extra test added
here.

Closes #5413
2018-04-27 10:48:34 -07:00
bors d998906598 Auto merge of #5349 - bmwill:fetch-by-target, r=alexcrichton
cargo-fetch: add option to fetch for a target

Teach cargo-fetch how to optionally fetch dependencies based on a target
platform by specifying the target triple via `--target <TRIPLE>`.

#5216
2018-04-27 15:36:16 +00:00
bors 9eece36013 Auto merge of #5410 - klnusbaum:edition_5406, r=matklad
switch to using the --edition flag

Now that we have an `--edition` flag in the rust compiler, let's switch to using it.

fixes #5406
2018-04-27 15:14:03 +00:00
Brandon Williams 1956c5d8ba cargo-fetch: add option to fetch for a target
Teach cargo-fetch how to optionally fetch dependencies based on a target
platform by specifying the target triple via `--target <TRIPLE>`.

Signed-off-by: Brandon Williams <bmwill@google.com>
2018-04-26 10:07:01 -07:00
bors 9092298d44 Auto merge of #5394 - henriklaxhuber:master, r=alexcrichton
Pass linker path to build script

This change adds the environment variable LINKER to pass the path of the linker used by cargo to the build script. This complements the variable RUSTC (the rustc binary used) to give the build script full knowledge of its environment.

A specific usage example would be automatically generating bindings to system headers in cross compilation, e.g. by locating jni.h for android targets.
2018-04-24 14:36:52 +00:00
Simon Smith 0b530c3086 Add target directory parameter: address suggestions 2018-04-24 02:52:41 -04:00
Henrik Laxhuber 3ebdc722c6
Moved RUSTC_LINKER test into its own fn 2018-04-24 08:18:33 +02:00
Simon Smith dd0b7a2cda Add target directory parameter --target-dir 2018-04-23 18:23:48 -04:00
Henrik Laxhuber 4628011e79
Fixed RUSTC_LINKER test for Windows hosts 2018-04-23 18:28:38 +02:00
Henrik Laxhuber 1469523348
Fixed build script env var test 2018-04-23 17:45:17 +02:00
Henrik Laxhuber 1d36411cc4
Added tests for RUSTC_LINKER buils script env var
Added tests for the environment variable RUSTC_LINKER that is
passed to the build script.
Also slightly improved readability of the code responsible for
passing the env var.
2018-04-23 17:11:10 +02:00
Kurtis Nusbaum 0b2aaaffe9 switch to using the --edition flag 2018-04-22 12:14:21 -07:00
Aleksey Kladov 14067b952e Remove some is_nightly checks from tests 2018-04-22 18:08:31 +03:00
Dale Wijnand ab5ac28a42
backtick auto-discovery key usage advice 2018-04-20 22:23:08 +01:00
Dale Wijnand d3f5fefa5c
manually line wrap warnings at 80 characters 2018-04-20 22:22:41 +01:00
Dale Wijnand 54e7bc51a2
prefer PathBuf::display over {:?} 2018-04-20 22:21:33 +01:00
Dale Wijnand abbd69e747
avoid windows path assertion bug 2018-04-20 22:20:31 +01:00
Dale Wijnand e471745e47
Introduce autoXXX keys for target auto-discovery
In Rust 2015 absence of the configuration makes it default to not
include auto-discovered targets (i.e false), with a warnings message.

In Rust 2018 absence makes it default to include auto-discovered
targets (i.e true).

Fixes #5330
2018-04-20 20:57:24 +01:00
Dale Wijnand 6828380e56
Move edition earlier in TomlManifest::to_real_manifest
and fix a typo in the error message
2018-04-20 19:45:59 +01:00
bors db90cfeaab Auto merge of #5391 - varkor:check-message, r=alexcrichton
Print "Checking" for cargo check

I often alternate between `check` and `build` and I'd like to be able to tell which is currently happening (short-term memory being what it is, and "compiling" implying to me that codegen is occurring). Changing the message to "Checking" seemed to be reasonable (and there was precedent for `doc` with "Documenting").
2018-04-19 22:21:08 +00:00
varkor 97b971a775 Update tests to check for Checking 2018-04-19 19:19:11 +01:00
bors 0a33eb2a75 Auto merge of #5390 - matklad:new-feature-behavior, r=alexcrichton
Enable new behavior of `--feature`

So far, the feedback on https://internals.rust-lang.org/t/help-us-test-the-breaking-bug-fix-to-cargo-features/7317 has been positive, so here's a PR to try this in nightly.

Note that the logic is slightly tweak for the case `cargo build -p not-a-workspace-member`: we want not only to resolve all ws members in this case, but to enable all of their features as well!

As a sanity check, this seems to be forward compatible with further improvements to features:

1) when we solve the grand bug of features being unified across the whole workspace, `cargo build -p not-a-member` would hopefully just work without additional contortions.
2) we might add a way to specify features per package, like `cargo build -p foo -p bar --features "foo/serde bar/serde"`
2018-04-19 14:30:48 +00:00
bors a04e2e5bd9 Auto merge of #5392 - ehuss:test-does-not-contain, r=alexcrichton
cargotest: Fix `with_*_does_not_contain` to support `[..]` and macro matching.

I changed it so that it is essentially the opposite of `with_*_contains` to keep it symmetric.

Any in-flight PRs using the old style will need to be updated (else they will incorrectly silently pass).  Alternatively, we could rename the method to avoid that.

The following tests contained brackets, so they were not checking what they thought they were checking.  I did a cursory look at them, but perhaps someone else could double-check that they make sense.  Asserting what *doesn't* happen can be tricky since there is an infinite number of things that won't happen.  Preferably a test would assert that it appears in one scenario and not another (like `incremental_profile` does), but some of them don't or can't.

```
build::incremental_profile
build::incremental_config
build::cargo_compile_with_workspace_excluded
build::build_all_exclude
build::targets_selected_default
check::targets_selected_default
check::check_filters
rustc::targets_selected_default
rustc_info_cache::rustc_info_cache
warn_on_failure::no_warning_on_bin_failure
warn_on_failure::warning_on_lib_failure
```

BTW, would you be interested in a PR that adds some documentation to `cargotest`?
I've discovered things I didn't know where there.  I think some docstrings on some of the methods, and a short guide for new contributors would be helpful.
2018-04-19 14:08:29 +00:00
Eric Huss e7896a2f68 Fix with_*_does_not_contain to support [..] and macro matching. 2018-04-18 22:13:30 -07:00
Aleksey Kladov 038eec5cb3 Enable new behavior of --feature 2018-04-19 00:34:45 +03:00
Aleksey Kladov f7fa1f2ac5 Don't try to use the same info if target == host
The info might be different due to RUSTFLAGS, which, in general,
are applied only to target.
2018-04-18 18:00:21 +03:00
Aleksey Kladov 1be3579396 Improve rustc cache
Even if we've failed to calculate fingerprint and thus can't persist
cache to disk, it is still valid to cache rustc output within single
process.
2018-04-18 17:44:23 +03:00
Yusuf Simonson d4162ed115 Explicitly test for new package metadata fields 2018-04-18 15:16:50 +07:00
Yusuf Simonson d1cacfedf3 Added new metadata fields.
`cargo metadata` should now include all of the non-optional suggested fields in the API guidelines (see section C-METADATA.)
2018-04-18 15:08:18 +07:00
Alex Crichton 039ca019d7 Bump version of filetime dependency 2018-04-17 15:08:04 -07:00
bors 30bf81b575 Auto merge of #5361 - derekdreery:issue_5345, r=matklad
Fix issue 5345

Fixes #5345.

Also adds some docs and Debug impls.
2018-04-17 13:39:04 +00:00
bors d0829a2e47 Auto merge of #5359 - matklad:rustc-cache, r=alexcrichton
Rustc cache

This implements rustc caching, to speed-up no-op builds.

The cache is per-project, and stored in `target` directory. To implement this, I had to move `rustc` from `Config` down to `BuildConfig`.

closes https://github.com/rust-lang/cargo/issues/5315
2018-04-16 17:23:53 +00:00
Aleksey Kladov 501823b0bb Handle non-rustup cargo + rustup rustc in rustc cache 2018-04-16 18:51:31 +03:00
Richard Dodd 066f9a02c9 Better test description 2018-04-15 14:00:36 +01:00
Richard Dodd 466196959f [Wip] fix issue 5345 2018-04-15 13:56:22 +01:00
Andy Russell 2efeeda17b
include package metadata in cargo metadata
Fixes #4819.
2018-04-14 15:07:23 -04:00
Aleksey Kladov c473479ab0 Add env-var to suppress rustc caching 2018-04-14 14:09:23 +03:00