[Gradle] Fix showing correct app version on debug builds.

This commit is contained in:
Kuba Szczodrzyński 2021-10-29 17:32:05 +02:00
parent 23bd9b8e05
commit 113ecc0ef1
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB
2 changed files with 10 additions and 11 deletions

View File

@ -56,7 +56,7 @@ android {
flavorDimensions "platform"
productFlavors {
main {
versionName gitInfo.versionHuman
versionName "${release.versionName}-${gitInfo.versionSuffix}"
}
official {}
play {}

View File

@ -97,18 +97,17 @@ private def buildGitInfo() {
def tag = getLastTag(repo, git, head)
def tagName = tag[1]
def tagRevCount = tag[2]
def versionName = tagName.replace("v", "")
def result = [
hash : head.objectId.name,
branch : repo.branch,
dirty : dirty,
remotes : remotes,
unstaged : status.uncommittedChanges.join("; "),
tag : tagName,
revCount : tagRevCount,
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
versionHuman: """$versionName-${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
hash : head.objectId.name,
branch : repo.branch,
dirty : dirty,
remotes : remotes,
unstaged : status.uncommittedChanges.join("; "),
tag : tagName,
revCount : tagRevCount,
version : """$tagName-$tagRevCount-g${head.objectId.name.substring(0, 8)}""" + (dirty ? ".dirty" : ""),
versionSuffix : """${repo.branch.replace("/", "_")}""" + (dirty ? ".dirty" : "")
]
return result
}