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 688
[move-package] Support dependency overrides #1023
Open
awelc
wants to merge
10
commits into
sui-move
Choose a base branch
from
aw/dep-override
base: sui-move
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.
Open
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0eeded6
Added dep override parsing and local path normalization
awelc 6312772
[move-package] Support dependency overrides
awelc 9b461a3
Fixed a linting problem
awelc b9870ed
Addressing review comments - round one
awelc aafc655
Addressing review comments - round two
awelc 2ddd632
Refactoring and documentation updates
awelc 2672c71
Finessed some comments
awelc 97267a8
Added more tests and updated comments
awelc 371296b
Removed accidentally added temp files
awelc fa8a38f
Fixed linting errors
awelc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
581 changes: 470 additions & 111 deletions
581
language/tools/move-package/src/resolution/dependency_graph.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
3 changes: 3 additions & 0 deletions
3
language/tools/move-package/tests/test_sources/diamond_problem_dep_conflict/Move.resolved
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Failed to resolve dependencies for package 'Root': Resolving dependencies for package 'B': Conflicting dependencies found: | ||
C = { local = "deps_only/C", version = "2.0.0" } | ||
C = { local = "deps_only/C", version = "1.0.0" } |
7 changes: 7 additions & 0 deletions
7
language/tools/move-package/tests/test_sources/diamond_problem_dep_conflict/Move.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "Root" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
A = { local = "./deps_only/A" } | ||
B = { local = "./deps_only/B" } |
6 changes: 6 additions & 0 deletions
6
.../tools/move-package/tests/test_sources/diamond_problem_dep_conflict/deps_only/A/Move.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "A" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
C = { local = "../C", version = "2.0.0" } |
6 changes: 6 additions & 0 deletions
6
.../tools/move-package/tests/test_sources/diamond_problem_dep_conflict/deps_only/B/Move.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "B" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
C = { local = "../C", version = "1.0.0" } |
3 changes: 3 additions & 0 deletions
3
.../tools/move-package/tests/test_sources/diamond_problem_dep_conflict/deps_only/C/Move.toml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[package] | ||
name = "C" | ||
version = "0.0.0" | ||
3 changes: 3 additions & 0 deletions
3
...tools/move-package/tests/test_sources/diamond_problem_dep_external_conflict/Move.resolved
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Failed to resolve dependencies for package 'Root': Adding dependencies from ../resolvers/successful.sh for dependency 'A' in 'Root': Conflicting dependencies found: | ||
ADep = { local = "deps_only/ADep", version = "1.0.0" } | ||
ADep = { local = "deps_only/ADep" } # Resolved by ../resolvers/successful.sh |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If both
A
andB
agreed on the version ofC
and it didn't match the version thatC
reported, I would expect the build to fail, is that what you've found in practice? If not and the version is just ignored, then we should construct a test case that picks versions ofC
from distinct packages, rather than tweaking the version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These versions are not taken into consideration at all. The only versions taken into consideration are those mentioned in the dependency specification. In other words if
A
depends onC
in the following way:and
B
depends onC
in the following way:or even this way
We'd have a diamond problem if some root package depended both on
A
andB
.Since we rely on versions mentioned in the dependency specification, it did not seem necessary to create different subdirectories for different versions of local dependencies.
I can certainly do that, though, if the current setup is not clear enough (though hopefully not wrong...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recording a conversation we had offline: I think the test set-up here is fine, but it's highlighted a peculiarity with dependency specification (that we treat dependencies as different based on the version field, even though we don't use the version field during dependency resolution), which we should change in future (probably by removing the
version
field).