This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 691
[12/x][move-package/lock] Use DependencyGraph in download_dependency_repos #788
Open
amnn
wants to merge
10
commits into
move-language:main
Choose a base branch
from
amnn:lock-12-download-deps
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are a couple of potential future improvements to package fetching that I haven't planned for this stack, but are probably worth doing in the limit (I will create issues for these):
|
This was referenced Jan 2, 2023
8e0295e
to
b9e8938
Compare
The initial design of `DependencyGraph` only allowed for one `addr_subst` and `digest` per package in the transitive dependency graph, but in actuality there can be as many of these as there are dependency edges to that package: - Different `addr_subst` for different packages `P`, `Q` depending on `R` allows the same address in `R` to appear as different addresses in `P` and `Q`. - If `R` is a dependency of `P` and a dev-dependency of `Q`, then its source digest may differ between the two. Fixed by moving the `subst` and `digest` to be edge labels in the graph, rather than node labels. Note that this also changes the lock file format in the following ways: - A package's dependencies are now no longer just the name of the dependency, but an inline table containing the name and optionally the digest and address substitution. - The key within the `move` table that contains all the transitive dependencies is now called `package` rather than `dependency` (this was mainly driven by the naming within the schema, which required a name for the new, richer format for a package's dependencies.) Test Plan: ``` move/language/tools/move-cli$ cargo nextest move/language/tools/move-package$ cargo nextest ```
Function to return a package's immediate dependencies in the transitive dependency graph, for use by `ResolutionGraph` when resolving renamings and in-scope addresses during resolution Test Plan: New tests: ``` move/language/tools/move-package$ cargo nextest ```
Extract the logic for unifying named addresses across address assignments, substitutions and renamings from `ResolvingGraph` into its own class -- `ResolvingTable`. This is to be used when integrating `DependencyGraph` into `ResolutionGraph`. Test Plan: New unit tests: ``` move/language/tools/move-package$ cargo nextest ```
b9e8938
to
2db2efb
Compare
Integrate `DependencyGraph` and `ResolvingTable` into the creation of `ResolvedGraph`. This change replaces the recursive dependency traversal logic of `ResolutionGraph` that `DependencyGraph` was based on with a linear traversal of the package's transitive dependencies, extracted from an existing `DependencyGraph`. This is part of the preparation for integrating third-party package managers into the package resolution process: They can now inject further transitive dependencies into the DependencyGraph which will be fetched during resolution to create the `ResolvedGraph`. Although some error message wording changes (particularly where it previously relied on recursive calls for building up error context), the logic is otherwise unchanged. Test Plan: Existing test cases: ``` move$ cargo-nextest nextest run -E 'package(move-cli) | package(move-package)' ```
Update the README to reflect the inclusion of `DependencyGraph`, `LockFile`, and `ResolvingTable`.
…repos Another occasion where the previous implementation recursively traversed the transitive dependency graph -- the new approach discovers the graph and then iterates through its nodes to download them. The second step is currently technically unnecessary, but becomes relevant in the presence of externally resolved dependencies where third-party resolvers can introduce sub-graphs into the `DependencyGraph` without having to explore them locally. Test Plan: ``` move/language/tools/move-package$ cargo nextest ```
2db2efb
to
05e213a
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another occasion where the previous implementation recursively traversed the transitive dependency graph -- the new approach discovers the graph and then iterates through its nodes to download them.
The second step is currently technically unnecessary, but becomes relevant in the presence of externally resolved dependencies where third-party resolvers can introduce sub-graphs into the
DependencyGraph
without having to explore them locally.Test Plan
Stack