feat: use Semver compatibility for dependency info#101
Merged
skaldarnar merged 2 commits intorelease/v7.xfrom Apr 22, 2021
Merged
feat: use Semver compatibility for dependency info#101skaldarnar merged 2 commits intorelease/v7.xfrom
skaldarnar merged 2 commits intorelease/v7.xfrom
Conversation
keturn
commented
Apr 20, 2021
...-module/src/main/java/org/terasology/gestalt/module/dependencyresolution/DependencyInfo.java
Show resolved
Hide resolved
gestalt-module/src/main/java/org/terasology/gestalt/naming/SemverExpression.java
Show resolved
Hide resolved
|
|
||
| public SemverExpression(String source) { | ||
| this.source = source; | ||
| this.expression = ExpressionParser.newInstance().parse(source); |
Member
Author
There was a problem hiding this comment.
TODO: error handling
or maybe using a documented exception here, and error handling in DependencyInfo?
Member
Author
5 tasks
skaldarnar
approved these changes
Apr 22, 2021
| DependencyInfo info = versionedModule.getMetadata().getDependencyInfo(dependency); | ||
| if (info != null) { | ||
| constraintTable.put(version.getVersion().get(), new CompatibleVersions(info.versionRange(), info.isOptional() && !optionalStrategy.isRequired())); | ||
| constraintTable.put(version.getVersion().get(), new CompatibleVersions(info.versionPredicate(), info.isOptional() && !optionalStrategy.isRequired())); |
Member
There was a problem hiding this comment.
I'd love to have a uniform code formatter...
Member
Author
There was a problem hiding this comment.
what prompted that thought on this line in particular?
Member
There was a problem hiding this comment.
hm, probably the length of that line 🤔
Member
|
I leave the two open questions for later. I do believe that following any common way to define versions would be a reasonable choice (be it similar to npm's advanced range syntax or resembling gradle's version declarations). |
This was referenced Apr 27, 2021
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Version 7 introduced the use of the Semver library (#80) for some functions of version handling. It changed the behavior of
getNextVersionmethods (as mentioned in its PR), and that left DependencyInfo returning an unsatisfiable version range when a module'sminVersiontargets a snapshot. (#100)gestalt/gestalt-module/src/main/java/org/terasology/gestalt/module/dependencyresolution/DependencyInfo.java
Lines 84 to 89 in a51ba07
Rather than try to re-implement the semantics of satisfying semantic versioning in the DependencyInfo and VersionRange classes, I propose using more of the Semver library's methods for this.
This PR is a step in that direction. It keeps the VersionRange class intact to preserve compatibility, but if a DependencyInfo was defined with only a minimal version, instead of building a gestalt.VersionRange for it, we compile a Semver expression that will determine what matches.
Dependencies: #98. If that is not merged yet, you can review using this diff: v7/test/java11...v7/feat/semverComparison
Questions for Review
minVersion, should we allow module metadata to define its own expression?