Automate version code generation.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user