android: Bring back git hash version name
This commit is contained in:
parent
894fdd06a3
commit
a0d2462905
@ -33,6 +33,7 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
versionCode autoVersion
|
||||
versionName getVersion()
|
||||
ndk.abiFilters abiFilter
|
||||
}
|
||||
|
||||
@ -122,3 +123,17 @@ dependencies {
|
||||
|
||||
implementation 'com.android.billingclient:billing:2.2.0'
|
||||
}
|
||||
|
||||
def getVersion() {
|
||||
def versionName = '0.0'
|
||||
|
||||
try {
|
||||
versionName = 'git describe --always --long'.execute([], project.rootDir).text
|
||||
.trim()
|
||||
.replaceAll(/(-0)?-[^-]+$/, "")
|
||||
} catch (Exception e) {
|
||||
logger.error('Cannot find git, defaulting to dummy version number')
|
||||
}
|
||||
|
||||
return versionName
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user