@@ -13,9 +13,9 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion
13
13
* Max versionCode allowed by the PlayStore (for information):
14
14
* 2_100_000_000
15
15
*
16
- * Also note that the versionCode is multiplied by 10 in app/build.gradle.kts#L168 :
16
+ * Also note that the versionCode is multiplied by 10 in app/build.gradle.kts:
17
17
* ```
18
- * output.versionCode.set((output.versionCode.get() ?: 0) * 10 + abiCode) )
18
+ * output.versionCode.set((output.versionCode.orNull ?: 0) * 10 + abiCode)
19
19
* ```
20
20
* We are using a CalVer-like approach to version the application. The version code is calculated as follows:
21
21
* - 2 digits for the year
@@ -28,27 +28,80 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion
28
28
* - the version code: 20250100a (202_501_00a) where `a` stands for the architecture code
29
29
*/
30
30
31
+ /* *
32
+ * Year of the version on 2 digits.
33
+ * Do not update this value. it is updated by the release script.
34
+ */
31
35
private const val versionYear = 25
36
+
37
+ /* *
38
+ * Month of the version on 2 digits. Value must be in [1,12].
39
+ * Do not update this value. it is updated by the release script.
40
+ */
32
41
private const val versionMonth = 9
33
42
34
- // Note: must be in [0,99]
43
+ /* *
44
+ * Release number in the month. Value must be in [0,99].
45
+ * Do not update this value. it is updated by the release script.
46
+ */
35
47
private const val versionReleaseNumber = 1
36
48
37
49
object Versions {
50
+ /* *
51
+ * Base version code that will be set in the Android Manifest.
52
+ * The value will be modified at build time to add the ABI code when APK are build.
53
+ * AAB will have a ABI code of 0.
54
+ * See comment above for the calculation method.
55
+ */
38
56
const val VERSION_CODE = (2000 + versionYear) * 10_000 + versionMonth * 100 + versionReleaseNumber
39
57
val VERSION_NAME = " $versionYear .${versionMonth.toString().padStart(2 , ' 0' )} .$versionReleaseNumber "
40
58
41
- // When updating COMPILE_SDK, please do not forget to update the value for `buildToolsVersion`
42
- // in the file `tools/release/release.sh`
59
+ /* *
60
+ * Compile SDK version. Must be updated when a new Android version is released.
61
+ * When updating COMPILE_SDK, please also update BUILD_TOOLS_VERSION.
62
+ */
43
63
const val COMPILE_SDK = 36
64
+
65
+ /* *
66
+ * Build tools version. Must be kept in sync with COMPILE_SDK.
67
+ * The value is used by the release script.
68
+ */
69
+ @Suppress(" unused" )
70
+ private const val BUILD_TOOLS_VERSION = " 36.0.0"
71
+
72
+ /* *
73
+ * Target SDK version. Should be kept up to date with COMPILE_SDK.
74
+ */
44
75
const val TARGET_SDK = 36
45
76
46
- // When updating the `minSdk`, make sure to update the value of `minSdkVersion` in the file `tools/release/release.sh`
77
+ /* *
78
+ * Minimum SDK version for FOSS builds.
79
+ */
47
80
private const val MIN_SDK_FOSS = 24
81
+
82
+ /* *
83
+ * Minimum SDK version for Enterprise builds.
84
+ */
48
85
private const val MIN_SDK_ENTERPRISE = 33
86
+
87
+ /* *
88
+ * minSdkVersion that will be set in the Android Manifest.
89
+ */
49
90
val minSdk = if (isEnterpriseBuild) MIN_SDK_ENTERPRISE else MIN_SDK_FOSS
50
91
92
+ /* *
93
+ * Java version used for compilation.
94
+ * Update this value when you want to use a newer Java version.
95
+ */
51
96
private const val JAVA_VERSION = 21
97
+
52
98
val javaVersion: JavaVersion = JavaVersion .toVersion(JAVA_VERSION )
53
99
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion .of(JAVA_VERSION )
100
+
101
+ // Perform some checks on the values to avoid releasing with bad values
102
+ init {
103
+ require(versionMonth in 1 .. 12 ) { " versionMonth must be in [1,12]" }
104
+ require(versionReleaseNumber in 0 .. 99 ) { " versionReleaseNumber must be in [0,99]" }
105
+ require(BUILD_TOOLS_VERSION .startsWith(COMPILE_SDK .toString())) { " When updating COMPILE_SDK, please also update BUILD_TOOLS_VERSION" }
106
+ }
54
107
}
0 commit comments