Commit graph

12427 commits

Author SHA1 Message Date
Eric Huss 41ac6078aa Bump cargo-util version. 2022-06-30 14:25:28 -07:00
Eric Huss 72320bdcca Update os_info 2022-06-30 14:00:23 -07:00
bors 42311063f0 Auto merge of #10799 - Urgau:check-cfg-fix-config-deserialization, r=ehuss
Fix deserialization of check-cfg in config.toml

When improving the check-cfg implementation in https://github.com/rust-lang/cargo/pull/10566 I changed the internal representation of `check_cfg` from multiple `bool` options to one `Option<(bool, bool, bool, bool)>` but I didn't realize until https://github.com/rust-lang/rust/issues/82450#issuecomment-1169836928 that the internal representation is actually somewhat public as it's used in the `[unstable]` in `.cargo/config.toml`.

And because TOML cannot represent tuples there is no way to set it from the `[unstable]` section. This PR fix this oversight by using a custom deserializer method similar to what was already done for `build-std`.
2022-06-29 22:13:09 +00:00
bors a3ae66804c Auto merge of #10798 - scop:patch-1, r=ehuss
fix: bash complete `install --path` with dirs

`--path` takes a mandatory dir argument.
2022-06-29 21:24:58 +00:00
Urgau 23f59d4eeb Add regression tests for check-cfg unstable config 2022-06-29 14:52:20 +02:00
Urgau c08a666a24 Fix config deserilization of check-cfg 2022-06-29 14:16:36 +02:00
Ville Skyttä ca08dadff6
feat: bash complete install --path with dirs 2022-06-29 10:31:18 +03:00
bors dbff32b278 Auto merge of #10079 - dtolnay-contrib:fetch, r=ehuss
Fetch GitHub commits by long hash more efficiently

Closes #10078.

**Tested with the following Cargo.toml:**

```toml
[package]
name = "repro"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
cargo = { git = "https://github.com/rust-lang/cargo", rev = "b30694b4d9b29141298870b7993e9aee10940524" }
```

```console
$ rm -rf ~/.cargo/git/db/cargo-* ~/.cargo/git/checkouts/cargo-*
$ time $CARGO generate-lockfile
$ du -shc ~/.cargo/git/db/cargo-* ~/.cargo/git/checkouts/cargo-*
```

Using current cargo from the most recent nightly, the `generate-lockfile` command downloads 69704 git objects in 7.0 seconds, consuming 41 MB on disk.

Using cargo built from this PR by `cargo build --release`, the same command downloads 21481 objects in 2.2 seconds, consuming 17 MB on disk.

Once libgit2 is able to do shallow clones (https://github.com/libgit2/libgit2/issues/3058) this can be even more of a speedup. Using command-line git (which does not use libgit2) and `time git fetch --depth=1 https://github.com/rust-lang/cargo b30694b4d9b29141298870b7993e9aee10940524` indicates that it downloads just 262 objects in 1.1 seconds.
2022-06-24 19:25:13 +00:00
bors 47620e2060 Auto merge of #10778 - epage:test, r=ehuss
refactor(test): Clarify asserts are for UI

In writing the contrib documentation for functional vs ui tests, I
realized that as we work to make snapbox work for the functional tests,
we'll need distinct `Assert` objects since we'll want to elide a lot
more content in functional tests.  I'm making room for this by
qualifying the existing asserts as being for "ui".
2022-06-24 18:27:15 +00:00
bors a5e08c4703 Auto merge of #10785 - ehuss:fix-dead_code-diag, r=Eh2406
Fix tests due to change in dead_code diagnostic.

https://github.com/rust-lang/rust/pull/97853 changed some diagnostics which is causing some tests to fail on the latest nightly.  This updates the tests to work on both stable and nightly.
2022-06-23 20:12:03 +00:00
Eric Huss 502a9c5407 Fix tests due to change in dead_code diagnostic. 2022-06-23 13:08:08 -07:00
bors ed549d8717 Auto merge of #10755 - jonhoo:stabilize-config-cli, r=ehuss
Stabilize config-cli

This stabilizes the `--config` CLI argument as per [this FCP](https://github.com/rust-lang/cargo/issues/7722#issuecomment-1114369809).

It also makes the adjustment [suggested by `@ehuss](https://github.com/rust-lang/cargo/issues/7722#issuecomment-1098612205)` to allow stabilizing `--config path` without _also_ stabilizing [`config-include`](https://doc.rust-lang.org/cargo/reference/unstable.html#config-include).

I took a guess that this would land in 1.63 and put that in the tombstone entry in the unstable docs, but let me know if that's likely to be wrong.

Closes https://github.com/rust-lang/cargo/issues/7722.

Also, I think this should probably be tagged `relnotes`.
2022-06-22 20:02:24 +00:00
Ed Page cbd4edb266 refactor(test): Clarify asserts are for UI
In writing the contrib documentation for functional vs ui tests, I
realized that as we work to make snapbox work for the functional tests,
we'll need distinct `Assert` objects since we'll want to elide a lot
more content in functional tests.  I'm making room for this by
qualifying the existing asserts as being for "ui".
2022-06-21 14:59:54 -05:00
Jon Gjengset 7eefb4221f Include --config in cargo help output 2022-06-21 16:24:41 +00:00
Jon Gjengset 0ecdde53eb Don't refer to --config as unstable 2022-06-21 16:07:49 +00:00
bors c9d8c28cba Auto merge of #10767 - danilhendrasr:master, r=epage
Restrict duplicate deps warning only to published packages

Fixes #10752
2022-06-21 01:37:37 +00:00
Danil Hendra Suryawan 08d10184aa Restrict duplicate deps warning only to published packages 2022-06-21 00:28:25 +00:00
David Tolnay 7da3c360bc
Fetch GitHub commits by long hash more efficiently 2022-06-20 16:47:32 -07:00
bors 5db8295f92 Auto merge of #10746 - shkoo:nils/custom_target_path_cache, r=weihanglo
Use fingerprint_hash when computing fingerprints for custom targets

This makes it easier to get reproducible builds for custom targets.
2022-06-20 22:56:09 +00:00
Eric Huss 971caf5df6 Rework how workspace roots are discovered.
This centralizes the workspace discovery code into one location
`find_workspace_root_with_loader` so that it isn't duplicated.
2022-06-20 12:51:52 -05:00
Josh Triplett da5f35d950
Merge pull request #10761 from Muscraft/reduce-parsing
Add preloading for workspace packages in `resolve_with_previous`
2022-06-20 10:46:11 -07:00
bors 056313dbfb Auto merge of #10772 - tshepang:patch-2, r=Eh2406
capitalise, for consistency
2022-06-20 16:35:32 +00:00
Nils McCarthy b424f90edb Don't use the full pathname of a custom target json in fingerprint hashes.
This makes it easier to get reproducible builds for custom targets.
2022-06-20 09:09:52 -07:00
bors 5f5c1966a8 Auto merge of #10774 - Muscraft:update-benchsuite-deps, r=Eh2406
remove unused dependency from benchsuite

In #10754 I added a new benchmark to the benchsuite. While figuring out the best way to add the new benchmark, I added `cargo-test-support` as a dependency. It appears I missed removing it before making the PR.

This PR removes `cargo-test-support` since it is not needed
2022-06-20 15:34:50 +00:00
bors 8fd9f82a5e Auto merge of #10758 - epage:docs, r=weihanglo
docs(contrib): Add documentation for ui tests

### What does this PR try to resolve?

This only adds information about snapshot testing using `snapbox` and
keeps the functional testing documentation focused on the existing
facilities.  We can updated this as our use of `snapbox` matures.

### How should we test and review this PR?

I did not generate and verify the HTML

In writing this, I did notice that we define
`cargo_test_support::compare::assert` but only use it for filesystem
asserts and not binary asserts.  We should probably add our own function
that wraps `snapbox::cmd::Command::cargo()` and passes in
`cargo_test_support::compare::assert`.  I've left that out of this PR to
keep things focused.
2022-06-20 14:47:36 +00:00
Scott Schafer 5b368820a7 remove unused dependency from benchsuite 2022-06-20 09:44:48 -05:00
Ed Page 619630c3ec docs(contrib): Update API item links 2022-06-20 09:35:54 -05:00
Tshepang Mbambo f5b21bfe6e
capitalise, for consistency 2022-06-19 18:37:50 +02:00
bors 2fcd302b4d Auto merge of #10769 - jonhoo:patch-1, r=Eh2406
Remove repeated word in in dep: error message
2022-06-18 19:15:32 +00:00
Jon Gjengset 372fdfee15
Remove repeated word in in dep: error message 2022-06-18 14:07:27 -04:00
bors 17d4db0f0b Auto merge of #10754 - Muscraft:benchsuite, r=epage
Add a benchmark for workspace initialization

It [was suggested](https://github.com/rust-lang/cargo/pull/10736#discussion_r894822022) that a benchmark for workspace initialization should be added. This was suggested because there were issues with the performance of [workspace inheritance](https://github.com/rust-lang/cargo/issues/10747) as well as a general way to track the workspace initialization time across cargo changes

### Changes
- Moved common functions out of `resolve.rs` to a shared `lib.rs`
- Added a new struct to be used when creating a new benchmark
  -  This was done because `env!("CARGO_TARGET_TMPDIR")` would fail to compile when put inside of the new `lib.rs`
- Added a new workspace test for workspace inheritance
  - This new workspace does not have a repo that it was built from and if one needs to be made I can change that
2022-06-18 06:53:48 +00:00
Jon Gjengset 39c3173619 Stabilize --config
FCP
https://github.com/rust-lang/cargo/issues/7722#issuecomment-1114369809

Closes #7722.
2022-06-17 22:46:04 +00:00
Jon Gjengset 103cff694b Allow --config path without config-include
As per
https://github.com/rust-lang/cargo/issues/7722#issuecomment-1098612205
2022-06-17 22:44:57 +00:00
Scott Schafer f182411a8e add a bench for workspace initialization 2022-06-17 13:16:56 -05:00
Scott Schafer 42962da0a5 refactor parts of benchsuite/resolve.rs to a library, so it can be used by other benchmarks 2022-06-17 12:20:23 -05:00
bors 8d42b0e879 Auto merge of #10764 - kornelski:clarify-http, r=Eh2406
Use specific terminology for sparse HTTP-based registry

Before the options is popularized, I'd like to take opportunity to give it a unique name used consistently. It's been called "http" registry, but that's a rather generic term, especially that existing git-based registry also uses HTTP as its transport.

New registry URLs use `sparse+https://` prefix, so calling it "sparse" registry seems more appropriate.

#9069
2022-06-17 16:46:26 +00:00
Jacob Finkelman 288856b778 HTTP-based -> sparse
Co-authored-by: Arlo Siemsen <arkixml@gmail.com>
2022-06-17 16:45:33 +00:00
Ed Page d847468768 docs(contrib): Add documentation for ui tests
This only adds information about snapshot testing using `snapbox` and
keeps the functional testing documentation focused on the existing
facilities.  We can updated this as our use of `snapbox` matures.

In writing this, I did notice that we define
`cargo_test_support::compare::assert` but only use it for filesystem
asserts and not binary asserts.  We should probably add our own function
that wraps `snapbox::cmd::Command::cargo()` and passes in
`cargo_test_support::compare::assert`.  I've left that out of this PR to
keep things focused.
2022-06-17 10:25:41 -05:00
Kornel a9faf49040 Use specific terminology for sparse HTTP-based registry
Git-based registry uses HTTP too
2022-06-17 15:09:56 +01:00
Scott Schafer cda5f82498 add preloading for workspace packages in resolve_with_previous so manifests aren't parsed twice 2022-06-16 15:34:22 -05:00
bors 17f8088d6e Auto merge of #10753 - epage:clap32-deprecated, r=weihanglo
chore: Upgrade to clap 3.2

I decided to use cargo as a test case for upgrading to clap 3.2 prior to release.  From the builder API's perspective, a lot has change.  While the changelog summarizes it, the release announcement is still pending.  In short, the API is now typed.  You declare what type an `Arg` is and access it by that type.  flags (both `is_present` and `occurrences_of`) are also now specified through `ArgAction` and the result gets stored like any other arg value.  I made a `ArgMatchesExt::flag` and `command_prelude::flag` functions to make working with these easier.

Now that clap exposes non-panicking variants of its functions, I switched from a "look before you leap" approach with `is_arg_valid` to a "better to ask forgiveness than permission" with checking the error variant.  I decided to just make a convenience to swallow that error type.  Not a fan of how loose things are but I think this will just be something we iterate on over time.
2022-06-14 23:11:47 +00:00
Ed Page fc0ca1e178 refactor: Resolve clap 3.2 deprecations 2022-06-13 10:02:23 -05:00
Ed Page 6f475f090e chore: Upgrade to clap 3.2 2022-06-13 10:02:23 -05:00
Ed Page 55f8a260e0 refactor(cli): Centralize reading of verbose 2022-06-13 10:01:35 -05:00
bors 6b8e192226 Auto merge of #10738 - arlosi:auth-testingonly, r=ehuss
Improve testing framework for http registries

Improve integration of the http server introduced by the http-registry feature.

The same HTTP server is used for serving downloads, the index, and the API within the test framework.

This makes it easier to write tests that deal with authentication and http registries.

Most of this change is pulled from #10592. Getting it in separately should make the other change easier to review.

r? `@Eh2406`
2022-06-11 00:06:55 +00:00
Arlo Siemsen 24dac452c5 Improve testing framework for http registries
Improve integration of the http server introduced by the http-registry feature.
Now the same HTTP server is used for serving downloads, the index, and
the API.

This makes it easier to write tests that deal with authentication and
http registries.
2022-06-10 16:51:35 -05:00
bors 1b3fce78d6 Auto merge of #10728 - jorendorff:patch-1, r=ehuss
doc: Improve example of using the links field

`"foo"` doesn't really help say what this is.
2022-06-10 01:11:04 +00:00
bors 4d92f07f34 Auto merge of #10739 - weihanglo:revert-num-cpus, r=epage
Revert #10427: switch from num_cpus

Same as #10737 but on nightly
2022-06-09 01:18:36 +00:00
Weihang Lo 8345cf5037
Revert #10427: switch from num_cpus
This reverts commit 6d11f9e7d4, reversing
changes made to c5cdd25c14.
2022-06-09 07:47:00 +08:00
bors 85e457e158 Auto merge of #10725 - arlosi:http-cratesio, r=Eh2406
Make -Z http-registry use index.crates.io when accessing crates-io

Use `sparse+https://index.crates.io/` to access crates.io when `-Z http-registry` is set.

* `Cargo.lock` files still emit the github URL `https://github.com/rust-lang/crates.io-index`.
* Allows publishing to a source-replaced `crates-io` only for `index.crates.io`. Other source-replacements of `crates-io` are still blocked.

Fixes #10722
r? `@Eh2406`
2022-06-07 21:57:52 +00:00