summaryrefslogtreecommitdiff
path: root/platform/android/java/app
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuyakou@gmail.com>2022-09-11 21:33:17 -0700
committerFredia Huya-Kouadio <fhuyakou@gmail.com>2022-09-12 09:47:07 -0700
commit67b38d0ac235c29e1251c381ab800771af1edac2 (patch)
tree6fdf41ae0a9d3652e9b51d243e98743b4cc77b9d /platform/android/java/app
parent200b9cde88da485659a6376266af8e9bf7be186f (diff)
Update the versioning logic for the Godot Android Editor
This is necessary to separate subsequent uploads to the Google Play store as each upload needs to increment the version code.
Diffstat (limited to 'platform/android/java/app')
-rw-r--r--platform/android/java/app/config.gradle26
1 files changed, 23 insertions, 3 deletions
diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle
index fbd97fae0b..0346625e4b 100644
--- a/platform/android/java/app/config.gradle
+++ b/platform/android/java/app/config.gradle
@@ -127,16 +127,36 @@ ext.generateGodotLibraryVersion = { List<String> requiredKeys ->
if (requiredKeys.empty) {
libraryVersionName = map.values().join(".")
try {
+ if (map.containsKey("status")) {
+ int statusCode = 0
+ String statusValue = map["status"]
+ if (statusValue == null) {
+ statusCode = 0
+ } else if (statusValue.startsWith("alpha")) {
+ statusCode = 1
+ } else if (statusValue.startsWith("beta")) {
+ statusCode = 2
+ } else if (statusValue.startsWith("rc")) {
+ statusCode = 3
+ } else if (statusValue.startsWith("stable")) {
+ statusCode = 4
+ } else {
+ statusCode = 0
+ }
+
+ libraryVersionCode = statusCode
+ }
+
if (map.containsKey("patch")) {
- libraryVersionCode = Integer.parseInt(map["patch"])
+ libraryVersionCode += Integer.parseInt(map["patch"]) * 10
}
if (map.containsKey("minor")) {
- libraryVersionCode += (Integer.parseInt(map["minor"]) * 100)
+ libraryVersionCode += (Integer.parseInt(map["minor"]) * 1000)
}
if (map.containsKey("major")) {
- libraryVersionCode += (Integer.parseInt(map["major"]) * 10000)
+ libraryVersionCode += (Integer.parseInt(map["major"]) * 100000)
}
} catch (NumberFormatException ignore) {
libraryVersionCode = 1