238 Commits

Author SHA1 Message Date
Aleksey Kladov
ecd1e5df0f Tweak error messages
By convention, all errors should start with a lowercase letter
2018-05-03 18:31:23 +03:00
Aleksey Kladov
d49910fd21 Make alias handling more straightforward
Previously, `execute_subcommand` was called recursively, and each call
would `.configure` the `config` again. It worked, but seemed rather
fragile.

This commit handles aliases more explicitly, ensures that `.configure`
is called once and, as a bonus, adds a warning for when an alias is
shadowed by the built in.
2018-05-03 18:29:51 +03:00
bors
4dc5db2db5 Auto merge of #5464 - ehuss:restore-example-test, r=alexcrichton
Partially revert change to testing examples.

Fixes #5437

I don't think changing the behavior was quite the correct thing to do.  This new behavior is very similar to the old with a few small differences:

```
cargo test
    ORGINAL: Only builds examples.
    NEW: Builds all examples.  Any example with `test` set is tested.

cargo test --tests
    ORIGINAL: Runs all examples as tests.
    NEW: Only runs examples as tests if `test` is set.

cargo test --examples
    ORIGINAL: Runs all examples as tests.
    NEW: (SAME)

cargo test --example foo
    ORIGINAL: Runs the given example as a test.
    NEW: (SAME)

cargo test --all-targets
    ORIGINAL: Runs all examples as tests.
    NEW: (SAME)
```
2018-05-03 13:43:38 +00:00
Aleksey Kladov
f1dabb7ec9 Fix the test 2018-05-03 13:22:03 +03:00
Eric Huss
dffc5baeb2 Partially revert change to testing examples.
Fixes #5437

I don't think changing the behavior was quite the correct thing to do.  This new behavior is very similar to the old with a few small differences:

```
cargo test
    ORGINAL: Only builds examples.
    NEW: Builds all examples.  Any example with `test` set is tested.

cargo test --tests
    ORIGINAL: Runs all examples as tests.
    NEW: Only runs examples as tests if `test` is set.

cargo test --examples
    ORIGINAL: Runs all examples as tests.
    NEW: (SAME)

cargo test --example foo
    ORIGINAL: Runs the given example as a test.
    NEW: (SAME)

cargo test --all-targets
    ORIGINAL: Runs all examples as tests.
    NEW: (SAME)
```
2018-05-02 20:17:53 -07:00
Aleksey Kladov
658343aa10 Don't install pre-releases by default 2018-05-03 01:32:06 +03:00
bors
420f9ec576 Auto merge of #5456 - LukasKalbertodt:patch-1, r=matklad
Show elapsed time in minutes if >= 60 secs

In large projects with long compile times, seeing "428.65 secs" isn't as clear to humans as seeing the number of minutes (and seconds).

**Old**:
```
Finished dev [unoptimized + debuginfo] target(s) in 2.23 secs
Finished dev [unoptimized + debuginfo] target(s) in 63.94 secs
Finished dev [unoptimized + debuginfo] target(s) in 428.65 secs
```

**New**:
```
Finished dev [unoptimized + debuginfo] target(s) in 2.23s
Finished dev [unoptimized + debuginfo] target(s) in 1m 3.94s
Finished dev [unoptimized + debuginfo] target(s) in 7m 8.65s
```

Note that I also changed `secs` to `s`, because `7 mins 8.65 secs` and `7m 8.65 secs` both look strange IMO. But if you disagree and you'd prefer `secs`, just tell me and I'll change it.

I *didn't* add a check for `secs >= 3600` to print the time in hours. I *hope* this is not necessary...
2018-05-02 17:17:27 +00:00
bors
31b38fe7e0 Auto merge of #5458 - alexcrichton:track-panic, r=matklad
Track panic mode in fingerprint

Ensure that if we've previously compiled a crate with panic=abort and we later
need it for panic=unwind we correctly recompile it.

Closes #5445
2018-05-02 16:35:38 +00:00
Lukas Kalbertodt
357281374d Adjust tests to new time output format 2018-05-02 18:34:59 +02:00
bors
1b26ece291 Auto merge of #5454 - alexcrichton:fix, r=matklad
Fix optional dependencies and required dev-deps

This fixes an accidental bug introduced in #5300 by ensuring a local map keeps
track of the fact that there can be multiple dependencies for one name

Closes #5453
2018-05-02 15:35:33 +00:00
bors
2eebc86056 Auto merge of #5446 - csmoe:new_name, r=alexcrichton
Emit correct project name with --name

Fixes #5440
2018-05-02 14:40:15 +00:00
Alex Crichton
7f44648616 Track panic mode in fingerprint
Ensure that if we've previously compiled a crate with panic=abort and we later
need it for panic=unwind we correctly recompile it.

Closes #5445
2018-05-02 07:34:19 -07:00
Alex Crichton
02b0dba36b Fix optional dependencies and required dev-deps
This fixes an accidental bug introduced in #5300 by ensuring a local map keeps
track of the fact that there can be multiple dependencies for one name

Closes #5453
2018-05-01 17:03:23 -07:00
DarkDrek
2ea2fafca9 Add cargo clean --doc 2018-05-01 17:38:22 +02:00
bors
181de52b2e Auto merge of #5447 - ehuss:ws-error-message, r=alexcrichton
Better error message for `cargo rustc` in a workspace.

Fixes #5371
2018-05-01 13:50:13 +00:00
bors
f2abbe8b54 Auto merge of #5448 - ehuss:debug_env, r=alexcrichton
Fix "DEBUG" env var in build.rs for debug=0

Fixes #5370
2018-05-01 03:49:32 +00:00
Eric Huss
037a879dbd Better error message for cargo rustc in a workspace.
Fixes #5371
2018-04-30 20:39:07 -07:00
csmoe
1edfd9b190 add test for project name 2018-05-01 09:39:22 +08:00
bors
4963d884a4 Auto merge of #5300 - djc:namespaced-features, r=alexcrichton
Introduction of namespaced features (see #1286)

I think this basically covers all of the plans from #1286, although it still needs a bunch of tests and documentation updates. Submitting this PR to get some early feedback on the direction.
2018-04-30 17:52:35 +00:00
Eric Huss
83b8c234a1 Fix "DEBUG" env var in build.rs for debug=0.
Fixes #5370
2018-04-30 10:17:43 -07:00
Dirkjan Ochtman
0b6f420670 Put namespaced features behind a feature gate 2018-04-30 17:33:36 +02:00
bors
122fd5be52 Auto merge of #5430 - matklad:bring-old-features-back, r=alexcrichton
Revert "Enable new behavior of `--feature`"

This reverts commit 038eec5cb3bd25a0855b0be6ad2aeba5391c6c6e.

As discussed at https://github.com/rust-lang/cargo/issues/5364, the new behavior unfortunately causes real-life breakage, so we have to revert it.

This is kinda sad, this is a part of the larger issue with feature selection, which, at the moment, has a behavior which I would classify (loosely speaking) as unsound:

* `cargo build -p foo` and `cargo build -p foo -p bar` might produce different artifacts for `foo` ([repro](https://github.com/matklad/workspace-vs-feaures))
* `cargo build -p foo` might produce different artifacts, depending on cwd ([repro](https://github.com/matklad/features-cwd))

The new feature behavior specifically addressed the second point.

It is unclear what we could do with this... One option, instead of flatly erroring out, as the revreted commit does, is to print a warning, but change the set of activated features. It will still be a breaking change, but it at least has  a chance of working by accident.

r? @alexcrichton
2018-04-28 18:02:36 +00:00
bors
07d022dc70 Auto merge of #5425 - matklad:rename-fingerprint, r=alexcrichton
Package renames should affect fingerprints
2018-04-28 16:44:31 +00:00
Aleksey Kladov
30e52ca906 Extend dashes forwarding test 2018-04-28 17:57:03 +03:00
Aleksey Kladov
d369f97c19 Revert "Enable new behavior of --feature"
This reverts commit 038eec5cb3bd25a0855b0be6ad2aeba5391c6c6e.
2018-04-28 17:28:39 +03:00
Dirkjan Ochtman
dc5d023482 Add tests for namespaced features 2018-04-28 13:41:18 +02:00
Dirkjan Ochtman
a9f163e390 Keep track of namespaced-features flag in Summary objects
For now, all Summaries from a registry have it set to false.
2018-04-28 13:41:18 +02:00
Aleksey Kladov
fc72bcb449 Mix package renames into fingerprints 2018-04-28 13:38:16 +03:00
Eric Huss
195520b853 Avoid building libs and bins twice in cargo build --all-targets --release.
This changes it so that `Build` mode is not set in the Unit, since there is
no difference between Bench and Test once the profile has been selected.
2018-04-27 13:42:30 -07:00
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