Skip to content

Commit

Permalink
Merge pull request #224 from oli-obk/nonzer
Browse files Browse the repository at this point in the history
Check path dependencies for path, not version
  • Loading branch information
oli-obk authored May 1, 2024
2 parents 4bfbbb8 + 0f6aa49 commit 4dc2e2f
Show file tree
Hide file tree
Showing 9 changed files with 918 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,18 @@ fn build_dependencies_inner(config: &Config, info: &DependencyBuilder) -> Result
None => true,
})
.map(|dep| {
let package = metadata
.packages
.iter()
.find(|&p| p.name == dep.name && dep.req.matches(&p.version))
.expect("dependency does not exist");
(
package,
dep.rename.clone().unwrap_or_else(|| package.name.clone()),
)
for p in &metadata.packages {
if p.name != dep.name {
continue;
}
if dep.path.as_ref().is_some_and(|path| p.manifest_path.parent().unwrap() == path) || dep.req.matches(&p.version) {
return (
p,
dep.rename.clone().unwrap_or_else(|| p.name.clone()),
)
}
}
panic!("dep not found: {dep:#?}")
})
// Also expose the root crate
.chain(std::iter::once((root, root.name.clone())))
Expand Down
Loading

0 comments on commit 4dc2e2f

Please sign in to comment.