Skip to content

Commit 4680de9

Browse files
fix(wash-cli): multiple generated dependencies collision in project
This commit fixes a bug in the workspace-aware project dependency gathering that caused dependencies to override each other under the same project. Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
1 parent 853105c commit 4680de9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/wash-cli/src/dev.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ struct ProjectDeps {
536536
pub(crate) session_id: Option<String>,
537537

538538
/// Lookup of dependencies by project key, with lookups into the pool
539-
dependencies: HashMap<ProjectDependencyKey, DependencySpec>,
539+
dependencies: HashMap<ProjectDependencyKey, Vec<DependencySpec>>,
540540

541541
/// The component to which dependencies belong
542542
///
@@ -581,7 +581,7 @@ impl ProjectDeps {
581581
deps: impl IntoIterator<Item = (ProjectDependencyKey, DependencySpec)>,
582582
) -> Result<()> {
583583
for (pkey, dep) in deps.into_iter() {
584-
self.dependencies.insert(pkey, dep);
584+
self.dependencies.entry(pkey).or_default().push(dep);
585585
}
586586
Ok(())
587587
}
@@ -632,7 +632,7 @@ impl ProjectDeps {
632632
let mut components = Vec::new();
633633

634634
// For each dependency, go through and generate the component along with necessary links
635-
for dep in self.dependencies.values() {
635+
for dep in self.dependencies.values().flatten() {
636636
let dep = dep.clone();
637637
let mut dep_component = dep
638638
.generate_component(session_id)

0 commit comments

Comments
 (0)