mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 09:33:26 +00:00
Unique package by name and version.
This commit is a fixup of a bug I introduced by using a PackageId to refer to a crate when its name conflicts with a dependency. It turns out the package id currently is `name version path` while cargo expects `name:version` as argument.
This commit is contained in:
parent
f696df379a
commit
f643b4b5f5
@ -75,7 +75,7 @@ pub type Target = Idx<TargetData>;
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PackageData {
|
pub struct PackageData {
|
||||||
pub id: String,
|
pub version: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub manifest: PathBuf,
|
pub manifest: PathBuf,
|
||||||
pub targets: Vec<Target>,
|
pub targets: Vec<Target>,
|
||||||
@ -174,14 +174,15 @@ impl CargoWorkspace {
|
|||||||
let ws_members = &meta.workspace_members;
|
let ws_members = &meta.workspace_members;
|
||||||
|
|
||||||
for meta_pkg in meta.packages {
|
for meta_pkg in meta.packages {
|
||||||
let cargo_metadata::Package { id, edition, name, manifest_path, .. } = meta_pkg;
|
let cargo_metadata::Package { id, edition, name, manifest_path, version, .. } =
|
||||||
|
meta_pkg;
|
||||||
let is_member = ws_members.contains(&id);
|
let is_member = ws_members.contains(&id);
|
||||||
let edition = edition
|
let edition = edition
|
||||||
.parse::<Edition>()
|
.parse::<Edition>()
|
||||||
.with_context(|| format!("Failed to parse edition {}", edition))?;
|
.with_context(|| format!("Failed to parse edition {}", edition))?;
|
||||||
let pkg = packages.alloc(PackageData {
|
let pkg = packages.alloc(PackageData {
|
||||||
name,
|
name,
|
||||||
id: id.to_string(),
|
version: version.to_string(),
|
||||||
manifest: manifest_path,
|
manifest: manifest_path,
|
||||||
targets: Vec::new(),
|
targets: Vec::new(),
|
||||||
is_member,
|
is_member,
|
||||||
@ -256,7 +257,7 @@ impl CargoWorkspace {
|
|||||||
if self.is_unique(&*package.name) {
|
if self.is_unique(&*package.name) {
|
||||||
package.name.clone()
|
package.name.clone()
|
||||||
} else {
|
} else {
|
||||||
package.id.clone()
|
format!("{}:{}", package.name, package.version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user