Add dynamic version code.
This commit is contained in:
parent
9941777497
commit
fa2af6dd90
1 changed files with 8 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ android {
|
||||||
applicationId "com.pixelized.biblib"
|
applicationId "com.pixelized.biblib"
|
||||||
minSdk 23
|
minSdk 23
|
||||||
targetSdk 30
|
targetSdk 30
|
||||||
versionCode 1
|
versionCode generateVersionCode()
|
||||||
versionName "0.1.2"
|
versionName "0.1.2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
@ -106,3 +106,10 @@ dependencies {
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.0-beta06"
|
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.0-beta06"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static def generateVersionCode() {
|
||||||
|
def result = "git rev-list HEAD --count".execute().text.trim() //unix
|
||||||
|
if (result.empty) result = "PowerShell -Command git rev-list HEAD --count".execute().text.trim() //windows
|
||||||
|
if (result.empty) throw new RuntimeException("Could not generate versioncode on this platform? Cmd output: ${result.text}")
|
||||||
|
return result.toInteger()
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue