diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-12-11 20:29:42 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-10 21:09:56 +0200 |
commit | 6a8e2c04448e5ce1d8123b8be80393f5a1a709ad (patch) | |
tree | 51c5a72e9c0daaa7ee088f399e9b4b6c1d7db11c /ui | |
parent | 8671acc1a629c6fed2eed6c313e06d5d50f65015 (diff) |
version: automatically generate version string from tag
Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/build.gradle.kts | 6 | ||||
-rw-r--r-- | ui/src/main/java/com/wireguard/android/updater/Updater.kt | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/ui/build.gradle.kts b/ui/build.gradle.kts index 8368e7e6..2f556bba 100644 --- a/ui/build.gradle.kts +++ b/ui/build.gradle.kts @@ -12,6 +12,7 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.kapt) + alias(libs.plugins.ajoberstar.grgit) } android { @@ -27,7 +28,10 @@ android { minSdk = 21 targetSdk = 33 versionCode = providers.gradleProperty("wireguardVersionCode").get().toInt() - versionName = providers.gradleProperty("wireguardVersionName").get() + versionName = grgit.describe { + tags = true + always = true + }.replace('-', '.') buildConfigField("int", "MIN_SDK_VERSION", minSdk.toString()) } compileOptions { diff --git a/ui/src/main/java/com/wireguard/android/updater/Updater.kt b/ui/src/main/java/com/wireguard/android/updater/Updater.kt index 928028fd..7fc58e08 100644 --- a/ui/src/main/java/com/wireguard/android/updater/Updater.kt +++ b/ui/src/main/java/com/wireguard/android/updater/Updater.kt @@ -153,7 +153,10 @@ object Updater { throw InvalidParameterException("Version has no parts") parts = ULongArray(strParts.size) for (i in parts.indices) { - parts[i] = strParts[i].toULong() + if (strParts[i][0] == 'g') + parts[i] = strParts[i].substring(1).toULong(16) + else + parts[i] = strParts[i].toULong() } } @@ -439,4 +442,4 @@ object Updater { context.startActivity(start) } } -}
\ No newline at end of file +} |