Commit Graph

492 Commits

Author SHA1 Message Date
bors b2ee005824 Auto merge of #11162 - pacak:master, r=ehuss
Expose libgit2-sys/vendored feature as vendored-libgit2

### What does this PR try to resolve?

Compiling cargo on MacOS can be problematic due present libraries, `cargo` already supports vendoring for openssl (and it helps https://github.com/pacak/cargo-show-asm/pull/51 to some users). This pull request attempts to extend vendoring support to libgit2 in order to fix more foreign library issues: https://github.com/pacak/cargo-show-asm/issues/50

While it is possible for me to enable it on my side (https://github.com/pacak/cargo-show-asm/pull/52) a special care needs to keep versions in sync. Exposing this feature in `cargo` directly will make such fixes for my and other crates more robust.

### How should we test and review this PR?
Disabled by default means existing behavior is unchanged, testing with it enabled to confirm if it still works should do the trick.
2022-09-30 00:14:30 +00:00
Michael Baikov 8818a89330 Expose libgit2-sys/vendored feature as vendored-libgit2
disabled by default
2022-09-29 12:17:25 -04:00
Ed Page 96948f7a24 refactor(cli): Upgrade to clap v4 2022-09-28 13:32:14 -05:00
Weihang Lo 92df3e73e6
Bump to 0.67.0 2022-09-23 09:20:30 +01:00
bors 9230e4839d Auto merge of #11113 - rdimartino:maybeworkspace-deserialize, r=epage
Improve errors for TOML fields that support workspace inheritance

Fixes #10997

This also addresses the issue with `MaybeWorkspace<VecStringOrBool>` mentioned in #10942:

```
Caused by:
  invalid type: string "foo", expected a boolean or vector of strings for key `package.publish`
```

I removed the `maybe_workspace_vec_string` deserializer in 7a50c0c718 because the error message from the inner `Vec<String>` is now surfaced, but I can revert that if it's preferable to keep those changes.

I tried to base the `deserialize` implementation off of the derived impl for an untagged enum from `cargo expand`. This approach [ultimately led me](https://github.com/serde-rs/serde/blob/v1.0.144/serde/src/private/de.rs#L218) to adding the `serde-value` dependency.
2022-09-22 20:10:33 +00:00
Weihang Lo bf1523b663
test: renamed uplifted artifact remains unmodified after rebuild 2022-09-21 16:02:42 +01:00
Robert DiMartino 06c31de972 Improve errors for TOML fields that support workspace inheritance 2022-09-19 23:41:20 -04:00
Ed Page d674c2294b refactor(cli): Make help behave like other subcommands
Before, we had hacks to intercept raw arguments and to intercept clap
errors and assume what their intention was to be able to implement our
help system.

This flips it around and makes help like any other subcommand,
simplifying cargo initialization.
2022-08-31 19:18:26 -05:00
bors e5ec3a8ff9 Auto merge of #11004 - jonhoo:bump-git2, r=weihanglo
Bump git2 to 0.15 and libgit2-sys to 0.14

This will allow cargo to avoid vendored builds of git2 in up-to-date
environments going forward, and brings in the [libgit2 1.4.4 CVE fix].

[libgit2 1.4.4 CVE fix]: https://github.com/libgit2/libgit2/releases/tag/v1.4.4
2022-08-27 09:22:12 +00:00
Jon Gjengset ed78e6b747 Bump snapbox to 0.3
0.3 has a small number of [breaking changes], but makes diffs much
easier to visually parse by eliding large sections of unchanged content.

[breaking changes]: https://github.com/assert-rs/trycmd/blob/main/crates/snapbox/CHANGELOG.md#030---2022-08-01
2022-08-17 22:07:20 +00:00
Jon Gjengset 30fe22b260 Bump git2 to 0.15 and libgit2-sys to 0.14
This will allow cargo to avoid vendored builds of git2 in up-to-date
environments going forward, and brings in the [libgit2 1.4.4 CVE fix].

[libgit2 1.4.4 CVE fix]: https://github.com/libgit2/libgit2/releases/tag/v1.4.4
2022-08-17 22:02:28 +00:00
Eric Huss 34632c5925 Bump to 0.66.0 2022-08-12 12:22:05 -07:00
Weihang Lo 33497512a8
Use std:🧵:scope to replace crossbeam 2022-08-12 00:09:54 +01:00
Josh Triplett 86163845a5 Switch back to `available_parallelism`
This reverts commit 8345cf5037. Since that
time, there are now multiple calls to get the number of CPUs, to handle
the `-j -NUM` case, so factor out a helper function.
2022-08-10 17:49:24 +02:00
hi-rustin df8f33b4f2 Bump os_info to 3.5.0
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-08-06 13:12:20 +08:00
Eric Huss fa39fd4cd9 Bump to 0.65.0 2022-07-01 11:43:25 -07:00
bors 501b56b26e Auto merge of #10804 - ehuss:bump-cargo-util, r=joshtriplett
Bump cargo-util version.

#10546 made a semver-incompatible change to the API of `ProcessBuilder::get_args`. Unfortunately we did not catch that until it was published. This bumps the version of cargo-util to 0.2.1 to accommodate that change. Stable will get version 0.2.0 so that the changes on beta can be released as 0.2.1 in their own time.

cc #10803
2022-07-01 04:21:25 +00:00
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
Ed Page 6f475f090e chore: Upgrade to clap 3.2 2022-06-13 10:02:23 -05: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
Yuki Okushi 819f7a5cff
Enforce to use tar v0.4.38 2022-06-01 19:17:15 +09:00
Eric Huss 1bfb897485 Update libcurl 2022-05-23 08:21:50 -07:00
Eric Huss 447384ed72 Bump to 0.64.0 2022-05-20 13:27:39 -07:00
Ed Page 8e0868057a chore: Upgrade toml_edit 2022-04-26 10:16:26 -05:00
Ed Page 6ec86fc47b test(add): Import cargo-add tests
This is a fork of https://github.com/killercup/cargo-edit/tree/merge-add
at d561719161ed5564111ff2152ff206463ec24cef
2022-04-11 13:09:40 -05:00
Ed Page 5ca5f2f157 feat: Add `add` cargo subcommand
This is a fork of https://github.com/killercup/cargo-edit/tree/merge-add
at d561719161ed5564111ff2152ff206463ec24cef
2022-04-11 13:06:10 -05:00
bors 1073915930 Auto merge of #10546 - weihanglo:issue-10381-rustc-argfile, r=epage
Retry command invocation with argfile

### What does this PR try to resolve?

Fixes #10381

The goal is to invoke `rustc` and `rustdoc` with ``@path`` arg file as a fallback.

Since the `-Zcheck-cfg-features`[^1] has already been implemented, in the foreseeable future cargo will probably hit the “**command line too big**” more often on Windows. `rustdoc` and `rustc` both support ``@path`` argfile [^2][^3], so we can leverage the feature for the fallback logic.

The idea behind this PR is that we put the **retry logic** in `ProcessBuilder::exec*` functions and reuse them as much as possible.

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

Review it commit by commit is recommended.

Argfile fallback is hard to tested with integration tests, so I added some unit tests for `cargo_util::ProcessBuilder` and `cargo::ops::fix::FixArgs`.

If you do want to test the support of argfile manually, a new environment variable `__CARGO_TEST_FORCE_ARGFILE` is added for the sake of forcing cargo to use argfile for rustc invocations. For example, `__CARGO_TEST_FORCE_ARGFILE cargo test --test testsuite -- fix::` is usually a good start to test this feature.

[^1]: https://doc.rust-lang.org/beta/cargo/reference/unstable.html?highlight=check#check-cfg-features
[^2]: https://doc.rust-lang.org/rustc/command-line-arguments.html#path-load-command-line-flags-from-a-path
[^3]: https://doc.rust-lang.org/rustdoc/command-line-arguments.html#path-load-command-line-flags-from-a-path
2022-04-11 14:57:46 +00:00
bors b36cc6ed41 Auto merge of #10538 - Muscraft:rfc2906-part3, r=epage
Part 3 of RFC2906 - Add support for inheriting `license-path`, and `depednency.path`

Tracking issue: #8415
RFC: rust-lang/rfcs#2906

[Part 1](https://github.com/rust-lang/cargo/pull/10497)
[Part 2](https://github.com/rust-lang/cargo/pull/10517)

This PR focuses on adding support for inheriting `license-path`, and `depednency.path`:
- To adjust the relative paths from being workspace-relative to package-relative, we use `pathdiff` which `cargo-add` is also going to be using for a similar purpose
- `ws_path` was added to `InheritableFields` so we can resolve relative paths from  workspace-relative to package-relative
- Moved `resolve` for toml dependencies from `TomlDependency::<P>` to `TomlDependency`
  - This was done since resolving a relative path should be a string
  - You should never inherit from a `.cargo/config.toml` which is the reason `P` was added

Remaining implementation work for the RFC
- Relative paths for `readme`
- Path dependencies infer version directive
- Lock workspace dependencies and warn when unused
- Optimizations, as needed
- Evaluate any new fields for being inheritable (e.g. `rust-version`)
2022-04-08 15:38:07 +00:00
Weihang Lo 4f6a2ec28b
Bump cargo-util to 0.1.3 2022-04-08 15:39:36 +08:00
Eric Huss 3d5f944180 Bump to 0.63.0 2022-04-07 15:04:31 -07:00
Scott Schafer 3d07652c38 Part 3 of RFC2906 - Add support for inheriting `license-path`, and `depednency.path` 2022-04-07 16:34:34 -05:00
Weihang Lo 0e044546f8
Bump git2@0.14.2 and libgit2-sys@0.13.2
The previous libgit2-sys release forgot to include the fix of libgit2 1.4.2.
https://github.com/rust-lang/git2-rs/pull/820#issuecomment-1064284814
That might cause problems when people don't have "Git for Windows"
installed on their machines.
2022-03-15 07:26:45 +08:00
bors 6d11f9e7d4 Auto merge of #10427 - weihanglo:drop-num_cpus, r=joshtriplett
Use `available_parallelism` instead of `num_cpus`
2022-03-08 17:07:30 +00:00
bors e756c130cf Auto merge of #10442 - Urgau:git2-update, r=alexcrichton
Update git2 dependencies

This pull-request update git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1.

This fix a memory corruption that I have locally when running the testsuite:
```
==2338650==  Uninitialised value was created by a stack allocation
==2338650==    at 0x11FE3A0: git2::remote::Remote::fetch (remote.rs:276)
```
2022-03-01 18:12:20 +00:00
Loïc BRANSTETT dd701a17f3 Update git2 to 0.14.1 and git2-curl to 0.15.0 and libgit2-sys to 0.13.1 2022-03-01 18:39:22 +01:00
Weihang Lo 1988bc8d37
Use `available_parallelism` instead of num_cpus
`std:🧵:available_parallelism` has been stabilized since 1.59.0.

Also, we don't want to block timing data output, so if parallelism
data is not available the table will display `ncpu=n/a` instead.
2022-02-26 16:52:59 +08:00
Eric Huss 560ee81ec1 Bump to 0.62.0 2022-02-24 13:47:20 -08:00
Jon Gjengset dfda89a82e Bump clap to match when deprecations happened 2022-02-16 20:01:57 -08:00
Ed Page 0f75237617 test: Fix compatibilty with new toml_edit
`toml_edit` fixed a bug in 0.13.4 that this test was relying on that is
meant to help with rust-lang/cargo#10349.  This basically restores us
back to the pre-toml_edit behavior for published manifests.
2022-01-31 10:57:38 -06:00
Weihang Lo 13a09beccf
Bump clap to 3.0.13 2022-01-27 19:27:52 +08:00
bors bb96b3a3e8 Auto merge of #10086 - epage:toml, r=ehuss
Port cargo from toml-rs to toml_edit

Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`

TODO
- [x] Analyze performance and address regressions
- [x] Identify and resolve incompatibiies
- [x] Resolve remaining test failures, see
      https://github.com/ordian/toml_edit/labels/cargo
- [x] ~~Switch the code from https://github.com/rust-lang/cargo/pull/10176 to only parse once~~ (this PR is being merged first)
2022-01-20 03:56:18 +00:00
Eric Huss a25d3864d9 Bump to 0.61.0 2022-01-14 10:57:54 -08:00
Ed Page 320c279f43 Port cargo from toml-rs to toml_edit
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
bors e77c0719fd Auto merge of #10269 - ehuss:stabilized-new-features, r=alexcrichton
Stabilize namespaced and weak dependency features.

This stabilizes the namespaced and weak dependency features.  Support is now enabled on crates.io, so this should be ready to go.

As a part of this change, the new feature resolver is now enabled all of the time. This is fairly risky, since there are likely edge cases that haven't been exercised.
NOTE: Projects using `resolver="1"` *should* continue to have the same behavior, the old resolver behavior is emulated.

Closes #8813
Closes #8832
2022-01-12 15:15:09 +00:00
Eric Huss 43a063c80a Stabilize namespaced and weak dependency features. 2022-01-06 15:56:56 -08:00
Ed Page f17ecafc24 Upgrade to Clap 3
- One parser change found by `cargo_config::includes` is that clap 2
  would ignore any values after a `=` for flags.
  `cargo config --show-origin` is a flag but the test passed `--show-origin=yes` which
  happens to give the desired result for that test but is the same as
  `--show-origin=no` or `--show-origin=alien-invasion`.
- The parser now panics when accessing an undefined attribute but clap
  takes advantage of that for sharing code across commands that have
  different subsets of arguments defined.  I've extended clap so we can
  "look before you leap" and put the checks at the argument calls to
  start off with so its very clear what is tenuously shared.  This
  allows us to go in either direction in the future, either addressing
  how we are sharing between commands or by moving this down into the
  extension methods and pretending this clap feature doesn't exist
- On that topic, a test found clap-rs/clap#3263.  For now, there is a
  hack in clap.  Depending on how we fix that in clap for clap 4.0, we
  might need to re-address things in cargo.
- `value_of_os` now requires setting `allow_invalid_utf8`, otherwise it
  asserts.  To help catch this, I updated the argument definitions
  associated with lookups reported by:
  - `rg 'values?_os' src/`
  - `rg 'values?_of_os' src/`
- clap now reports `2` for usage errors, so we had to bypass clap's
  `exit` call to keep the same exit code.

BREAKING CHANGE: API now uses clap3
2022-01-05 19:54:54 -06:00
pinkforest e4f09b6afa Bumps up tar to 0.4.36 2021-12-15 15:01:43 +11:00
bors 599961b320 Auto merge of #10155 - ehuss:bump-deps, r=alexcrichton
Bump versions of local deps.

There have only been very minor changes since the last version.
2021-12-13 17:47:44 +00:00
bors 5d7ac5897d Auto merge of #10154 - ehuss:version-bump, r=alexcrichton
Bump to 0.60.0, update changelog
2021-12-13 17:00:36 +00:00