Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Grails 5.0.0-SNAPSHOT string #1464

Merged
merged 2 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handle Grails 5.0.0-SNAPSHOT string
Extended GrailsVersion and Snapshot classes to property handle string "5.0.0-SNAPSHOT" alongwith "5.0.0.BUILD-SNAPSHOT".
Fixes #1463
  • Loading branch information
puneetbehl committed Jun 6, 2021
commit aab1dbaba44709461f53172935b587c1da121e19
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ class GrailsVersion implements Comparable<GrailsVersion> {
String[] parts = version.split("\\.")
if (parts.length >= 3) {
this.versionText = version
this.major = parts[0].toInteger()
this.minor = parts[1].toInteger()
if (parts.length > 3) {
this.snapshot = new Snapshot(parts[3])
} else if (parts[2].contains('-')) {
String[] subParts = parts[2].split("-")
this.patch = subParts.first() as int
this.snapshot = new Snapshot(subParts[1..-1].join("-"))
} else {
this.patch = parts[2].toInteger()
}
this.major = parts[0].toInteger()
this.minor = parts[1].toInteger()
this.patch = parts[2].toInteger()
} else {
throw new IllegalArgumentException("GrailsVersion only supports comparison of versions with 3 or 4 parts")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import groovy.transform.EqualsAndHashCode
@EqualsAndHashCode(includes = ['text'])
class Snapshot implements Comparable<Snapshot> {

private static final String BUILD_SNAPSHOT = "BUILD-SNAPSHOT"
private static final String SNAPSHOT = "SNAPSHOT"
private static final String RC = "RC"
private static final String MILESTONE = "M"

Expand All @@ -32,7 +32,7 @@ class Snapshot implements Comparable<Snapshot> {
}

boolean isBuildSnapshot() {
text == BUILD_SNAPSHOT
text.endsWith(SNAPSHOT)
}

boolean isReleaseCandidate() {
Expand Down