F-Droid: fix the "-dev" issue in version name (#815)

This commit is contained in:
Benoit Marty 2020-01-20 15:58:12 +01:00
parent d1699279fe
commit f5e6b4b857
3 changed files with 24 additions and 5 deletions

View File

@ -9,6 +9,8 @@
<w>decryptor</w>
<w>emoji</w>
<w>emojis</w>
<w>fdroid</w>
<w>gplay</w>
<w>hmac</w>
<w>ktlint</w>
<w>linkified</w>

View File

@ -17,7 +17,7 @@ Translations 🗣:
-
Build 🧱:
-
- F-Droid: fix the "-dev" issue in version name (#815)
Changes in RiotX 0.13.0 (2020-01-17)
===================================================

View File

@ -66,7 +66,8 @@ static def gitBranchName() {
}
}
static def getVersionSuffix() {
// For Google Play build, build on any other branch than master will have a "-dev" suffix
static def getGplayVersionSuffix() {
if (gitBranchName() == "master") {
return ""
} else {
@ -74,6 +75,20 @@ static def getVersionSuffix() {
}
}
static def gitTag() {
def cmd = "git describe --exact-match --tags"
return cmd.execute().text.trim()
}
// For F-Droid build, build on a not tagged commit will have a "-dev" suffix
static def getFdroidVersionSuffix() {
if (gitTag() == "") {
return "-dev"
} else {
return ""
}
}
project.android.buildTypes.all { buildType ->
buildType.javaCompileOptions.annotationProcessorOptions.arguments =
[
@ -102,8 +117,6 @@ android {
// Other branches (master, features, etc.) will have version code based on application version.
versionCode project.getVersionCode()
versionName "${versionMajor}.${versionMinor}.${versionPatch}${getVersionSuffix()}"
buildConfigField "String", "GIT_REVISION", "\"${gitRevision()}\""
resValue "string", "git_revision", "\"${gitRevision()}\""
@ -190,6 +203,8 @@ android {
gplay {
dimension "store"
versionName "${versionMajor}.${versionMinor}.${versionPatch}${getGplayVersionSuffix()}"
resValue "bool", "isGplay", "true"
buildConfigField "boolean", "ALLOW_FCM_USE", "true"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"G\""
@ -199,6 +214,8 @@ android {
fdroid {
dimension "store"
versionName "${versionMajor}.${versionMinor}.${versionPatch}${getFdroidVersionSuffix()}"
resValue "bool", "isGplay", "false"
buildConfigField "boolean", "ALLOW_FCM_USE", "false"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"F\""