Commit graph

9966 commits

Author SHA1 Message Date
Weihang Lo db313e54a2
test(rustc): glob support for package selection 2020-10-05 01:24:41 +08:00
Weihang Lo ab88c48480
test(tree): glob support for package selection 2020-10-05 01:24:41 +08:00
Weihang Lo 2361fb0f6a
feat: glob support for package selection 2020-10-05 01:24:41 +08:00
Weihang Lo 633e5f0048
test: glob support for target selection 2020-10-05 01:24:39 +08:00
Weihang Lo 42696ae234
feat: glob support for target selection 2020-10-04 23:22:54 +08:00
Weihang Lo be31989a43
test: minimal shell quote supoort for cargo-test-support 2020-10-04 22:55:50 +08:00
bors 1f6c6bd5e7 Auto merge of #8744 - roblabla:homepage-doc-cargo-metadata, r=alexcrichton
Homepage doc cargo metadata

Adds two new field to cargo-metadata: `homepage` and `documentation`, lifted directly from the Cargo.toml. This additionally makes those fields available through `cargo read-manifest`.
2020-10-02 14:53:21 +00:00
roblabla 26d1a25d93 Add homepage/documentation to cargo-metadata docs 2020-10-01 09:40:32 +00:00
roblabla 435117a821 Test that homepage/documentation values are properly propagated 2020-10-01 09:40:32 +00:00
roblabla 72694e8015 Fix tests 2020-10-01 09:40:32 +00:00
roblabla 58bc357f36 Add homepage and documentation to package in cargo metadata 2020-10-01 08:51:53 +00:00
bors 75615f8e69 Auto merge of #8741 - est31:makeflags, r=alexcrichton
Correct mistake about supporting sub-makes and document CARGO_MAKEFLAGS

Sub-makes are currently not supported as the jobserver crate only
sets CARGO_MAKEFLAGS which GNU Make doesn't understand.

This might be reasonable as cargo overriding existing MAKEFLAGS
variables would be weird, but also makes the statement in the
reference false.

It's helpful for build script authors who want to invoke make
to know how to get make subprocesses work with parallel builds.
2020-09-29 18:42:19 +00:00
bors 0863077615 Auto merge of #8742 - ehuss:proc-macro-test-feature, r=alexcrichton
Properly set for_host for proc-macro tests.

Proc-macro tests are currently forced to run for the host target (by [this line of code](898ccde7ac/src/cargo/ops/cargo_compile.rs (L819))). However, the code that builds the dependency graph wasn't playing by the same rules, and was building the proc-macro test as-if it was "not for_host".  This would cause the proc-macro test to pull in the wrong set of dependencies/features with the new feature resolver.

Forcing proc-macro tests to run on host isn't 100% required, since most targets have the proc_macro crate available. However, I feel like it simplifies things to build for-host. I was thinking we could relax that requirement, but I'm not really sure.  See also #4336 where there's an bug if you do specify `--target`.

Tested with the wasmtime repo running `cargo test -Zfeatures=all -p wiggle-macro` with `doctest = false` commented out of `crates/wiggle/macro/Cargo.toml`.

Fixes #8563.
2020-09-29 18:17:36 +00:00
Eric Huss 6fe6595c17 Properly set for_host for proc-macro tests. 2020-09-28 16:21:55 -07:00
est31 30e8cbf898 Correct mistake about supporting sub-makes and document CARGO_MAKEFLAGS
Sub-makes are currently not supported as the jobserver crate only
sets CARGO_MAKEFLAGS which GNU Make doesn't understand.

This might be reasonable as cargo overriding existing MAKEFLAGS
variables would be weird, but also makes the statement in the
reference false.

It's helpful for build script authors who want to invoke make
to know how to get make subprocesses work with parallel builds.
2020-09-28 23:14:37 +02:00
bors 898ccde7ac Auto merge of #8740 - nop:target-completion, r=ehuss
Add Zsh completion for target triples

Target triples are used for specifying targets for e.g. `cargo build --target thumbv7em-none-eabihf` where `thumbv7em-none-eabihf` is the target triplet.
For more information on target triples, see <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.
2020-09-28 14:52:35 +00:00
nop 7a9810f881 Add Zsh completion for target triples
Target triples are used for specifying targets for e.g. `cargo build
--target thumbv7em-none-eabihf` where `thumbv7em-none-eabihf` is the
target triplet.
For more information on target triples, see
<https://doc.rust-lang.org/cargo/appendix/glossary.html#target>.
2020-09-28 03:22:45 -05:00
bors 76c01613e3 Auto merge of #8735 - ehuss:git-object-not-found, r=alexcrichton
Reinitialize index on "Object not found" error.

Fixes #4007

Users have occasionally been reporting "Object not found" errors when updating the index. This PR changes cargo to detect this error, and delete the index and attempt one more time to update it.  Our best theory is that the git repo is getting corrupted or out-of-sync somehow.

**Other options**
We talked about having cargo generate a ZIP file of the corrupt repo and ask the user to upload it to the issue tracker, but I feel like that isn't going to be too useful (there will be an object missing in the repo, which is unlikely to tell us how to got lost).

We could also implement some tricks to make the fetch process more atomic (by renaming the git directory before starting the fetch), but I'm uncertain if the added complexity is justified.

Another option (which I personally like) is to use `net.git-fetch-with-cli` by default if `git` is found in `PATH`.  It is faster and more reliable and handles authentication better, and I suspect the vast majority of developer and CI systems have `git` installed.  This kinda sweeps the problems of libgit2 under the rug, and would mean a huge amount of code would no longer be exercised by most users, leaving the few without `git` to be more likely to suffer obscure bugs.

**Testing**
Note that I was unable to create a local test to reproduce this, but I was able to reproduce against GitHub.  I took my index repo and removed the most recent pack file, and then ran `cargo fetch`. This resulted in the exact same error users are reporting. I believe I cannot repro locally because the network update code is significantly different from the `file://` update code (there's all sorts of negotiation that happens over the protocol).  Unless anyone has ideas on how to repro this in an automated fashion, I'm out of ideas.

**Other corruption**
In testing, I noticed there are a few other ways the "Object not found" error can happen, but this does not address them. Both cases involved deleting pack files:

1. After deleting the oldest pack file in an index, running an update, the index fetch succeeds. But then, when the `RemoteRegistry` attempts to load the `config.json` file, it can't find it (it fails [here](05c611ae3c/src/cargo/sources/registry/remote.rs (L181))).

2. After deleting the newest pack file of a git dependency in the `db` directory, the fetch succeeds, but then the call to `reset` of the checkout fails (around [here](05c611ae3c/src/cargo/sources/git/utils.rs (L480))).

Fixing these I think will be require a bit of work, since retry loops will need to be added. I'm not too eager to do that since nobody has reported an error with either of these cases (the error stack is slightly different).
2020-09-27 17:44:27 +00:00
bors fe0b84464e Auto merge of #8739 - ehuss:normalize-raw-strings, r=alexcrichton
Normalize raw string indentation.

It has always slightly bugged me how strings were indented after rustfmt was run across the repo (#5176). This attempts to normalize the strings so that they open and close on the same column.  This only touches the `tests` directory.
2020-09-27 08:48:55 +00:00
bors fd0628b0ec Auto merge of #8738 - ehuss:rustup-links, r=alexcrichton
Update links to rustup docs.

The rustup docs have moved, so update some of the documentation links.
2020-09-27 08:23:38 +00:00
bors 1ffdfb70eb Auto merge of #8715 - ehuss:contrib, r=alexcrichton
Add contributor guide.

This consolidates and extends the contributor information in a single place. This is an mdbook project, along with a CI job which will build and deploy it to GitHub Pages at <https://rust-lang.github.io/cargo/contrib/>.

You can view a rendered version here: <https://ehuss.github.io/cargo/contrib/>

I don't know if this will actually be helpful to anyone, but I figured it's worth a shot.

NOTE: The CI deploy is designed to preserve the existing gh-pages content.  However, it will **delete the history** on that branch. I think that should be fine, there doesn't seem to be too much interesting stuff there.  I do have a backup in my fork, though. Some extra scrutiny on the code might be wise.  The reason it deletes the history is because deploying mdbook on every push would balloon the repository size.
2020-09-27 07:06:34 +00:00
bors 8835604333 Auto merge of #8737 - ehuss:doc-update-lockfile, r=alexcrichton
Fix minor error in `cargo update` docs.

`cargo update` does not require `Cargo.lock` to exist.

Also updated `generate-lockfile` to maybe be a little clearer (to me).
2020-09-27 06:39:39 +00:00
Eric Huss 6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss fac70ee775 Update links to rustup docs. 2020-09-26 10:09:04 -07:00
Eric Huss 7c9f45b372 Fix minor error in cargo update docs. 2020-09-26 09:59:43 -07:00
Eric Huss b698b254d6 Number the subcommand steps. 2020-09-26 09:13:04 -07:00
Eric Huss dffb804742 Add introduction to the architecture chapter. 2020-09-26 09:12:06 -07:00
Eric Huss 3bbb44c76a Reinitialize index on "Object not found" error. 2020-09-25 13:44:49 -07:00
bors 05c611ae3c Auto merge of #8712 - dtolnay:workspace, r=ehuss
--workspace flag for locate-project to find the workspace root

<pre>
<i>/git/serde/serde_derive</i>$ <b>cargo locate-project</b>
{"root":"<a href="https://github.com/serde-rs/serde/blob/master/serde_derive/Cargo.toml">/git/serde/serde_derive/Cargo.toml</a>"}

<i>/git/serde/serde_derive</i>$ <b>cargo locate-project --workspace</b>
{"root":"<a href="https://github.com/serde-rs/serde/blob/master/Cargo.toml">/git/serde/Cargo.toml</a>"}
</pre>
2020-09-23 23:10:38 +00:00
David Tolnay 17053fc980
--workspace flag for locate-project to find the workspace root 2020-09-23 18:39:21 -04:00
bors 4e6fa34179 Auto merge of #8727 - ehuss:badges, r=alexcrichton
Remove some badges documentation.

Badges have been removed from crates.io, so this updates the documentation. I don't think Cargo should manage a schema for the different services, and since crates.io isn't using these, I think it is mostly a dead feature. I left the `maintenance` field, because that might still have some meaning in the future.

More details:
* Removal from crates.io: https://github.com/rust-lang/crates.io/issues/2436 https://github.com/rust-lang/crates.io/pull/2440
* Solicited feedback for this change: https://internals.rust-lang.org/t/cargo-badges/12982
* Potential future support of `maintenance` status: https://github.com/rust-lang/crates.io/issues/2437 https://github.com/rust-lang/crates.io/issues/2438 https://github.com/rust-lang/crates.io/pull/2439. It's not clear, if crates.io manages the status in the database, the motivation for putting it in `Cargo.toml` is probably pretty small.
2020-09-23 22:32:22 +00:00
Eric Huss 60779a006f Remove some badges documentation. 2020-09-23 15:08:41 -07:00
bors a9d694770d Auto merge of #8707 - dtolnay:plain, r=ehuss
Add plain message format for locate-project

Supersedes #8683, as recommended in https://github.com/rust-lang/cargo/pull/8683#issuecomment-692921559. This PR adds a flag `--message-format` to `cargo locate-project` with possible values `json` (default) and `plain`.

```console
$ cargo locate-project --message-format json
{"root":"/git/cargo/Cargo.toml"}

$ cargo locate-project --message-format plain
/git/cargo/Cargo.toml
```

Closes #8009.
2020-09-23 21:51:43 +00:00
bors c369b8c8d8 Auto merge of #8165 - mchernyavsky:force-progress, r=ehuss
Add a term option to configure the progress bar

Closes https://github.com/rust-lang/cargo/issues/7587.
2020-09-23 21:28:14 +00:00
bors 13b73cdaf7 Auto merge of #8721 - est31:ns, r=ehuss
Replace d_as_f64 with as_secs_f64
2020-09-20 14:14:41 +00:00
est31 1b812858cb Replace d_as_f64 with as_secs_f64 2020-09-20 10:24:24 +02:00
Eric Huss 4d40ef4ef4 Add contributor guide. 2020-09-18 14:01:51 -07:00
bors d8c8548d6f Auto merge of #8713 - ehuss:filters_target-cross, r=alexcrichton
Add cross check to filters_target test.

This test requires a cross compiler target to be installed, so disable it if it is not.
2020-09-18 19:31:59 +00:00
Eric Huss 8ee908d40f Add cross check to filters_target test. 2020-09-18 12:28:33 -07:00
David Tolnay 9ecf5e96b9
Add plain message format for locate-project 2020-09-16 20:26:13 -04:00
mchernyavsky d649c66191 Add a term option to configure the progress bar 2020-09-16 22:32:31 +03:00
bors e4b65bdc80 Auto merge of #8706 - ehuss:flag-whitespace-test, r=alexcrichton
Add test for whitespace behavior in env flags.

This is a regression test to ensure that RUSTFLAGS/RUSTDOCFLAGS are split on just the space (0x20) character, and not any other whitespace. Requested at https://github.com/rust-lang/rust/pull/75539/files#r470923329
2020-09-15 22:24:02 +00:00
Eric Huss 157ed9f79a Add test for whitespace behavior in env flags. 2020-09-15 14:22:19 -07:00
bors 8777a6b1e8 Auto merge of #8697 - Mikastiv:pr-8695, r=ehuss
updated yank error message

Fixes #8695
2020-09-15 19:11:03 +00:00
bors 7f44ba46d3 Auto merge of #8701 - ehuss:unique-unit-dep-hash, r=alexcrichton
Fix non-determinism with new feature resolver.

This fixes a problem where Cargo was getting confused when two units were identical, but linked to different dependencies. Cargo generally assumes `Unit` is unique, but the new feature resolver can introduce a situation where two identical `Unit`s need to link to different dependencies. In particular, when building without the `--target` flag, the difference between a host unit and a target unit is not captured in the `Unit` structure. A dependency shared between normal dependencies and build dependencies can need to link to a second shared dependency whose features may be different.

The solution here is to build the unit graph pretending that `--target` was specified. Then, after the graph has been built, a second pass replaces `CompileKind::Target(host)` with `CompileKind::Host`, and adds a hash of the dependencies to the `Unit` to ensure it stays unique when necessary. This is done to ensure that dependencies are shared if possible.

I did a little performance testing, and I couldn't measure an appreciable difference. I also ran the tests in a loop for a few hours without problems.

An alternate solution here is to assume `--target=host` if `--target` isn't specified, and then have some kind of backwards-compatible linking in the `target` directory to retain the old directory layout. However, this would result in building shared host/normal dependencies twice. For *most* projects, this isn't a problem. This already happens when `--target` is specified, or `--release` is used (due to #8500). I'm just being very cautious because in a few projects this can be a large increase in build times. Maybe some day in the future we can be more bold and force this division, but I'm a little hesitant to make that jump.

Fixes #8549
2020-09-14 19:14:33 +00:00
Eric Huss 9efa0d5526 Fix non-determinism with new feature resolver. 2020-09-13 10:06:19 -07:00
Mikastiv 51fa3a4d28 --vers arg now required for yank cmd 2020-09-12 17:13:13 -04:00
bors 6015133364 Auto merge of #8692 - yaymukund:improve-tests-json-diffing, r=alexcrichton
Display formatted output for JSON diffing in tests.

This affects all tests that use `validate_upload`.

Before
<img src="https://user-images.githubusercontent.com/590450/92583169-da972000-f289-11ea-9f27-f09071a023b1.png" width="400">

After
<img src="https://user-images.githubusercontent.com/590450/92583195-e2ef5b00-f289-11ea-9ee5-a32f630a6472.png" width="400">
2020-09-12 16:39:05 +00:00
Mukund Lakshman 8d610e1d28 Display formatted output for JSON diffing in tests. 2020-09-12 17:24:53 +01:00
Mikastiv cb3f9f4046 updated yank error message 2020-09-10 16:11:41 -04:00