Android auto version code
This commit is contained in:
parent
b0772fe2f0
commit
6b7e1679cc
@ -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 {
|
||||
compileSdkVersion = rootProject.ext.compileApi
|
||||
buildToolsVersion = rootProject.ext.toolsVersion
|
||||
@ -9,8 +20,8 @@ android {
|
||||
minSdkVersion rootProject.ext.minApi
|
||||
targetSdkVersion rootProject.ext.targetApi
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
versionCode = rootProject.ext.versionCode
|
||||
versionName = rootProject.ext.versionName
|
||||
versionName = androidGitVersion.name()
|
||||
versionCode = androidGitVersion.code()
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
@ -18,26 +18,13 @@ if (!hasProperty('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 {
|
||||
versionName = properties.get('VERSION_NAME', getVersionName())
|
||||
versionCode = properties.get('VERSION_CODE', 100)
|
||||
compileApi = properties.get('COMPILE_API', 31)
|
||||
targetApi = properties.get('TARGET_API', 31)
|
||||
minApi = properties.get('MIN_API', 23)
|
||||
toolsVersion = properties.get('TOOLS_VERSION', '31.0.0')
|
||||
|
||||
println '----------------- Project configuration -------------------'
|
||||
println 'VERSION_NAME: ' + versionName
|
||||
println 'VERSION_CODE: ' + versionCode
|
||||
println 'RELEASE_STORE_FILE: ' + RELEASE_STORE_FILE
|
||||
println 'RELEASE_KEY_ALIAS: ' + RELEASE_KEY_ALIAS
|
||||
println 'compile API: ' + compileApi
|
||||
|
Loading…
Reference in New Issue
Block a user