Commit graph

2011 commits

Author SHA1 Message Date
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
Aleksey Kladov 6b1dc52b86 Speedup no-op builds by caching rustc invocations 2018-04-14 13:39:59 +03:00
Dirkjan Ochtman 90954d700c Correct formatting with cargo fmt 2018-04-13 19:59:55 +02:00
Aleksey Kladov 8d0b31b975 New semantics for --features flag
Historically, feature-related flags like `--all-features`,
`--no-default-features` and `--features` operated on the *current*
package. That is, `cargo --package foo --feature feat` would activate
`feat` for the package at the current working directory, and not for the
`foo` package. `-Z package-features` flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:

* `--feature` flag affects the selected package. It is an error to
  specify `--feature` with more than a single `-p`, or with `-p` outside
  workspace (the latter could work in theory, but would be hard to
  implement).

* `--all-features` and `--no-default-features` affect all selected
  packages, and not the one at cwd.

* The package in `cwd` is not implicitly enabled when doing feature
  selection. That is, `cargo build -Z package-features -p foo` could
  select *less* features for various packages than `cargo build -p foo`.
2018-04-13 17:36:09 +03:00
Dirkjan Ochtman 5c241e1027 Correct formatting with cargo fmt 2018-04-11 23:16:17 +02:00
Dale Wijnand d8f78286f1
more cargo install usage adaptations in the same tests 2018-04-10 16:34:47 +01:00
Dale Wijnand 6df5210253
adapt legitimate cargo install usage to avoid the new warning/error 2018-04-10 16:05:18 +01:00
Dale Wijnand 3ba58ae987
add the inverse is_not has_installed_exe assertion 2018-04-10 15:13:26 +01:00
Dale Wijnand e201a8949c
warn in 2015, error in 2018 2018-04-10 15:10:38 +01:00
Dale Wijnand 6086f26f91
enable cargo edition feature & bump to 2018 2018-04-10 06:44:59 +01:00
Dale Wijnand 4676820fea
Warn about cargo installing the cwd in 2018 edition
Fixes #5327
2018-04-10 01:37:12 +01:00
Aleksey Kladov 53f8501286 Properly use unstable options for out-dir 2018-04-08 14:47:35 +03:00
Alex Crichton c7a11056e2 Fix another issue of poisoning too eagerly
This commit extends the fix in #5288 by moving the logic added farther up in the
loop over package dependencies. This means that we won't recursively look at
optional/dev path dependencies which aren't members of the workspace. This
should fix the new issue that came up in #5257

Closes #5257
2018-04-06 12:37:29 -07:00
bors b9aa315158 Auto merge of #5299 - ehuss:rustdoc-edition, r=matklad
Pass edition to rustdoc.

Fixes #5279.
2018-04-05 15:26:56 +00:00
Eric Huss 187bb0ad9a Don't use .arg() in test. 2018-04-05 06:04:45 -07:00
Eric Huss bbb2b92ef8 Pass edition to rustdoc.
Fixes #5279.
2018-04-05 05:39:50 -07:00
bors 75ec2d3a8d Auto merge of #5280 - klausi:clippy-191-trvials, r=matklad
chore(clippy): Simplify minor stuff found by clippy

Executed clippy 0.0.191, fixed the trivial stuff.
Filed https://github.com/rust-lang-nursery/rust-clippy/issues/2615 for all the format_err!() false positives.
2018-04-05 09:22:15 +00:00
memoryleak47 57a7e12679 fixed a few typos 2018-04-05 03:45:15 +02:00
Klaus Purer 51d19d01c3 chore(clippy): Fix test assertion and simplify code in crates-io 2018-04-04 23:09:59 +02:00
Dirkjan Ochtman 540bd4585f Revert serialization of features to string type 2018-04-04 20:07:57 +02:00
Dirkjan Ochtman 7b542268f5 Introduce FeatureValue enum for tracking feature types 2018-04-04 18:03:40 +02:00
bors 1d7a0bb5eb Auto merge of #5288 - alexcrichton:another-fix, r=matklad
Less aggressively poison sources on builds

Discovered in #5257 the changes in #5215 were slightly too aggressively
poisoning sources to require updates, thinking that a manifest changed when it
actually hadn't.

Non-workspace-member path dependencies with optional/dev-dependencies
don't show up in the lock file, so the previous logic would recognize this and
think that the dependency missing from the lock file was just added and would
require a registry update.

The fix in this commit effectively just skips all of these dependencies in
non-workspace members. This means that this will be slightly buggy if an
optional dependency that's activated is added, but that's hopefully something we
can tackle later.

Closes #5257
2018-04-03 23:41:50 +00:00
Alex Crichton 0790db9888 Less aggressively poison sources on builds
Discovered in #5257 the changes in #5215 were slightly too aggressively
poisoning sources to require updates, thinking that a manifest changed when it
actually hadn't.

Non-workspace-member path dependencies with optional/dev-dependencies
don't show up in the lock file, so the previous logic would recognize this and
think that the dependency missing from the lock file was just added and would
require a registry update.

The fix in this commit effectively just skips all of these dependencies in
non-workspace members. This means that this will be slightly buggy if an
optional dependency that's activated is added, but that's hopefully something we
can tackle later.

Closes #5257
2018-04-03 14:35:02 -07:00
Aleksey Kladov c9191180e1 Fix tests for mac 2018-04-03 21:02:43 +03:00
Aleksey Kladov b7976d1e37 Test out-dir edge cases 2018-04-03 16:08:09 +03:00
Aleksey Kladov 028a7b6306 Feature gate --out-dir 2018-04-03 15:52:45 +03:00
Aleksey Kladov 5baac6b3b8 Implement --out-dir option 2018-04-03 15:52:21 +03:00
Kurtis Nusbaum 3bbe93cef6 rename epoch to edition 2018-04-01 11:01:28 -07:00
bors 59e6b6ca24 Auto merge of #5269 - orestisf1993:issue-5265, r=matklad
cargo_new: remove redundant leading new lines from ignore files

Only add a leading new line in `.gitignore`/`.hgignore`/`.ignore` files when
the file existed before `cargo new`.

Fixes #5265.
2018-03-31 14:51:14 +00:00
Orestis Floros dbb1abd814
cargo_new: remove redundant leading new lines from ignore files
Only add a leading new line in .gitignore/.hgignore/.ignore files when
the file existed before 'cargo new'.

Fixes #5265.
2018-03-31 17:40:44 +03:00
Klaus Purer 9af095adab tests(help): Fix assertion by using the full line text 2018-03-31 11:33:14 +02:00
Klaus Purer a4104914ea tests(help): Add test for -Z help output 2018-03-31 11:19:28 +02:00
Aleksey Kladov 31e6c96848 Restore --features args for cargo rustdoc
It was accidentally omited when migrating to clap
2018-03-28 13:45:20 +03:00
bors d079a10b79 Auto merge of #5205 - gibix:i2773, r=alexcrichton
fix #2773 with new precise encode

Changed the precise encode from <pkg>=<precise> to <pkg>=<present_version>-><future_version> in order to check the correct requirements.

cc @lu-zero
2018-03-27 12:19:45 +00:00
bors 715fc78caa Auto merge of #5228 - phil-opp:target-spec, r=alexcrichton
Add support for absolute target.json paths

Builds upon https://github.com/rust-lang/rust/pull/49019 with the goal to provide a solution to https://github.com/rust-lang/cargo/issues/4905.

This PR does two things:

~~1. It appends a hash of the target path to the target folder name if a `*.json` path is passed as `--target`, like it's done in https://github.com/rust-lang/rust/pull/49019. This helps differentiating targets with the same JSON file name and avoids sysroot clashes in `xargo`.~~ See https://github.com/rust-lang/cargo/pull/5228#discussion_r176827531
2. It canonicalizes the passed target path (if it's a `*.json` path), so that the path stays valid when building dependencies and setting the `RUST_TARGET_PATH` environment variable is no longer necessary.
2018-03-26 13:00:26 +00:00