move-language / move

Apache License 2.0
2.26k stars 689 forks source link

sui-move: [13/x][move-package/lock] Externally resolved dependencies #860

Closed amnn closed 1 year ago

amnn commented 1 year ago

Adds support for dependencies that are resolved by calling out to third-party binaries. The invocation is expected to return the transitive dependency sub-graph as a lock file, which is deserialized and merged into the main graph.

Externally resolved dependencies can appear in manifests but not lock files, and it is an error for a package to appear in the outputs of multiple resolvers (including the internal resolver). To differentiate this case from the previous case where the internal resolver encounters the same package via another path, packages in the DependencyGraph track their resolver via an optional field (None for internally resolved packages).

Another consequence of this change is that the check that a dependency's name matches its package name moves from the creation of DependencyGraph to the creation of ResolvedGraph, to pick up cases where the name mismatch occurs in an externally resolved dependency.

Clean-ups

Test Plan

New tests, including unit tests for the merging operation, and snapshot tests for external resolution lock file and resolved graph output:

move/language/tools/move-package$ cargo nextest

Stack

See also: #789 for main.