Skip to content

Commit c3db71b

Browse files
committed
Add static checks
1 parent ac9c75d commit c3db71b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

plugins/src/main/kotlin/Versions.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ object Versions {
4040

4141
// When updating COMPILE_SDK, please also update BUILD_TOOLS_VERSION
4242
const val COMPILE_SDK = 36
43+
4344
@Suppress("unused")
4445
private const val BUILD_TOOLS_VERSION = "36.0.0"
4546
const val TARGET_SDK = 36
@@ -51,4 +52,11 @@ object Versions {
5152
private const val JAVA_VERSION = 21
5253
val javaVersion: JavaVersion = JavaVersion.toVersion(JAVA_VERSION)
5354
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(JAVA_VERSION)
55+
56+
// Perform some checks on the values to avoid releasing with bad values
57+
init {
58+
require(versionMonth in 1..12) { "versionMonth must be in [1,12]" }
59+
require(versionReleaseNumber in 0..99) { "versionReleaseNumber must be in [0,99]" }
60+
require(BUILD_TOOLS_VERSION.startsWith(COMPILE_SDK.toString())) { "When updating COMPILE_SDK, please also update BUILD_TOOLS_VERSION" }
61+
}
5462
}

0 commit comments

Comments
 (0)