Skip to content

Commit

Permalink
chore: replace deprecated kotlinOptions with a replacement API
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Jan 10, 2025
1 parent 398029e commit ce54dfd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions build-logic/jvm/src/main/kotlin/build-logic.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.github.vlsi.gradle.dsl.configureEach
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
id("java-library")
Expand All @@ -26,12 +28,12 @@ autostyle {
}
}

tasks.configureEach<KotlinCompile> {
kotlinOptions {
tasks.configureEach<KotlinJvmCompile> {
compilerOptions {
if (!name.startsWith("compileTest")) {
apiVersion = "kotlin.api".v
apiVersion = KotlinVersion.fromVersion("kotlin.api".v)
}
freeCompilerArgs += "-Xjvm-default=all"
freeCompilerArgs.add("-Xjvm-default=all")
val jdkRelease = buildParameters.targetJavaVersion.let {
when {
it < 9 -> "1.8"
Expand All @@ -42,8 +44,8 @@ tasks.configureEach<KotlinCompile> {
buildParameters.buildJdkVersion
.takeIf { it > 8 }
?.let {
freeCompilerArgs += "-Xjdk-release=$jdkRelease"
freeCompilerArgs.add("-Xjdk-release=$jdkRelease")
}
kotlinOptions.jvmTarget = jdkRelease
jvmTarget = JvmTarget.fromTarget(jdkRelease)
}
}

0 comments on commit ce54dfd

Please sign in to comment.