Android auto version code

This commit is contained in:
akallabeth 2022-05-13 09:19:28 +02:00
parent b0772fe2f0
commit 6b7e1679cc
2 changed files with 14 additions and 16 deletions

View File

@ -1,5 +1,16 @@
apply plugin: 'com.android.application' plugins {
id 'com.gladed.androidgitversion' version '0.4.4'
}
androidGitVersion {
abis = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'mips':5, 'mips64':6, 'x86':8, 'x86_64':9 ]
prefix ''
}
println 'Version Name: ' + androidGitVersion.name()
println 'Version Code: ' + androidGitVersion.code()
apply plugin: 'com.android.application'
android { android {
compileSdkVersion = rootProject.ext.compileApi compileSdkVersion = rootProject.ext.compileApi
buildToolsVersion = rootProject.ext.toolsVersion buildToolsVersion = rootProject.ext.toolsVersion
@ -9,8 +20,8 @@ android {
minSdkVersion rootProject.ext.minApi minSdkVersion rootProject.ext.minApi
targetSdkVersion rootProject.ext.targetApi targetSdkVersion rootProject.ext.targetApi
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
versionCode = rootProject.ext.versionCode versionName = androidGitVersion.name()
versionName = rootProject.ext.versionName versionCode = androidGitVersion.code()
} }
signingConfigs { signingConfigs {

View File

@ -18,26 +18,13 @@ if (!hasProperty('RELEASE_KEY_PASSWORD')) {
ext.RELEASE_KEY_PASSWORD='' ext.RELEASE_KEY_PASSWORD=''
} }
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
ext { ext {
versionName = properties.get('VERSION_NAME', getVersionName())
versionCode = properties.get('VERSION_CODE', 100)
compileApi = properties.get('COMPILE_API', 31) compileApi = properties.get('COMPILE_API', 31)
targetApi = properties.get('TARGET_API', 31) targetApi = properties.get('TARGET_API', 31)
minApi = properties.get('MIN_API', 23) minApi = properties.get('MIN_API', 23)
toolsVersion = properties.get('TOOLS_VERSION', '31.0.0') toolsVersion = properties.get('TOOLS_VERSION', '31.0.0')
println '----------------- Project configuration -------------------' println '----------------- Project configuration -------------------'
println 'VERSION_NAME: ' + versionName
println 'VERSION_CODE: ' + versionCode
println 'RELEASE_STORE_FILE: ' + RELEASE_STORE_FILE println 'RELEASE_STORE_FILE: ' + RELEASE_STORE_FILE
println 'RELEASE_KEY_ALIAS: ' + RELEASE_KEY_ALIAS println 'RELEASE_KEY_ALIAS: ' + RELEASE_KEY_ALIAS
println 'compile API: ' + compileApi println 'compile API: ' + compileApi