Commit graph

2323 commits

Author SHA1 Message Date
Eric Huss 91a33a0e84 Fix test failure on nightly due to codemap::Span change.
Update due to rust-lang/rust#52953.
2018-08-23 23:56:50 -07:00
bors 8537ab9131 Auto merge of #5927 - dwijnand:uninstall-cwd, r=ehuss
Make "cargo uninstall" uninstall the cwd bins

Fixes #5916

Tested with a local build of cargo, using coreutils:

    17:33:57 $ dcargo uninstall
    Removing /Users/dnw/.cargo/bin/uutils
2018-08-23 16:25:14 +00:00
Dale Wijnand d87951aa73
Handle Window's missing file error message 2018-08-23 15:05:49 +01:00
Dale Wijnand 8921abd791
Make "cargo uninstall" uninstall the cwd bins 2018-08-23 10:57:36 +01:00
bors 502f0ae72b Auto merge of #5919 - RalfJung:mtime, r=alexcrichton
fix cargo not doing anything when the input and output mtimes are equal

That's a problem as the input may have changed in that same second but after the output got generated!

Fixes https://github.com/rust-lang/cargo/issues/5918
2018-08-22 20:39:04 +00:00
Dale Wijnand fc93b0f941
Improve the cargo install deprecation messaging 2018-08-22 09:46:50 +01:00
bors 7ff1bdbcc3 Auto merge of #5914 - alexcrichton:system-git, r=dwijnand
Add a configuration option to fetch with git-the-CLI

Currently Cargo always uses `libgit2` to perform all fetches of git
repositories, but sometimes this is not sufficient. The `libgit2` library
doesn't support all authentication schemes that `git` does and it isn't always
quite at feature parity with `git` itself, especially in terms of network
configuration.

This commit adds a configuration option to Cargo for fetching git repositories
with the `git` CLI tool rather than the internal `libgit2`. While this exposes
us to changes over time in the `git` CLI it's hopefully a very targeted use case
that doesn't change much. The internal `libgit2` library should be sufficient
for all other forms of git repository management. (and using `git` for only
fetches shouldn't slow us down much)

The new configuration option in `.cargo/config` is:

    [net]
    git-fetch-with-cli = true

which can also be specified with `CARGO_NET_GIT_FETCH_WITH_CLI=true` via an
environment variable.

Closes #5903
2018-08-21 19:55:15 +00:00
Ralf Jung 08843a0457 attempt to fix test suite race on mac 2018-08-21 18:14:45 +02:00
Alex Crichton a0591eeac1 Add a configuration option to fetch with git-the-CLI
Currently Cargo always uses `libgit2` to perform all fetches of git
repositories, but sometimes this is not sufficient. The `libgit2` library
doesn't support all authentication schemes that `git` does and it isn't always
quite at feature parity with `git` itself, especially in terms of network
configuration.

This commit adds a configuration option to Cargo for fetching git repositories
with the `git` CLI tool rather than the internal `libgit2`. While this exposes
us to changes over time in the `git` CLI it's hopefully a very targeted use case
that doesn't change much. The internal `libgit2` library should be sufficient
for all other forms of git repository management. (and using `git` for only
fetches shouldn't slow us down much)

The new configuration option in `.cargo/config` is:

    [net]
    git-fetch-with-cli = true

which can also be specified with `CARGO_NET_GIT_FETCH_WITH_CLI=true` via an
environment variable.

Closes #5903
2018-08-21 09:09:20 -07:00
bors 0ec7281b9c Auto merge of #5886 - dekellum:record-package-git-head-3, r=alexcrichton
Generate .cargo_vcs_info.json and include in `cargo package` (take 2)

Implements #5629 and supersedes #5786, with the following improvements:

* With an upstream git2-rs fix (tracked #5823, validated and min version update in: #5858), no longer requires windows/unix split tests.

* Per review in #5786, drops file system output and locks for .cargo_vcs_info.json.

* Now uses serde `json!` macro for json production with appropriate escaping.

* Now includes a test of the output json format.

Possible followup:

* Per discussion in #5786, we could improve reliability of both the VCS dirty check and the git head sha1 recording by preferring (and/or warning otherwise) the local repository bytes of each source file, at the same head commit. This makes the process more appropriately like an atomic snapshot, with no sentry file or other locking required.  However given my lack of a window's license and dev setup, as exhibited by troubles of #5823, this feel intuitively like too much to attempt to change in one iteration here.  I accept the "best effort" concept of this feature as suggested in #5786, and think it acceptable progress if merged in this form.

@alexcrichton r?
@joshtriplett cc
2018-08-20 21:18:45 +00:00
bors cc88d01166 Auto merge of #5908 - orium:fix-package-cargo-toml, r=alexcrichton
Fix serialization bug in `edition` field of `TomlProject`.

Fixes #5906.
2018-08-19 17:40:22 +00:00
bors a78f5aaa84 Auto merge of #5904 - dwijnand:backslash, r=alexcrichton
Remove backslash management in 2 tool_paths tests

With #5851 this is no longer necessary
2018-08-19 16:18:59 +00:00
Dale Wijnand c882b4e02e
Fix 3 corner tests where whitespaces are important 2018-08-19 10:16:08 +01:00
Diogo Sousa 8590a5fba4 Fix serialization bug in edition field of TomlProject.
Fixes #5906.
2018-08-18 23:24:47 +01:00
Dale Wijnand 0152f26405
Move .env/.masquerade_as_nightly_cargo to collapse some more p.cargo calls 2018-08-18 21:34:09 +01:00
Dale Wijnand 511d4bc503
Collapse multiline ProcessBuilder::arg calls in tests
.. by calling this a bunch of times:

    fastmod --multiline '\.cargo\("([^"]+)"\).[ ]+\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/
2018-08-18 15:12:54 +01:00
Dale Wijnand af4f1392f7
Collapse ProcessBuilder::arg calls in tests
.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
2018-08-18 15:05:45 +01:00
Dale Wijnand 9d9883b26c
Single slash root on Windows 2018-08-18 12:20:00 +01:00
Dale Wijnand 4c9d42e0c7
Remove backslash management in 2 tool_paths tests 2018-08-18 10:19:39 +01:00
David Kellum ab7877205f Add test package::vcs_file_collision 2018-08-13 10:00:30 -07:00
David Kellum 6b9961a382 Add generated .cargo_vcs_info.json (git hash) file to cargo package 2018-08-13 10:00:30 -07:00
Dale Wijnand e0b9e43771
Collapse let bindings 2018-08-13 12:00:01 +01:00
Dale Wijnand 0c89a748d1
Resolve a drop_copy lint warning 2018-08-13 11:12:17 +01:00
Dale Wijnand 11922d099b
Resolve a identity_conversion lint warning 2018-08-13 11:11:50 +01:00
Dale Wijnand 972b312a08
Resolve a single_match lint warning 2018-08-13 11:11:04 +01:00
Dale Wijnand 3fdec5a2c6
Resolve a const_static_lifetime lint warning 2018-08-13 11:10:44 +01:00
Dale Wijnand c9b59deb3a
Resolve 4 unreadable_literal lint warnings 2018-08-13 11:10:03 +01:00
Dale Wijnand d0624dfcd7
Resolve 2 unneeded_field_pattern lint warnings 2018-08-13 11:09:25 +01:00
bors ae97799980 Auto merge of #5876 - matthiaskrgr:clippy_2, r=alexcrichton
fix a bunch of clippy warnings

 (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
2018-08-12 22:42:53 +00:00
Matthias Krüger 8798bf0d28 fix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
Special thanks to dwijnand for helping me with this! :)
2018-08-12 10:00:12 +02:00
Dale Wijnand 2c704d8841
Add a test for "cargo doc --message-format=short" 2018-08-10 08:49:15 +01:00
Dale Wijnand a14f7fe024
Add a test for "cargo check --message-format=short" 2018-08-10 08:22:39 +01:00
Dale Wijnand 28a84e02e5
Add support for rustc's --error-format short
Running a local build of this branch on some broken code shows this kind of output:

    18:42:29 $ dcargo check --message-format=short --tests
        Checking bufstream v0.1.3
        Checking cargo v0.30.0 (file:///d/cargo)
    tests/testsuite/config.rs:298:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:307:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:363:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:367:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:371:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:375:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:382:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:386:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:400:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:428:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:479:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:491:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:496:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:501:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:506:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:512:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:582:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:660:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:666:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:672:9: error[E0308]: mismatched types
    tests/testsuite/config.rs:678:9: error[E0308]: mismatched types
    error: aborting due to 21 previous errors
    error: Could not compile `cargo`.
    warning: build failed, waiting for other jobs to finish...
    error: build failed
2018-08-10 08:22:39 +01:00
bors 578e2533b8 Auto merge of #5878 - ehuss:rustdoc-json, r=alexcrichton
Support JSON with rustdoc.

This allows `cargo doc --message-format=json` to actually work.

Note that this explicitly does not attempt to support it for doctests for
several reasons:
- `rustdoc --test --error-format=json` does not work for some reason.
- Since the lib is usually compiled before running rustdoc, warnings/errors
  will be emitted correctly by rustc.
- I'm unaware of any errors/warnings `rustdoc --test` is capable of producing
  assuming the code passed `rustc`.
- The compilation of the tests themselves do not support JSON.
- libtest does not output json, so it's utility is limited.
2018-08-10 03:14:33 +00:00
Eric Huss c28823fa00 Update for review comments. 2018-08-09 15:43:34 -07:00
Eric Huss f3faa976fa Support JSON with rustdoc.
This allows `cargo doc --message-format=json` to actually work.

Note that this explicitly does not attempt to support it for doctests for
several reasons:
- `rustdoc --test --error-format=json` does not work for some reason.
- Since the lib is usually compiled before running rustdoc, warnings/errors
  will be emitted correctly by rustc.
- I'm unaware of any errors/warnings `rustdoc --test` is capable of producing
  assuming the code passed `rustc`.
- The compilation of the tests themselves do not support JSON.
- libtest does not output json, so it's utility is limited.
2018-08-08 23:59:07 -07:00
Eric Huss fa54a79433 Allow cargo run in workspaces. 2018-08-08 18:39:00 -07:00
bors ebaf2125d1 Auto merge of #5873 - ehuss:ws-filters, r=alexcrichton
Change target filters in workspaces.

This changes it so that filters like `--bin`, `--test`, `--example`,
`--bench`, `--lib` will work in a workspace.  Today, these filters
require that they match *every* package in a workspace which makes
them not very useful.  This change makes it so that they only must
match at least one package.

Closes #5819.
2018-08-07 22:57:38 +00:00
bors 0e7a46e327 Auto merge of #5858 - dekellum:git-check-logging-and-test, r=alexcrichton
Improve verbose console and log for finding git repo in package check

Third attempt to resolve #5823 by improving logging and tests. This exposes the issue to testing,  via verbose console output and is dependent on alexcrichton/git2-rs#341 as just released in git2 0.7.5 crate. Thus tests *should* now pass on all platforms, incl. windows, but I also intend to bump the minimal git2 release dependency (in a subsequently added commit).

cc: @Eh2406 thanks for your fix and help!
2018-08-07 22:19:54 +00:00
Eric Huss 771fec3cff Change target filters in workspaces.
This changes it so that filters like `--bin`, `--test`, `--example`,
`--bench`, `--lib` will work in a workspace.  Today, these filters
require that they match *every* package in a workspace which makes
them not very useful.  This change makes it so that they only must
match at least one package.
2018-08-07 13:05:22 -07:00
Aleksey Kladov 39b1f752f6 Add rename info to Cargo metadata
Previously, `cargo metadata` exposed dependencies info as a graph of
package id without any additional information on edges.

However, we do want to add some data to edges, including for example,
package renames and `cfg` info.

Internally, the edges info is represented as a `Vec<Dependnecy>`. We
could have exposed that directly, but that risks exposing and
ossifying an implementation details.

So instead we collapse a `Vec<Dependnecy>` to a single JSON object,
which at the moment contains `id` and `rename` info only. It should be
possible to add additional fields to that object backwards compatibly.
Such representation does not correspond directly to any internal Cargo
data structure, but hopefully it shouldn't be to hard to maintain.

This representation also does not quite correspond to the "real
world", where dependencies are between crate (cargo targets), and not
packages. However, because each dep edge is a JSON object, adding a
target filter should be possible, which would handle dev-, build-, and
potential future bin-specific dependencies backwards-compatibly.
2018-08-07 12:39:08 +03:00
Brandon Williams 4e13dc73cd fetch: skip target tests when cross_compile is disabled
Signed-off-by: Brandon Williams <bmwill@google.com>
2018-08-06 10:04:53 -07:00
bors b42488270e Auto merge of #5861 - alexcrichton:build-script-edition, r=ehuss
Fix the edition build scripts are compiled with

Previously build scripts were accidentally and unconditionally compiled with the
2015 edition, but they should instead use the edition of the `[package]` itself.

Closes #5860
2018-08-04 18:15:43 +00:00
Alex Crichton 152eca58d8 Fix the edition build scripts are compiled with
Previously build scripts were accidentally and unconditionally compiled with the
2015 edition, but they should instead use the edition of the `[package]` itself.

Closes #5860
2018-08-04 08:44:16 -07:00
bors 135ef53e09 Auto merge of #5852 - dwijnand:exit-code-0, r=alexcrichton
Default test support's Execs to exit code 0

Refs #5742
2018-08-03 15:42:54 +00:00
Dale Wijnand b1d6a7e11d
Drop niche Execs::with_no_expected_status
.. by gating the nightly-only tests.
2018-08-03 07:54:07 +01:00
Dale Wijnand 60828dba83
Fix tests that have no stable expected exit code 2018-08-03 07:45:21 +01:00
Dale Wijnand f53f2b0e94
Fix tests that have failing commands w/o specifying the exit code 2018-08-03 07:45:21 +01:00
Dale Wijnand 16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Marat Safin b686606362 check target env in test when use targets 2018-08-03 08:31:33 +03:00