From 312fe6adc852cceaa99927e0dc3a19a6d0abb75e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 20 Jul 2023 12:01:50 +0200 Subject: [PATCH] Compute version code and version name from separate component --- plugins/src/main/kotlin/Versions.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/src/main/kotlin/Versions.kt b/plugins/src/main/kotlin/Versions.kt index 3a6c591e19..a3dfa86de9 100644 --- a/plugins/src/main/kotlin/Versions.kt +++ b/plugins/src/main/kotlin/Versions.kt @@ -17,10 +17,18 @@ import org.gradle.api.JavaVersion import org.gradle.jvm.toolchain.JavaLanguageVersion -object Versions { - const val versionCode = 100200 - const val versionName = "0.2.0" +// Note: 2 digits max for each value +private const val versionMajor = 0 +private const val versionMinor = 1 +// Note: even values are reserved for regular release, odd values for hotfix release. +// When creating a hotfix, you should decrease the value, since the current value +// is the value for the next regular release. +private const val versionPatch = 2 + +object Versions { + val versionCode = (versionMajor * 1_00_00 + versionMinor * 1_00 + versionPatch) * 10 + val versionName = "$versionMajor.$versionMinor.$versionPatch" const val compileSdk = 33 const val targetSdk = 33 const val minSdk = 23