Hello, I am a bit confused by intellij warnings in gradle file. in particular, we have
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
sourceSets.all {
languageSettings {
progressiveMode = true
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17 //see: <https://youtrack.jetbrains.com/issue/IDEA-252328>
freeCompilerArgs = ["-Xjsr305=strict", "-Xemit-jvm-type-annotations", "-opt-in=kotlin.RequiresOptIn"]
}
}
with kotlin 1.8 and groovy build file.
sourceSets.all
is suggested to be replaced with
source.configureEach
, which seems to work but it deviates from kotlin docs:
https://kotlinlang.org/docs/multiplatform-dsl-reference.html#language-settings. moreover, using
configureEach
leads to
languageSettings
generating a warning as
method call is ambiguous
. what is the best approach here?
second confusing (or better, I am not sure what to do) warning is the deprecation of `kotlinOptions`: idea still does not fully support language version, as per
https://youtrack.jetbrains.com/issue/IDEA-252328, but the suggested solution requires replacing toolchain with
unfortunately no improvements were made yet. The sourceCompatibility and targetCompatibility are safe options for now.
source and target compatibility, and toolchain are mutually exclusive, hence the use of
kotlinOptions
. I am mostly concern about upgrading to gradle 8, probably kotlin options will go then, is there another option?