Fix: windows package version from git tags
This commit is contained in:
parent
183467fddd
commit
1a4854743d
1 changed files with 12 additions and 6 deletions
|
|
@ -170,8 +170,9 @@ compose.desktop {
|
|||
packageVersion = debianVersion
|
||||
iconFile.set(project.file("icons/icon-linux.png"))
|
||||
shortcut = true
|
||||
appCategory = "AudioVideo"
|
||||
appCategory = "Qt;KDE;Audio;"
|
||||
debMaintainer = "feufar.ooo"
|
||||
packageName = "feufar.ooo"
|
||||
}
|
||||
buildTypes.release.proguard {
|
||||
isEnabled.set(false)
|
||||
|
|
@ -284,12 +285,17 @@ fun getCleanDesktopVersion(versionName: String): String {
|
|||
|
||||
fun getWindowsVersion(rawVersion: String): String {
|
||||
val cleanVersion = rawVersion.trimStart('v', 'V')
|
||||
val numbers = Regex("""\d+""").findAll(cleanVersion).map { it.value.toLong() }.toList()
|
||||
val major = numbers.getOrNull(0)?.coerceIn(0, 255) ?: 1
|
||||
val minor = numbers.getOrNull(1)?.coerceIn(0, 255) ?: 0
|
||||
val build = gitVersionCode.coerceIn(0, 65535)
|
||||
val semverRegex = Regex("""^(\d+)(?:\.(\d+))?(?:\.(\d+))?""")
|
||||
val match = semverRegex.find(cleanVersion)
|
||||
|
||||
return "$major.$minor.$build"
|
||||
return if (match != null) {
|
||||
val major = match.groupValues[1].ifEmpty { "0" }
|
||||
val minor = match.groupValues[2].ifEmpty { "0" }
|
||||
val build = match.groupValues[3].ifEmpty { "0" }
|
||||
"$major.$minor.$build"
|
||||
} else {
|
||||
"0.0.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
fun getDebianVersion(rawVersion: String): String {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue