fix update manager

This commit is contained in:
Li ZongYing
2024-03-18 18:29:56 +08:00
parent 06b8df5f82
commit 7b0e144cb1
21 changed files with 275 additions and 236 deletions
+9 -4
View File
@@ -54,7 +54,7 @@ android {
}
kotlinOptions {
jvmTarget=17
jvmTarget = 17
}
// Encapsulates your external native build configurations.
@@ -71,9 +71,14 @@ android {
static def VersionCode() {
try {
def process = 'git rev-list --count HEAD'.execute()
def p = "git describe --tags --always"
def process = p.execute()
process.waitFor()
return process.text.toInteger()
def replace = [v: "", ".": " ", "-": " "]
def arr = (process.text.trim().replace(replace) + " 0").split(" ")
def versionCode = arr[0].toInteger() * 16777216 + arr[1].toInteger() * 65536 + arr[2].toInteger() * 256 + arr[3].toInteger()
println("VersionCode $versionCode")
return versionCode
} catch (ignored) {
return 0
}
@@ -81,7 +86,7 @@ static def VersionCode() {
static def VersionName() {
try {
def process = 'git describe --tags --always'.execute()
def process = "git describe --tags --always".execute()
process.waitFor()
return process.text.trim() - "v"
} catch (ignored) {