mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
track deps in project model
This commit is contained in:
parent
34956b7823
commit
32c067f8c9
@ -28,6 +28,7 @@ struct PackageData {
|
||||
manifest: PathBuf,
|
||||
targets: Vec<Target>,
|
||||
is_member: bool,
|
||||
dependencies: Vec<Package>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -106,6 +107,7 @@ impl CargoWorkspace {
|
||||
manifest: PathBuf::from(meta_pkg.manifest_path),
|
||||
targets: Vec::new(),
|
||||
is_member,
|
||||
dependencies: Vec::new(),
|
||||
};
|
||||
for meta_tgt in meta_pkg.targets {
|
||||
let tgt = Target(targets.len());
|
||||
@ -119,6 +121,14 @@ impl CargoWorkspace {
|
||||
}
|
||||
packages.push(pkg_data)
|
||||
}
|
||||
let resolve = meta.resolve.expect("metadata executed with deps");
|
||||
for node in resolve.nodes {
|
||||
let source = pkg_by_id[&node.id];
|
||||
for id in node.dependencies {
|
||||
let target = pkg_by_id[&id];
|
||||
packages[source.0].dependencies.push(target);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(CargoWorkspace { packages, targets })
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user