46 Commits

Author SHA1 Message Date
David Tolnay
1441ea4f4a
Perform cargo-semver-checks separately for cargo crate 2025-07-25 07:49:17 -07:00
Eric Huss
1ce8023626 Rustfmt 2024 2025-07-05 19:50:36 -07:00
Eric Huss
1213fc652b Apply rust_2024_incompatible_pat 2025-07-05 19:27:01 -07:00
Weihang Lo
b955cd1822
chore(ci): restore cargo-util semver check 2025-04-04 08:05:43 -07:00
Eric Huss
10175b1760
chore: semver-check build-rs against beta channel (#15223)
### What does this PR try to resolve?

This should have been restored when 1.84 was out,
but nobody remembered.
2025-02-23 14:38:42 +00:00
Weihang Lo
e820df0ca8
chore: sever-check build-rs against beta channel 2025-02-22 10:36:48 -05:00
Weihang Lo
80331b1ea6
chore: dont check cargo-util semver until 1.86 is released
This fixes the current confusing failures in our CI pipeline:

* https://github.com/rust-lang/cargo/actions/runs/13465687015/job/37630870984
* https://github.com/rust-lang/cargo/actions/runs/13469881475/job/37642079118

CI job failed because of this major SemVer breakage:

```diff
-pub fn strip_prefix_canonical<P: AsRef<Path>>(
-    path: P,
-    base: P,
+pub fn strip_prefix_canonical(
+    path: impl AsRef<Path>,
+    base: impl AsRef<Path>,
 ) -> Result<PathBuf, std::path::StripPrefixError> {
```

While cargo-util does have that change violating SemVer,
it is unlikely people use it with turbo-fish syntax.
And cargo-util is essentially for internal use.

See:

* https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/check-version-bump.20failure
* https://forge.rust-lang.org/policies/crate-ownership.html#internal-use
2025-02-22 10:32:32 -05:00
Ed Page
05228f76f4 chore(ci): Check against beta first
Most breaking changes should be against beta and it would be good to
have the context of whether we deviated from beta before checking
against stable.
2025-02-21 09:50:36 -06:00
Ed Page
f035814fe2 chore(ci): Visually group output in Github 2025-02-21 09:13:36 -06:00
Ed Page
88f858a5b5 refactor(bump): Visual group related operations 2025-02-21 09:11:33 -06:00
Ed Page
80c117a99b chore(ci): Don't check build-rs against past commits 2024-11-08 08:58:45 -06:00
Weihang Lo
80980d984a
chore(bump-check): cargo-test-{support,macro} on crates.io 2024-06-17 10:09:46 -04:00
Joe Neeman
04c963a993 Add workspace support for source overlays
Adds workspace configuration options (not user-exposed) for overlaying
sources.
2024-06-10 18:32:22 -05:00
Ed Page
705c4f1cae chore(ci): Don't check cargo against beta channel
We already only partially check it and it has been a source of false
positives.

While there is trust in the job, contributors and maintainers go into
the job assuming there is a problem and it takes time to break that
assumption.

If we lose trust in the job, we then won't trust it when it fails for
other reasons.

This also increases the risk of us not seeing other problems
`bump-checks` is meant to find if the steps in the job get re-arranged
to make this one of the early ones.
2024-04-29 09:05:33 -05:00
Paul Mabileau
6f581e9056
Chore(xtask-bump-check): Exclude cargo-test-* to make corresponding CI check pass
Signed-off-by: Paul Mabileau <paulmabileau@hotmail.fr>
2024-03-26 11:17:34 +01:00
Martin Robinson
8fa25ba41d chore: Fix minor grammar nit in command-line help
A *very* minor grammar correction. "Require" used in this way is
typically followed by the infinitive.
2024-03-18 14:32:28 +01:00
LuuuX
fb616a0f69 fix: bump check error 2024-03-14 21:28:14 +08:00
Ed Page
67b5aa4205 refactor(context): Rename config mod to context 2024-02-29 16:08:08 -06:00
Scott Schafer
305efa63cc
chore: Rename Config to GlobalContext 2024-02-20 11:55:15 -07:00
Weihang Lo
6072a0897a
chore(bump-check): include rustfix and cargo-util-schemas 2024-02-08 10:45:08 -05:00
Ed Page
9438f80042 chore: Remove rust-version from private packages
I removed it from `cargo-test-support` and `cargo-test-macro`, despite
people depending on those (via git) because my long term plan is resting
on the `auto` value which won't affect git dependencies.
2024-01-18 15:24:25 -06:00
Weihang Lo
0ac9cdeeec
ci: check SemVer for cargo-util-schemas on CI 2023-12-18 15:56:13 -05:00
Ed Page
633929d3aa refactor(schemas): Pull out cargo-util-schemas crate
Fixes #12801
2023-12-15 13:22:25 -06:00
Weihang Lo
516313379e
chore(bump-check): dont check home against beta/stable branches
The publish of home is not tied with Rust release process, hence.
2023-12-13 18:21:55 -05:00
Eric Huss
402d072d72 Ignore rustfix for semver-checks since it doesn't exist on the beta branch. 2023-11-21 10:02:14 -08:00
Weihang Lo
1539b3dfc1
lint: dogfood ourselves lints table in manifest
These lint rules are from src/lib.rs. We aim to remove
them in the source code once `Zlints` hit stable.
2023-11-16 11:35:21 -05:00
Jacob Finkelman
6835fa3867 query{_vec} should use IndexSummary 2023-11-13 19:39:25 +00:00
Eric Huss
80ffb1de1c Fix --quiet being used with nested subcommands.
This fixes an issue where `--quiet` doesn't work with commands that have
subcommands. This is because `config_configure` only looks at the global
and top-level subcommand, and not deeper subcommands. The issue was that
`--quiet` was not defined as a global flag. This was changed in
https://github.com/rust-lang/cargo/pull/6358 in order to give a better
help message for `cargo test --quiet`. I don't remember if clap just
didn't support overriding at the time, or if we just didn't know how it
worked. Anyways, it seems to work to override it now, so I think it
should be fine to mark it as global.

This should bring in `--quiet` more in-line with how `--verbose` works.
This means that `--quiet` is now accepted with `cargo report`,
`cargo help`, and `cargo config`.

This also fixes `--quiet` with `cargo clean gc`.

This should also help with supporting `--quiet` with the new `cargo
owner` subcommands being added in
https://github.com/rust-lang/cargo/pull/11879.

Fixes #12957
2023-11-12 11:17:43 -08:00
Ed Page
e70e310ce0 fix: Report more detailed semver errors
For `cargo install` we'll now show a more specific parse error for
semver, much like other parts of cargo.

This came out of my work on #12801.  I was looking at what might be
appropriate to put in a `cargo-util-semver` crate and realized we have
the `ToSemver` trait that exists but doesn't do much, so I dropped it.
2023-11-06 15:24:32 -06:00
bors
b48c41aedb Auto merge of #12706 - ehuss:cache-lock-mode, r=epage
Add new package cache lock modes

The way locking worked before this PR is that only one cargo could write to the package cache at once (otherwise it could cause corruption). However, it allowed cargo's to read from the package cache while running a build under the assumption that writers are append-only and won't affect reading. This allows multiple builds to run concurrently, only blocking on the part where it is not possible to run concurrently (downloading to the cache).

This introduces a new package cache locking strategy to support the ability to safely modify existing cache entries while other cargos are potentially reading from the cache. It has different locking modes:

- `MutateExclusive` (new) — Held when cargo wants to modify existing cache entries (such as being introduced for garbage collection in #12634), and ensures only one cargo has access to the cache during that time.
- `DownloadExclusive`  (renamed) — This is a more specialized name for the lock that was before this PR.   A caller should acquire this when downloading into the cache and doing resolution.  It ensures that only one cargo can append to the cache, but allows other cargos to concurrently read from the cache.
- `Shared` (new) — This is to preserve the old concurrent build behavior by allowing multiple concurrent cargos to hold this while a build is running when it is reading from the cache

**Reviewing suggestions:**
There are a few commits needed to help with testing which are first. The main commit has the following:
- `src/cargo/util/cache_lock.rs` is an abstraction around package cache locks, and is the heart of the change. It should have comments and notes which should guide what it is doing. The `CacheLocker` is stored in `Config` along with all our other global stuff.
- Every call to `config.acquire_package_cache_lock()` has been changed to explicitly state which lock mode it wants to lock the package cache in.
- `Context::compile` is the key point where the `Shared` lock is acquired, ensuring that no mutation is done while the cache is being read.
- `MutateExclusive` is not used in this PR, but is being added in preparation for #12634.
- The non-blocking `try_acquire_package_cache_lock` API is not used in this PR, but is being added in preparation for #12634 to allow automatic gc to skip running if another cargo is already running (to avoid unnecessary blocking).
- `src/cargo/util/flock.rs` has been updated with some code cleanup (removing unused stuff), adds support for non-blocking locks, and renames some functions to make their operation clearer.
- `tests/testsuite/cache_lock.rs` contains tests for all the different permutations of ways of acquiring locks.
2023-10-09 15:56:42 +00:00
Eric Huss
b4982adfd9 Add a new package cache locking system.
This introduces a new `CacheLocker` which manages locks on the package
cache. Instead of either being "locked" or "not locked", the new locker
supports multiple modes:

- Shared lock: Cargo can read from the package sources, along with any
  other cargos reading at the same time.
- Download exclusive lock: Only one cargo can perform downloads.
  Download locks do not interfere with Shared locks, since it is
  expected that downloading does not modify existing files (only adds
  new ones).
- Mutate exclusive lock: Only one cargo can have this lock, and it also
  prevents shared locks. This is so that the cargo can modify the
  package cache (such as deleting files) without breaking concurrent
  processes.
2023-10-08 14:16:51 -07:00
Weihang Lo
60539e94dc
ci: bump cargo-semver-checks to 0.24.0
Also remove workaround since the issue was fixed in upstream.
2023-10-08 16:24:23 -04:00
Ed Page
e4e10f2393 chore: Fix typos
This is a repeat of #11561
2023-09-19 15:28:48 -05:00
Weihang Lo
aef3bd22d3
lint: fix errors for rust 2018 idioms 2023-09-14 13:43:48 +08:00
Weihang Lo
b6c4e47cc0
refactor: put Source trait under cargo::sources 2023-09-07 21:06:34 +08:00
Ed Page
7a65c826a0 fix: Set MSRV for internal packages
For now, I'm punting on packages we generally expect others to use
2023-08-22 16:46:47 -05:00
Ed Page
576f901f81 fix(log): Use a more compact relative-time format
This changes logged messages from
```
2023-08-23T01:01:59.922018Z DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
To
```
   0.041729583s DEBUG cargo::core::compiler::fingerprint: filesystem up-to-date "/home/epage/src/personal/dump"
```
Benefits
- Less horizontal space taken up in boilerplate
- Easier to compare within a run

Downsides
- Harder to correlate with other processes, like with crates.io server
  operations

This gives us up to 4 digits for seconds which should be sufficient for
cargo build times.

We could make this more compact by dropping the digits of precision from
9 to 6 but that would require a custom Timer which might be a paint to
keep in sync between packages.
2023-08-22 20:34:07 -05:00
Arlo Siemsen
763edbab09 rename crate to cargo-credential-libsecret 2023-08-17 16:05:31 -05:00
Weihang Lo
1ee9db3123
fix(xtask-bump-check): query by package name to detect changes
versions and paths of a workspace members between the original and
a checked-out workspace are different, and shouldn't be included in
hash keys when querying packages.
2023-08-16 15:46:43 +01:00
Weihang Lo
c07043b7cf
fix(log): enable ansi color only in terminal 2023-08-14 15:45:25 +01:00
Weihang Lo
9d707e4b9a
chore: remove log, env_logger, and pretty_env_logger 2023-08-07 12:02:19 +01:00
Weihang Lo
7e69050c64
refactor: setup tracing-subscriber 2023-08-07 12:02:19 +01:00
Weihang Lo
23561f36a1
chore: add tracing-subscriber crate 2023-08-07 11:25:41 +01:00
Weihang Lo
af1a78b424
refactor: find & replace log:: -> tracing::
Except HTTP network debugging
2023-08-07 11:25:40 +01:00
Weihang Lo
9f0565e985
chore: add tracing crate 2023-08-07 11:21:55 +01:00
Weihang Lo
9cca5721e4
chore: new xtask bump-check
This is a rewrite of old `ci/validate-version-bump.sh` in Rust.
2023-08-01 22:54:40 +01:00