Skip to content

Commit

Permalink
Bump cargo-manifest to 0.18 (#289)
Browse files Browse the repository at this point in the history
Allow packages using resolver v3 to be built by `cargo-chef`
  • Loading branch information
coolreader18 authored Jan 12, 2025
1 parent a228626 commit 6b08996
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 61 deletions.
40 changes: 30 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env_logger = "0.10"
globwalk = "0.8.0"
anyhow = "1.0.33"
pathdiff = "0.2.0"
cargo-manifest = "0.14"
cargo-manifest = "0.18"
fs-err = "2.5.0"
toml = { version = "0.8", features = ["preserve_order"] }
expect-test = "1.1.0"
Expand Down
11 changes: 4 additions & 7 deletions src/skeleton/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,11 @@ fn panic(_: &core::panic::PanicInfo) -> ! {
let parsed_manifest =
cargo_manifest::Manifest::from_slice(manifest.contents.as_bytes())?;

let is_harness = |products: &Option<Vec<Product>>, name: &str| -> bool {
let is_harness = |products: &[Product], name: &str| -> bool {
products
.as_ref()
.and_then(|v| {
v.iter()
.find(|product| product.name.as_deref() == Some(name))
.map(|p| p.harness)
})
.iter()
.find(|product| product.name.as_deref() == Some(name))
.map(|p| p.harness)
.unwrap_or(true)
};

Expand Down
59 changes: 16 additions & 43 deletions tests/skeletons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,14 @@ version = "1.8.1"
check(
&second.contents,
expect_test::expect![[r#"
bench = []
test = []
example = []
[[bin]]
path = "src/main.rs"
name = "test-dummy"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["bin"]
[package]
name = "project-a"
Expand All @@ -692,11 +690,6 @@ version = "1.8.1"
check(
&third.contents,
expect_test::expect![[r#"
bin = []
bench = []
test = []
example = []
[package]
name = "project_b"
edition = "2018"
Expand All @@ -710,8 +703,11 @@ version = "1.8.1"
path = "../project-a"
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["cdylib"]
"#]],
Expand Down Expand Up @@ -857,16 +853,14 @@ version = "1.8.1"
check(
&second.contents,
expect_test::expect![[r#"
bench = []
test = []
example = []
[[bin]]
path = "src/main.rs"
name = "test-dummy"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["bin"]
[package]
name = "project_a"
Expand All @@ -881,11 +875,6 @@ version = "1.8.1"
check(
&third.contents,
expect_test::expect![[r#"
bin = []
bench = []
test = []
example = []
[package]
name = "project_b"
edition = "2018"
Expand All @@ -894,8 +883,11 @@ version = "1.8.1"
[dependencies]
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
edition = "2018"
required-features = []
crate-type = ["cdylib"]
"#]],
Expand Down Expand Up @@ -1019,17 +1011,14 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
check(
&second.contents,
expect_test::expect![[r#"
bench = []
test = []
example = []
[[bin]]
path = "src/main.rs"
name = "binary"
plugin = false
proc-macro = false
edition = "2021"
required-features = []
crate-type = ["bin"]
[package]
name = "binary"
Expand All @@ -1049,11 +1038,6 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
check(
&third.contents,
expect_test::expect![[r#"
bin = []
bench = []
test = []
example = []
[package]
name = "without"
edition = "2021"
Expand All @@ -1068,7 +1052,7 @@ checksum = "3df10e9ed85b51fa3434bc5676eaa90479ce14ac3e101c8ce07e1bb5ef0b7255"
proc-macro = false
edition = "2021"
required-features = []
crate-type = ["rlib"]
crate-type = ["lib"]
"#]],
);
}
Expand Down Expand Up @@ -1302,16 +1286,13 @@ anyhow = { workspace = true }
check(
&second.contents,
expect_test::expect![[r#"
bench = []
test = []
example = []
[[bin]]
path = "src/main.rs"
name = "project_a"
plugin = false
proc-macro = false
required-features = []
crate-type = ["bin"]
[package]
name = "project_a"
Expand All @@ -1334,11 +1315,6 @@ anyhow = { workspace = true }
check(
&third.contents,
expect_test::expect![[r#"
bin = []
bench = []
test = []
example = []
[package]
name = "project_b"
Expand All @@ -1358,6 +1334,8 @@ anyhow = { workspace = true }
workspace = true
[lib]
path = "src/lib.rs"
name = "project_b"
plugin = false
proc-macro = false
required-features = []
Expand Down Expand Up @@ -1450,11 +1428,6 @@ version = "0.2.1"
check(
&skeleton.manifests[1].contents,
expect![[r#"
bin = []
bench = []
test = []
example = []
[package]
name = "a"
version = "0.0.1"
Expand All @@ -1470,7 +1443,7 @@ version = "0.2.1"
plugin = false
proc-macro = false
required-features = []
crate-type = ["rlib"]
crate-type = ["lib"]
"#]],
);
}
Expand Down

0 comments on commit 6b08996

Please sign in to comment.