Łukasz Gendek
04/11/2022, 8:24 AMcompileKotlin {
kotlinOptions {
jvmTarget = "14"
allWarningsAsErrors = true
freeCompilerArgs += [
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ObsoleteCoroutinesApi"]
}
}
However since kotlin 1.6.0 the -Xopt-in flag shoud be replaced with -opt-in. The problem is that I often switch kotlin version (and then I remove/add the X character). Is there a way to have one gradle file that works for both kotlin 1.5 and kotlin 1.6?Vampire
04/11/2022, 8:32 AMif
to do the right thing for the current kotlin version?tapchicoma
04/11/2022, 8:42 AMephemient
04/11/2022, 10:36 AMephemient
04/11/2022, 10:37 AMephemient
04/11/2022, 10:38 AMŁukasz Gendek
04/11/2022, 11:59 AMsourceSets.main {
languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
}
No signature of method: org.jetbrains.kotlin.gradle.plugin.sources.DefaultLanguageSettingsBuilder.optIn() is applicable for argument types: (String) values: [kotlinx.coroutines.ExperimentalCoroutinesApi]Vampire
04/11/2022, 12:00 PMkotlin.
I guessŁukasz Gendek
04/11/2022, 12:31 PMephemient
04/11/2022, 1:05 PMkotlin.target.compilations.named("main") {
languageSettings {
optIn("...")
optIn("...")
}
}
in a JVM-only projectŁukasz Gendek
04/11/2022, 4:01 PMŁukasz Gendek
04/11/2022, 4:04 PMephemient
04/11/2022, 4:24 PMchristophsturm
05/10/2022, 5:40 PMchristophsturm
05/10/2022, 6:27 PM