改为语义化版本号

This commit is contained in:
HapeLee committed 2025-09-30 02:02:36 +08:00
1 parent df23b58d9d
commit c7ecc073ab
2 files changed
+50 -12

No files matched your search

+25 -7
View File
@@ -15,14 +15,31 @@ plugins {
}
apply from: 'download.gradle'
static def releaseTime() {
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8"))
ext {
versionMajor = 3
versionMinor = 25
versionPatch = 9
}
def name = "legado"
def version = "3." + releaseTime()
def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim())
ext.versionBuild = gitCommits
ext.versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
def getGitCommitHash() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception ignored) {
return "unknown"
}
}
android {
compileSdk = compile_sdk_version
namespace 'io.legato.kazusa'
@@ -52,9 +69,9 @@ android {
minSdk 26
targetSdk 36
versionCode 10000 + gitCommits
versionName version
versionName project.ext.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
project.ext.set("archivesBaseName", name + "_" + version)
project.ext.set("archivesBaseName", name + "_" + versionName)
buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
buildConfigField "String", "Cronet_Main_Version", "\"$CronetMainVersion\""
@@ -98,7 +115,7 @@ android {
manifestPlaceholders.put("app_name", "@string/app_name")
//applicationIdSuffix '.debug'
versionNameSuffix 'debug'
versionNameSuffix "_debug-${getGitCommitHash()}"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'cronet-proguard-rules.pro'
}
@@ -127,7 +144,8 @@ android {
variant.outputs.configureEach { output ->
def abi = output.getFilter(com.android.build.OutputFile.ABI)
def flavor = variant.productFlavors[0].name
def apkName = "${name}_${flavor}_${defaultConfig.versionName}"
def baseVersionName = variant.versionName
def apkName = "${name}_${flavor}_${baseVersionName}"
if (abi != null) {
apkName += "_${abi}"
}