diff --git a/.idea/dictionaries/bmarty.xml b/.idea/dictionaries/bmarty.xml
index 10c12796c0..680a1d57cf 100644
--- a/.idea/dictionaries/bmarty.xml
+++ b/.idea/dictionaries/bmarty.xml
@@ -9,6 +9,8 @@
decryptor
emoji
emojis
+ fdroid
+ gplay
hmac
ktlint
linkified
diff --git a/CHANGES.md b/CHANGES.md
index 965d3112d4..7a39b8021d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -18,6 +18,7 @@ Translations 🗣:
Build 🧱:
- Ensure builds are reproducible (#842)
+ - F-Droid: fix the "-dev" issue in version name (#815)
Changes in RiotX 0.13.0 (2020-01-17)
===================================================
diff --git a/vector/build.gradle b/vector/build.gradle
index a7a0d4afe8..26fad1bdaf 100644
--- a/vector/build.gradle
+++ b/vector/build.gradle
@@ -27,7 +27,7 @@ static def generateVersionCodeFromTimestamp() {
// It's unix timestamp, minus timestamp of October 3rd 2018 (first commit date) divided by 100: It's incremented by one every 100 seconds.
// plus 20_000_000 for compatibility reason with the previous way the Version Code was computed
// Note that the result will be multiplied by 10 when adding the digit for the arch
- return ((getGitTimestamp() - 1_538_524_800 ) / 100).toInteger() + 20_000_000
+ return ((getGitTimestamp() - 1_538_524_800) / 100).toInteger() + 20_000_000
}
def generateVersionCodeFromVersionName() {
@@ -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\""