diff --git a/buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts b/buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts index 008628c3b9..311df3fb9f 100644 --- a/buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts @@ -64,14 +64,24 @@ kotlin { sourceSets.all { kotlin.srcDirs("$name/src") resources.srcDirs("$name/resources") - languageSettings { - progressiveMode = true + } - optIn("kotlin.ExperimentalMultiplatform") - optIn("kotlin.ExperimentalSubclassOptIn") - optIn("kotlinx.serialization.InternalSerializationApi") - optIn("kotlinx.serialization.SealedSerializationApi") + compilerOptions { + // These configuration replaces 'languageSettings' config on line 67 + progressiveMode.set(true) + optIn.addAll( + listOf( + "kotlin.ExperimentalMultiplatform", + "kotlin.ExperimentalSubclassOptIn", + "kotlinx.serialization.InternalSerializationApi", + "kotlinx.serialization.SealedSerializationApi", + ) + ) + if (overriddenLanguageVersion != null) { + languageVersion = KotlinVersion.fromVersion(overriddenLanguageVersion!!) + freeCompilerArgs.add("-Xsuppress-version-warnings") } + freeCompilerArgs.add("-Xexpect-actual-classes") } sourceSets { @@ -126,10 +136,5 @@ tasks.withType(KotlinCompilationTask::class).configureEach { if (isMainTaskName) { allWarningsAsErrors = true } - if (overriddenLanguageVersion != null) { - languageVersion = KotlinVersion.fromVersion(overriddenLanguageVersion!!) - freeCompilerArgs.add("-Xsuppress-version-warnings") - } - freeCompilerArgs.add("-Xexpect-actual-classes") } }