Skip to content

Commit 1176060

Browse files
runningcodeclaude
andauthored
build(deps): Upgrade default Kotlin to 2.1.21 (#1265)
Bump the default Kotlin version from 1.8.20 to the latest 2.1.x release. Staying on 2.1.x keeps the plugin-build language version at 1.8: that build derives languageVersion/apiVersion from the oldest the compiler still supports (current minus three), which is 1.8 for Kotlin 2.1 but 2.0 for Kotlin 2.3. A note on Dependencies.kt records this so future bumps are aware they may raise the language level. KSP1 is patch-coupled to the Kotlin compiler, so the default KSP1 fallback is bumped from 2.1.0-1.0.29 to 2.1.21-2.0.2 to match; the old one crashed the KSP compile with an internal compiler error on 2.1.21. Make BuildPluginsVersion.KOTLIN the single source of truth: the kotlin plugin aliases in the catalog are now versionless and take their version from the apply site. The standalone sentry-snapshots-runtime included build has no buildSrc and can't reach Dependencies.kt, so it (and the kotlinJunit test dependency) pin the version inline. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 42ff7d7 commit 1176060

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

buildSrc/src/main/java/Dependencies.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
object BuildPluginsVersion {
22
val AGP = System.getenv("VERSION_AGP") ?: "8.10.1"
3-
val KOTLIN = System.getenv("VERSION_KOTLIN") ?: "1.8.20"
3+
// Bumping this may implicitly raise the language level: plugin-build derives its
4+
// languageVersion/apiVersion from the oldest the compiler still supports (current minus
5+
// three, floored at 1.8), so e.g. Kotlin 2.1 keeps 1.8 but Kotlin 2.3 forces 2.0.
6+
val KOTLIN = System.getenv("VERSION_KOTLIN") ?: "2.1.21"
47
// KSP1 (X.Y.Z-A.B.C) is bound to a specific Kotlin compiler version; KSP2 (e.g. 2.3.7) is
58
// decoupled and supports Kotlin language version 2.0+. Default to KSP1 for the default
6-
// Kotlin 1.8.20, and switch to KSP2 when the matrix sets a Kotlin 2.x version.
9+
// Kotlin 2.1.21, and switch to KSP2 when the matrix sets a Kotlin 2.x version.
710
val KSP = System.getenv("VERSION_KOTLIN")
811
?.substringBefore('.')
912
?.toIntOrNull()
1013
?.let { if (it >= 2) "2.3.7" else null }
11-
?: "2.1.0-1.0.29"
14+
?: "2.1.21-2.0.2"
1215
}
1316

1417
object LibsVersion {

gradle/libs.versions.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[versions]
2-
kotlin = "1.8.20"
32
agp = "8.10.1"
43

54
asm = "9.4" # // compatibility matrix -> https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/instrumentation/InstrumentationContext#apiversion
@@ -17,10 +16,11 @@ sampleRetrofit = "2.9.0"
1716
sampleSpringBoot = "3.4.1"
1817

1918
[plugins]
20-
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
21-
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
22-
kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
23-
kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
19+
# Version is supplied at the apply site, normally from BuildPluginsVersion.KOTLIN.
20+
kotlin = { id = "org.jetbrains.kotlin.jvm" }
21+
kotlinAndroid = { id = "org.jetbrains.kotlin.android" }
22+
kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring" }
23+
kapt = { id = "org.jetbrains.kotlin.kapt" }
2424
ksp = { id = "com.google.devtools.ksp" }
2525
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
2626
spotless = { id = "com.diffplug.spotless", version = "8.5.0" }
@@ -43,7 +43,7 @@ agp = { group = "com.android.tools.build", name = "gradle", version.ref = "agp"
4343
kotlinCompilerEmbeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable" }
4444
autoService = { group = "com.google.auto.service", name = "auto-service", version = "1.1.1" }
4545
autoServiceAnnotatons = { group = "com.google.auto.service", name = "auto-service-annotations", version = "1.1.1" }
46-
kotlinJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" }
46+
kotlinJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version = "2.1.21" }
4747
kotlinCompileTesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.13.0" }
4848
truth = { module = "com.google.truth:truth", version = "1.4.5" }
4949
composeDesktop = { group = "org.jetbrains.compose.desktop", name = "desktop", version = "1.6.10" }

sentry-snapshots-runtime/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
alias(libs.plugins.kotlin)
2+
// No buildSrc here, so this standalone included build can't read BuildPluginsVersion.KOTLIN.
3+
alias(libs.plugins.kotlin) version "2.1.21"
34
id("distribution")
45
alias(libs.plugins.mavenPublish)
56
alias(libs.plugins.spotless)

0 commit comments

Comments
 (0)