From 0605ad8ccee68074dc96089739eed61cae8df8b7 Mon Sep 17 00:00:00 2001 From: nian1 Date: Sat, 22 Jun 2024 09:28:40 +0800 Subject: [PATCH] Update build.gradle.kts --- build.gradle.kts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9b86489..e7311b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,5 @@ @file:Suppress("UnstableApiUsage") -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.mpp.Framework @@ -108,14 +107,17 @@ private fun Project.configureCommonKotlin() { // We set the JVM target (the bytecode version) above for all Kotlin-based Java bytecode // compilations, but we also need to set the JDK API version for the Kotlin JVM targets to // prevent linking against newer JDK APIs (the Android targets link against the android.jar). - @OptIn(ExperimentalKotlinGradlePluginApi::class) kotlin.targets.withType(KotlinJvmTarget::class.java) { - compilerOptions { - freeCompilerArgs.set( - freeCompilerArgs.getOrElse(emptyList()) + listOf( - "-Xjdk-release=${Versions.javaVersion}" - ) - ) + compilations.configureEach { + compileTaskProvider.configure { + compilerOptions { + freeCompilerArgs.set( + freeCompilerArgs.getOrElse(emptyList()) + listOf( + "-Xjdk-release=${Versions.javaVersion}" + ) + ) + } + } } }