Commit graph

6571 commits

Author SHA1 Message Date
Dale Wijnand 85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand b5ee3635ef
Wrap ProcessBuilder in Execs & make .cargo return that 2018-08-28 09:24:37 +01:00
Dale Wijnand 76e840bb45
Make old Execs methods take not consume self 2018-08-28 09:15:25 +01:00
Dale Wijnand e8841eeceb
Extract Execs::match_process 2018-08-28 09:15:25 +01:00
Dale Wijnand dd0400ec75
Add #[must_use] to Execs 2018-08-28 09:15:25 +01:00
Dale Wijnand e9bfe8fa04
Inline Execs::_with_stderr 2018-08-28 08:28:09 +01:00
Dale Wijnand 035b5b9d5a
Remove an unrun "cargo build" ProcessBuilder 2018-08-28 08:27:59 +01:00
bors dd3b70d635 Auto merge of #5939 - ehuss:test-package-docs, r=alexcrichton
Add documentation for creating test dependencies.

Using `Package` has always been a little unclear to me. I think I understand
it now. Maybe this will help.
2018-08-25 04:23:02 +00:00
Eric Huss d970d05f06 Add documentation for creating test dependencies.
Using `Package` has always been a little unclear to me. I think I understand
it now. Maybe this will help.
2018-08-24 15:09:38 -07:00
bors 676d866fee Auto merge of #5935 - alexcrichton:vendor-paths, r=ehuss
Only use non-absolute paths for `path` dependencies

Previously Cargo would use a non-absolute path for any dependency contained
within the workspace root but this switches Cargo to only using relative paths
for `path` dependencies. In practice this shouldn't make much difference, but
for vendored crates and moving around `CARGO_HOME` it can produce more
consistent results when target directories are shared.

Closes #5923
2018-08-24 19:37:00 +00:00
Alex Crichton 6e57be5160 Only use non-absolute paths for path dependencies
Previously Cargo would use a non-absolute path for any dependency contained
within the workspace root but this switches Cargo to only using relative paths
for `path` dependencies. In practice this shouldn't make much difference, but
for vendored crates and moving around `CARGO_HOME` it can produce more
consistent results when target directories are shared.

Closes #5923
2018-08-24 11:02:13 -07:00
bors 90fc9f6201 Auto merge of #5628 - ehuss:metabuild, r=alexcrichton
Metabuild (RFC 2196)
2018-08-24 17:14:10 +00:00
bors 3ce6527641 Auto merge of #5937 - ehuss:fix-codemap, r=alexcrichton
Fix test failure on nightly due to `codemap::Span` change.

Update due to rust-lang/rust#52953.
2018-08-24 07:13:41 +00:00
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
Eric Huss ecc87b1795 New metabuild strategy using custom src_path enum.
- Use new enum `TargertSourcePath` for Target::src_path to make it explicit that metabuild has a special path.
- `cargo metadata` now skips the metabuild Target.
- JSON artifacts include the true path to the metabuild source file. This may not be the best solution, but it's unclear what it should be, and I would prefer to avoid breaking the output. Alternatively it could just not emit anything? I'm not completely familiar with the use case of these artifact messages.
- Place the file in `target/.metabuild/metabuild-pkgname-HASH.rs` instead of in the debug/release directory.  Its contents do not depend on the profile.
- Fix bug in write_if_changed.
- More tests.
2018-08-23 23:01:30 -07:00
Eric Huss e685bbfe52 Remove unnecessary change. 2018-08-23 13:31:50 -07:00
Eric Huss ae5e84518d Address review comments.
- Add newline at end of file.
- Remove unnecessary rustfmt changes.
- Move file writing code to `write_if_changed`.
2018-08-23 13:31:50 -07:00
Eric Huss 2be857af59 Metabuild (RFC 2196) 2018-08-23 13:31: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
Ralf Jung b1fbafd066 update comment based on further research 2018-08-22 20:55:14 +02:00
bors 1ee1ef0ea7 Auto merge of #5926 - alexcrichton:more-errors, r=dwijnand
List URL in HTTP download failures

Hopefully will help diagnose issues like #5924
2018-08-22 18:02:19 +00:00
bors 3bc526052a Auto merge of #5925 - dwijnand:improve-install-cwd-deprecation, r=alexcrichton
Improve the `cargo install` deprecation messaging

Fixes #5917

r? @matklad
/cc @brson also as I'd love to hear your feedback too.
2018-08-22 16:26:40 +00:00
Alex Crichton 4e62fc84b5 List URL in HTTP download failures
Hopefully will help diagnose issues like #5924
2018-08-22 09:18:58 -07:00
Dale Wijnand 3e6de57ae3
Fix compilation error
Apparently the bail! macro doesn't support trailing commas :-/
2018-08-22 10:05:35 +01:00
Dale Wijnand fc93b0f941
Improve the cargo install deprecation messaging 2018-08-22 09:46:50 +01:00
bors c0ec76f336 Auto merge of #5902 - little-arhat:feature-add-required-features-to-metadata-output, r=alexcrichton
Add `required-features` to `SerializedTarget`

This will add it to `cargo metadata` output and will make it
possible to enable features needed to build specific target.
2018-08-21 20:51:26 +00: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
Ralf Jung b7ecbaf224 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!
2018-08-21 16:15:35 +02: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
Roma Sokolov 9c38505ab7 Serialize required_dependencies as 'require-dependencies' 2018-08-20 20:54:45 +02:00
bors 677ef847a5 Auto merge of #5912 - rust-lang:dependabot/cargo/opener-0.3.0, r=alexcrichton
Update opener requirement from 0.2.0 to 0.3.0

Updates the requirements on [opener](https://github.com/Seeker14491/opener) to permit the latest version.
<details>
<summary>Changelog</summary>

*Sourced from [opener's changelog](https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md).*

> ## [0.3.0] - 2018-08-18
> ### Added
> - `stderr` field to `OpenError::ExitStatus` variant, which captures anything the failed process wrote to stderr.
>
> ## [0.2.0] - 2018-08-08
> ### Removed
> - The `open_sys` function, which was erroneously pub on non-Windows builds.
>
> ## [0.1.0] - 2018-08-08
> - Initial release.
</details>
<details>
<summary>Commits</summary>

- See full diff in [compare view](https://github.com/Seeker14491/opener/commits/v0.3.0)
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
2018-08-20 17:34:45 +00:00
dependabot[bot] e36ae43400
Update opener requirement from 0.2.0 to 0.3.0
Updates the requirements on [opener](https://github.com/Seeker14491/opener) to permit the latest version.
- [Release notes](https://github.com/Seeker14491/opener/releases)
- [Changelog](https://github.com/Seeker14491/opener/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Seeker14491/opener/commits/v0.3.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-08-20 05:27:11 +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
bors a06570c2d1 Auto merge of #5907 - dwijnand:collapse-test-cmd-args, r=matklad
Collapse ProcessBuilder::arg calls in tests

Refs #5742
More of #5854
2018-08-19 15:26:34 +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
Roma Sokolov 349d264a56 Add required-features to SerializedTarget
This will add it to `cargo metadata` output and will make it
possible to enable features needed to build specific target.
2018-08-18 00:40:06 +02:00
bors 8b6f71028f Auto merge of #5901 - dwijnand:1.28-win, r=alexcrichton
Align AppVeyor to use 1.28 for minimal versions

.. like Travis CI's setup.
2018-08-17 15:25:34 +00:00
Dale Wijnand 0ec44d949c
Align AppVeyor to use 1.28 for minimal versions
.. like Travis CI's setup.
2018-08-17 12:05:30 +01:00