Skip to content

Commit 8d06b04

Browse files
romtsnclaude
andcommitted
fix(ci): Dynamically set Kotlin language version based on compiler
Kotlin 2.3+ dropped support for language version 1.8. Use 2.0 when building with Kotlin 2.3+, otherwise keep 1.8. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 079ba77 commit 8d06b04

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

plugin-build/build.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import java.util.Properties
55
import org.gradle.api.tasks.testing.logging.TestLogEvent
66
import org.jetbrains.kotlin.config.KotlinCompilerVersion
77
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
8-
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8
8+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
99
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1010

1111
plugins {
@@ -91,8 +91,12 @@ tasks.withType<KotlinCompile>().configureEach {
9191

9292
compilerOptions {
9393
jvmTarget.set(JVM_11)
94-
languageVersion.set(KOTLIN_1_8)
95-
apiVersion.set(KOTLIN_1_8)
94+
// Kotlin 2.3+ dropped support for language version 1.8, so we need to use 2.0 there
95+
val kotlinLangVersion =
96+
if (KotlinCompilerVersion.VERSION.startsWith("2.3")) KotlinVersion.KOTLIN_2_0
97+
else KotlinVersion.KOTLIN_1_8
98+
languageVersion.set(kotlinLangVersion)
99+
apiVersion.set(kotlinLangVersion)
96100
}
97101
}
98102

0 commit comments

Comments
 (0)