You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use krates::{Builder, Cmd, Krates, cm, petgraph};
fn main() -> Result<(), krates::Error> {
let mut cmd = Cmd::new();
cmd.manifest_path("/home/fedora/twoliter/Cargo.toml");
// Enable all features, works for either an entire workspace or a single crate
cmd.all_features();
let mut builder = Builder::new();
// Let's filter out any crates that aren't used by x86_64 windows
let krates: Krates = builder.build(cmd, |pkg: cm::Package| {
println!("Crate {} was filtered out", pkg.id);
})?;
// Print a dot graph of the entire crate graph
println!("{:?}", petgraph::dot::Dot::new(krates.graph()));
Ok(())
}
Cargo.toml:
[package]
name = "cargo-metadata"
version = "0.1.0"
edition = "2021"
[dependencies]
krates = "0.18"
Can see that this error in parsing the cargo metadata JSON is coming from the artifact object - I verified this is the first occurrence of artifact in the JSON.
Expected behavior
Expected behavior is that cargo metadata JSON can be parsed.
Downgrade krates, still point this example at twoliter's manifest:
[package]
name = "cargo-metadata"
version = "0.1.0"
edition = "2021"
[dependencies]
krates = "0.17"
$ cargo run
<expected output>
Test krates 0.18.0 on a project that does not declare binary artifacts:
Point manifest path to such a project (like tough): cmd.manifest_path("/home/fedora/tough/Cargo.toml");
Set krates = "0.18.0" in Cargo.toml of this example crate
cargo run results in expected output
Screenshots
n/a
Device:
OS:
$ uname -a
Linux btlrkt 6.11.10-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Nov 23 00:53:13 UTC 2024 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered:
Describe the bug
twoliter is a build tool used by the Bottlerocket project. The tool uses artifact dependency declarations, which is an unstable feature provided in nightly rust toolchains. In bottlerocket-os/twoliter#467, our CI has updated
cargo-deny
to the latest release, which pulls inkrates 0.18.0
.Running
cargo deny
in our project now fails with the following:I've narrowed this down to some issue in
krates
0.18.0, see below reproduction and expected behavior.To Reproduce
Create a new crate and use example from https://github.com/EmbarkStudios/krates?tab=readme-ov-file#usage. Point the manifest path to
twoliter
's Cargo.tomlCargo.toml:
rust-toolchain.toml:
Same error as what
cargo deny
is reporting.Checking what's at this specific byte:
Can see that this error in parsing the cargo metadata JSON is coming from the
artifact
object - I verified this is the first occurrence ofartifact
in the JSON.Expected behavior
Expected behavior is that
cargo metadata
JSON can be parsed.Downgrade
krates
, still point this example attwoliter
's manifest:Test
krates 0.18.0
on a project that does not declare binary artifacts:cmd.manifest_path("/home/fedora/tough/Cargo.toml");
krates = "0.18.0"
in Cargo.toml of this example cratecargo run
results in expected outputScreenshots
n/a
Device:
The text was updated successfully, but these errors were encountered: