diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 7d9208d..6083721 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,3 +1,6 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion + val libs: VersionCatalog = extensions.getByType().named("libs") plugins { @@ -12,6 +15,34 @@ repositories { mavenCentral() } +kotlin { + jvmToolchain { + languageVersion.set( + JavaLanguageVersion.of(libs.findVersion("jdk").get().toString()) + ) + } + compilerOptions { + @Suppress("SpellCheckingInspection") + freeCompilerArgs.add("-Xjsr305=strict") + allWarningsAsErrors = false + jvmTarget.set(JvmTarget.valueOf("JVM_${libs.findVersion("jdk").get()}")) + languageVersion.set( + KotlinVersion.valueOf( + "KOTLIN_${ + libs.findVersion("kotlin").get().toString().substringBeforeLast(".").replace(".", "_") + }" + ) + ) + apiVersion.set( + KotlinVersion.valueOf( + "KOTLIN_${ + libs.findVersion("kotlin").get().toString().substringBeforeLast(".").replace(".", "_") + }" + ) + ) + } +} + dependencies { // buildSrc in combination with this plugin ensures that the version set here // will be set to the same for all other Kotlin dependencies / plugins in the project. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d7e20b7..49eb960 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ kotlin-logging = "3.0.5" lorem = "2.2" j2html = "1.6.0" +jdk = "17" kotlin = "1.9.20" kotlinForDetekt = "1.9.10" springBoot = "3.1.5"