Safe determining Kotlin/Native meta version
This commit is contained in:
@@ -98,7 +98,7 @@ open class VersionGenerator: DefaultTask() {
|
|||||||
| Regex(""${'"'}([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-(\p{Alpha}\p{Alnum}*))?(?:-([0-9]+))?""${'"'})
|
| Regex(""${'"'}([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-(\p{Alpha}\p{Alnum}*))?(?:-([0-9]+))?""${'"'})
|
||||||
| .matchEntire(this)!!.destructured
|
| .matchEntire(this)!!.destructured
|
||||||
| return KonanVersionImpl(
|
| return KonanVersionImpl(
|
||||||
| MetaVersion.valueOf(meta.toUpperCase()),
|
| MetaVersion.findAppropriate(meta),
|
||||||
| major.toInt(),
|
| major.toInt(),
|
||||||
| minor.toInt(),
|
| minor.toInt(),
|
||||||
| maintenance.toIntOrNull() ?: 0,
|
| maintenance.toIntOrNull() ?: 0,
|
||||||
|
|||||||
@@ -30,5 +30,12 @@ enum class MetaVersion(val metaString: String) {
|
|||||||
BETA("beta"),
|
BETA("beta"),
|
||||||
RC1("rc1"),
|
RC1("rc1"),
|
||||||
RC2("rc2"),
|
RC2("rc2"),
|
||||||
RELEASE("release")
|
RELEASE("release");
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun findAppropriate(metaString: String): MetaVersion {
|
||||||
|
return MetaVersion.values().find { it.metaString.equals(metaString, ignoreCase = true) } ?: RELEASE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user