add commitId to debug build

pull/22/head
fengyuecanzhu 3 years ago
parent 9d523ef806
commit fd7ab4cf93
  1. 11
      app/build.gradle

@ -24,7 +24,7 @@ def releaseTime() {
return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+08:00"))
}
def gitCommits = Integer.parseInt('git rev-list HEAD --count'.execute().text.trim())
def commitId = 'git rev-parse --short HEAD'.execute().text.trim()
def getVersionCode() {
def versionCodeFile = file('version_code.properties')
@ -122,14 +122,19 @@ android {
signingConfig signingConfigs.myConifg
}
applicationIdSuffix ".debug"
versionNameSuffix "-" + gitCommits
versionNameSuffix "-" + commitId
ndk {
abiFilters "arm64-v8a"
}
}
android.applicationVariants.all { variant ->
def buildType = variant.buildType.name
def fileName = "${name}v${defaultConfig.versionName}.apk"
if (buildType == "debug"){
fileName = "${name}v${defaultConfig.versionName}-${commitId}.apk"
}
variant.outputs.all {
outputFileName = "${name}v${defaultConfig.versionName}.apk"
outputFileName = fileName
}
}
}

Loading…
Cancel
Save