fix: wrapper should only consider release types that are a higher priority than the wrapper version when packaged #15052
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.
@matrei had a ClassNotFoundException thrown when testing the 7.0.0-RC2 wrapper locally. Upon researching the problem, the cause was he had an old snapshot version under the directory we download grails releases to. The reason this was a problem is we were returning snapshot builds as eligible & the wrapper assumes snapshots are more up to date than a release.
This line is the problem:
grails-core/grails-wrapper/src/main/java/grails/init/Start.java
Line 151 in 2cb067e
That code should only return release types later than the version of the packaged wrapper:
I wanted to add test coverage to the wrapper though, so I've refactored the helper methods for preferred version & allowed types to make this easier to test. The test "allowed release types - no preferred version - non-development for non-release" makes sure this issue doesn't happen in the future.
With the refactoring, the jar size is 30KB, which is still smaller than the gradle wrapper size (44KB) so I'm considering the extra classes as an acceptable.