-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(base): Support bases in patches in virtual manifests (#14931)
### What does this PR try to resolve? This bug has been there since #14360 Found this when looking to change the normalization code for cargo script. As a result, I also changed `cargo-util-schemas` in the hope that grouping the fields would make the intent clearer. Since I was already changing field order, I also re-ordered for my personal taste (user facing features first) ### How should we test and review this PR? ### Additional information
- Loading branch information
Showing
6 changed files
with
144 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1479,8 +1479,17 @@ fn patch_in_virtual() { | |
.file("foo/src/lib.rs", r#""#) | ||
.build(); | ||
|
||
p.cargo("check").run(); | ||
p.cargo("check") | ||
p.cargo("check -p foo") | ||
.with_stderr_data(str![[r#" | ||
[UPDATING] `dummy-registry` index | ||
[LOCKING] 1 package to latest compatible version | ||
[CHECKING] bar v0.1.0 ([ROOT]/foo/bar) | ||
[CHECKING] foo v0.1.0 ([ROOT]/foo/foo) | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
"#]]) | ||
.run(); | ||
p.cargo("check -p foo") | ||
.with_stderr_data(str![[r#" | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
@@ -3029,7 +3038,7 @@ foo v0.0.0 ([ROOT]/foo) | |
} | ||
|
||
#[cargo_test] | ||
fn patch_with_base() { | ||
fn patch_in_real_with_base() { | ||
let bar = project() | ||
.at("bar") | ||
.file("Cargo.toml", &basic_manifest("bar", "0.5.0")) | ||
|
@@ -3069,7 +3078,70 @@ fn patch_with_base() { | |
.file("src/lib.rs", "use bar::hello as _;") | ||
.build(); | ||
|
||
p.cargo("build -v") | ||
p.cargo("tree") | ||
.masquerade_as_nightly_cargo(&["path-bases"]) | ||
.with_stdout_data(str![[r#" | ||
foo v0.5.0 ([ROOT]/foo) | ||
└── bar v0.5.0 ([ROOT]/bar) | ||
"#]]) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn patch_in_virtual_with_base() { | ||
let bar = project() | ||
.at("bar") | ||
.file("Cargo.toml", &basic_manifest("bar", "0.5.0")) | ||
.file("src/lib.rs", "pub fn hello() {}") | ||
.build(); | ||
Package::new("bar", "0.5.0").publish(); | ||
|
||
let p = project() | ||
.file( | ||
".cargo/config.toml", | ||
&format!( | ||
r#" | ||
[path-bases] | ||
test = '{}' | ||
"#, | ||
bar.root().parent().unwrap().display() | ||
), | ||
) | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
cargo-features = ["path-bases"] | ||
[workspace] | ||
members = ["foo"] | ||
[patch.crates-io] | ||
bar = { base = 'test', path = 'bar' } | ||
"#, | ||
) | ||
.file( | ||
"foo/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
edition = "2018" | ||
[dependencies] | ||
bar = "0.5.0" | ||
"#, | ||
) | ||
.file("foo/src/lib.rs", "use bar::hello as _;") | ||
.build(); | ||
|
||
p.cargo("tree") | ||
.masquerade_as_nightly_cargo(&["path-bases"]) | ||
.with_stdout_data(str![[r#" | ||
foo v0.5.0 ([ROOT]/foo/foo) | ||
└── bar v0.5.0 ([ROOT]/bar) | ||
"#]]) | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters