Automate version code generation.

This commit is contained in:
2021-10-09 23:44:16 +01:00
parent 0eee6f58e8
commit 0c0938d651

View File

@@ -36,6 +36,14 @@ String gitHash() {
return githashP.text.trim()
}
Integer gitVersionCode() {
def gitP = 'git rev-list v2..HEAD --count'.execute()
gitP.waitFor()
if (gitP.exitValue())
throw new GradleException("Couldn't extract number of commit after v2.")
return gitP.text.trim().toInteger()
}
String buildDate() {
def builddate = new Date()
return builddate.toString()
@@ -53,8 +61,8 @@ android {
applicationId "org.vostan.banvor"
minSdk 21
targetSdk 31
versionCode 2
versionName "2.2"
versionCode gitVersionCode()
versionName gitVersion()
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "bool", "debug_visible", "false"