Hi Everyone!
This PR is aimed to have some improvements over #15704
### What does this PR try to resolve?
Now, multiple build scripts are built correctly. But there are some
underlying issues, that this PR is targeting.
- Preserving the order of the build scripts: Earlier the build scripts
were sorted by default, but now, the order will be preserved.
### How to test and review this PR?
There is a feature gate `multiple-build-scripts` that can be passed via
`cargo-features` in `Cargo.toml`. So, you have to add
```toml
cargo-features = ["multiple-build-scripts"]
```
Preferably on the top of the `Cargo.toml` and use nightly toolchain to
use the feature
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [cargo_metadata](https://redirect.github.com/oli-obk/cargo_metadata) |
workspace.dependencies | minor | `0.20.0` -> `0.21.0` |
---
### Release Notes
<details>
<summary>oli-obk/cargo_metadata (cargo_metadata)</summary>
###
[`v0.21.0`](https://redirect.github.com/oli-obk/cargo_metadata/compare/0.20.0...0.21.0)
[Compare
Source](https://redirect.github.com/oli-obk/cargo_metadata/compare/0.20.0...0.21.0)
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS40Ni4zIiwidXBkYXRlZEluVmVyIjoiNDEuNDYuMyIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
### What does this PR try to resolve?
Unblock CI
### How to test and review this PR?
### Notes
These were caught with the latest nightly
This was pulled from #15800
### What does this PR try to resolve?
ref https://github.com/rust-lang/cargo/issues/14834
In this pull request, I moved `IndexPackage` to `cargo-util-schemas` to
enable third-party applications and `cargo-dev-registry` to utilize this
common struct.
For instance, crates.io has its own `IndexPackage` located at
005667f041/crates/crates_io_index/data.rs (L5).
By moving it to `cargo-util-schemas`, we allow different applications to
use this struct more easily.
### How to test and review this PR?
It shouldn't break any tests; it's just a refactoring.
### What does this PR try to resolve?
Unconditionally enabling "blocking-http-transport-curl" made the `cargo`
library incompatible with crates that prefer reqwest. An example being
the `rustsec` crate with git support:
-
https://github.com/rustsec/rustsec/blob/rustsec/v0.30.2/rustsec/Cargo.toml#L45-L47
-
https://github.com/rustsec/rustsec/blob/rustsec/v0.30.2/rustsec/Cargo.toml#L34
-
https://github.com/EmbarkStudios/tame-index/blob/0.21.0/Cargo.toml#L14-L17
Having `cargo` and `rustsec` in the same dependency graph makes
`gix-transport` fail to compile.
```toml
[dependencies]
cargo = "0.88.0"
rustsec = "0.30.2"
```
```console
error[E0428]: the name `Impl` is defined multiple times
--> $CARGO_HOME/registry/src/index.crates.io-1949cf8c6b5b557f/gix-transport-0.45.0/src/client/blocking_io/http/mod.rs:220:1
|
217 | pub type Impl = curl::Curl;
| --------------------------- previous definition of the type `Impl` here
...
220 | pub type Impl = reqwest::Remote;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Impl` redefined here
|
= note: `Impl` must be defined only once in the type namespace of this module
error: Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive
--> $CARGO_HOME/registry/src/index.crates.io-1949cf8c6b5b557f/gix-transport-0.45.0/src/client/blocking_io/http/mod.rs:26:1
|
26 | compile_error!("Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
After this PR, dependency graphs that prefer reqwest can switch to
Cargo's http-transport-reqwest feature.
```toml
[dependencies]
cargo = { default-features = false, features = ["http-transport-reqwest"] }
rustsec = "0.30.2"
```
Cargo will continue to have a direct dependency on `curl`, but HTTP
operations performed through gix will use `reqwest`. This means both
curl's HTTP implementation and reqwest's HTTP implementation will be
linked. This is still much better than the only existing solution, which
is that you must pick versions of `cargo` and other dependency
(`rustsec`) which depend on semver-incompatible versions of gix, causing
2 entire versions of gix to be linked, in order to sidestep the mutually
exclusive features being enabled on the same version of gix. Gix version
numbers advance rapidly enough that this is often possible, but
sometimes (like right now) you would be unable to use the most recent
published release of `cargo`.
### How to test and review this PR?
- `cargo check --lib`
- `cargo check --lib --no-default-features --features
http-transport-reqwest`
Also tested by backporting this commit onto
<https://github.com/rust-lang/cargo/pull/15391>'s base commit (i.e. when
gix 0.70 was used) to ensure a conflict with rustsec's gix dependency,
and successfully building the following project.
```toml
[package]
name = "repro"
version = "0.0.0"
edition = "2024"
publish = false
[dependencies]
cargo = { path = "../cargo", default-features = false, features = ["http-transport-reqwest"] }
rustsec = "0.30.2"
```
### What does this PR try to resolve?
This PR changes the way the charts produced by `cargo build --timings`
scale. It changes the scale slider so that its min/max values adapt to
the duration of the build, to allow zooming in/out even for very short
build durations. It also automatically initializes the scale value based
on the client's window width.
The number of pixels per second per scale value has been changed from 1
to 8, to avoid having too many scale values for the given duration of
supported chart widths, which I have determined in this PR to be `[200,
4096]` pixels.
https://github.com/user-attachments/assets/3e6e9f14-eabe-425a-a568-9fcb5c835145
### How to test and review this PR?
Run `cargo build --timings` e.g. on
https://github.com/BurntSushi/ripgrep. Then open the resulting page in a
browser, and try to enlarge/ensmall the window (possibly using mobile
emulation), and see how the charts react to window size.
Fixes: https://github.com/rust-lang/cargo/issues/15666
This should also help fixing these spurious "cannot package because some
excluded file is untracked" issues.
### Tasks
* [x] step-by-step conversion of `vcs.rs`
* [x] use proper feature toggle
* [x] ~~cleanup~~ final check by myself
* [ ] ~~move split & rename into its own commit. Probably squash all
changes except for the gix upgrade.~~
- I like to have the major stages of this PR conserved.
* [x] upgrade to a gix release including
https://github.com/GitoxideLabs/gitoxide/pull/2016
- This was done in `master` already.
* [x] fix tests by fixing `gix` - `submodules()` call isn't bare-repo
safe.
* [x] fix failure on Windows
- `gix status` seems to go through a symlink, arriving at the wrong
conclusion, on Windows.
* [x] fix performance regression on `aws-sdk-rust`.
### Notes for the Reviewer
* This implementation is both faster and more correct, thus affects
#15416 and #14955.
Related to https://github.com/GitoxideLabs/gitoxide/issues/106.
This is achieved by allowing `gix status` to only run in the
package root, while running it another time just on the few files
that are interesting outside of the package root.
This saves a lot of time compared to the previous implementation,
which ran the status on the entire repository.
This should also help fixing these spurious "cannot package because
some excluded file is untracked" issues.
Remove the respective `git2` implementation at the same time
as there seems to be no need for it.
### What does this PR try to resolve?
The type is
```c
typedef struct {
const gchar *name;
SecretSchemaFlags flags;
SecretSchemaAttribute attributes[32];
/* <private> */
gint reserved;
gpointer reserved1;
gpointer reserved2;
gpointer reserved3;
gpointer reserved4;
gpointer reserved5;
gpointer reserved6;
gpointer reserved7;
} SecretSchema;
```
so the current object we give it is 8 pointers too short
It's incredibly lucky that libsecret, at this time, only uses
`reserved`, and not in any of the functions we call
Also, some obvious cleanups while I was there and comparing with [my
implementation](https://github.com/nabijaczleweli/cargo-update/blob/v17.0.0/src/ops/mod.rs#L1443)
from [cargo-update
17.0.0](https://github.com/nabijaczleweli/cargo-update/releases/v17.0.0).
### How to test and review this PR?
Observe
https://sources.debian.org/src/libsecret/0.20.5-3/libsecret/secret-schema.h/#L43
I suppose?
The type is
typedef struct {
const gchar *name;
SecretSchemaFlags flags;
SecretSchemaAttribute attributes[32];
/* <private> */
gint reserved;
gpointer reserved1;
gpointer reserved2;
gpointer reserved3;
gpointer reserved4;
gpointer reserved5;
gpointer reserved6;
gpointer reserved7;
} SecretSchema;
so the current object we give it is 8 pointers too short
It's incredibly lucky that libsecret, at this time,
only uses reserved, and not in any of the functions we call
### What does this PR try to resolve?
This is not necessary, as 32 is the default, and actually of the wrong
type now since it's a number now.
When planning to make these type mismatches error in
https://github.com/rust-lang/rust/pull/144218, cargo would fail here, so
I just removed it.
This custom target test very much shows how Cargo should be a subtree,
in this case it was fine because there's a compatible fix that I can
push now, otherwise it would have been very annoying.
### How to test and review this PR?
If the test suite passes, it works
This is not necessary, as 32 is the default, and actually of the wrong
type now since it's a number now.
When planning to make these type mismatches error, cargo would fail
here, so I just removed it.
This custom target test very much shows how Cargo should be a subtree,
in this case it was fine because there's a compatible fix that I can
push now, otherwise it would have been very annoying.
### What does this PR try to resolve?
Information about artifact dependencies is already available through
`cargo metadata`, and therefore also through serializing and re-parsing
`dependency.serialized()` using `serde_json::to_value` +
`serde_json::from_value`. This PR makes the same information available
directly through the library API of `cargo::core::Dependency`.
I ran into these private methods while working on
https://github.com/rust-lang/cargo/issues/15751.
### How to test and review this PR?
`cargo check`