Trying to handle app versionning from git tag.

This commit is contained in:
Amine Bou 2017-07-28 10:07:12 +02:00 committed by root
parent 8306860f90
commit acf6995c2d

View File

@ -8,6 +8,19 @@ buildscript {
} }
} }
def gitVersion() {
def process = "git describe --abbrev=0 --tags".execute()
return process.text.substring(1).replaceAll("\\.", "")
}
def versionCodeFromGit() {
return gitVersion().toInteger()
}
def versionNameFromGit() {
return gitVersion().trim()
}
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'io.fabric' apply plugin: 'io.fabric'
@ -25,8 +38,8 @@ android {
applicationId "apps.amine.bou.readerforselfoss" applicationId "apps.amine.bou.readerforselfoss"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 26 targetSdkVersion 26
versionCode 15110 versionCode versionCodeFromGit()
versionName "1.5.1.10" versionName versionNameFromGit()
// Enabling multidex support. // Enabling multidex support.
multiDexEnabled true multiDexEnabled true
@ -170,4 +183,4 @@ def initAppLoginPropertiesIfNeeded() {
entry(key: "appLoginPassword", value: System.getProperty("appLoginPassword")) entry(key: "appLoginPassword", value: System.getProperty("appLoginPassword"))
} }
} }
} }