mirror of
https://github.com/gradle/actions.git
synced 2026-09-10 19:28:33 +08:00
Report EOL and maintenance status for Gradle versions
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export class GradleVersion {
|
||||
static PATTERN = /((\d+)(\.\d+)+)(-([a-z]+)-(\w+))?(-(SNAPSHOT|\d{14}([-+]\d{4})?))?/
|
||||
|
||||
major: number
|
||||
versionPart: string
|
||||
stagePart: string
|
||||
snapshotPart: string
|
||||
|
||||
constructor(readonly version: string) {
|
||||
const matcher = GradleVersion.PATTERN.exec(version)
|
||||
if (!matcher) {
|
||||
throw new Error(`'${version}' is not a valid Gradle version string (examples: '1.0', '1.0-rc-1')`)
|
||||
}
|
||||
|
||||
this.major = Number(matcher[2])
|
||||
this.versionPart = matcher[1]
|
||||
this.stagePart = matcher[4]
|
||||
this.snapshotPart = matcher[7]
|
||||
}
|
||||
|
||||
isFinalRelease(): boolean {
|
||||
return !this.stagePart && !this.snapshotPart
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user