Skip to content

Commit

Permalink
Fix crate pruning (#61)
Browse files Browse the repository at this point in the history
* Oops

* Add test for #60

* Refactor graph building

Previously the graph was built by going from each root package to each of its dependencies recursively until all packages that were referenced were visited. This mostly worked fine, however had issues, namely #60, that were caused by there being tension between our view of the graph and cargo metadata's. `cargo metadata` presents a "complete" view of a graph, however if a user requested only packages for specific platforms or only of specific kinds, we were still including features that `cargo metadata` had resolved with its complete view of the graph, even if those features were only enabled by an edge that was otherwise pruned.

So now, we just does our own resolution by recursively walking each package + feature combination rooted at the features enabled on each root crate which allows us to accurately prune nodes as we go rather than doing complicated fixup passes or the like

* Update

* Fix lint

* Don't use path deps

* Normalize paths
  • Loading branch information
Jake-Shadle committed Jan 12, 2024
1 parent 96af626 commit b583d96
Show file tree
Hide file tree
Showing 38 changed files with 3,701 additions and 1,826 deletions.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ targets = ["cfg-expr/targets"]

[dependencies]
# Used for acquiring and/or deserializing `cargo metadata` output
cargo_metadata = "0.17"
cargo_metadata = "0.18"
# Used to parse and evaluate cfg() expressions for dependencies
cfg-expr = "0.15"
# Used to create and traverse graph structures
Expand All @@ -41,4 +41,10 @@ similar-asserts = "1.1"
# Used to deserialize test files into metadata we can load
serde_json = "1.0"
# index metadata retrieval
tame-index = "0.5"
tame-index = "0.9"

[profile.dev.package.insta]
opt-level = 3

[profile.dev.package.similar]
opt-level = 3

0 comments on commit b583d96

Please sign in to comment.