forked from upstream-mirrors/OpenTracks
Change versionCode for nightlies to commit count
This commit is contained in:
+12
-5
@@ -30,10 +30,17 @@ def getVersionName = { ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def versionCodeFromDate = { ->
|
def getVersionCode = { ->
|
||||||
def date = new Date()
|
try {
|
||||||
def formattedDate = date.format('yyyyMMdd')
|
def stdout = new ByteArrayOutputStream()
|
||||||
return Integer.valueOf(formattedDate)
|
exec {
|
||||||
|
commandLine 'git', 'rev-list', 'HEAD', '--count'
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
return Integer.valueOf(stdout.toString().trim())
|
||||||
|
} catch (ignored) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -105,7 +112,7 @@ android {
|
|||||||
|
|
||||||
if (variant.buildType.name == 'nightly') {
|
if (variant.buildType.name == 'nightly') {
|
||||||
variant.outputs.all {
|
variant.outputs.all {
|
||||||
setVersionCodeOverride(versionCodeFromDate())
|
setVersionCodeOverride(getVersionCode())
|
||||||
setVersionNameOverride(getVersionName())
|
setVersionNameOverride(getVersionName())
|
||||||
outputFileName = "${applicationId}_${variant.versionCode}.apk"
|
outputFileName = "${applicationId}_${variant.versionCode}.apk"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user