Skip to content

Commit

Permalink
Restructure source-sets-conventions.gradle.kts
Browse files Browse the repository at this point in the history
so it applies overridenLanugageVersion to all source sets using the new compilerOptions DSL. (#2891)

Previously, only leaf source sets were affected because the language version was applied to the KotlinCompilationTask configuration.
  • Loading branch information
sandwwraith authored Dec 20, 2024
1 parent fa797bc commit c645f52
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions buildSrc/src/main/kotlin/source-sets-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
}
}

0 comments on commit c645f52

Please sign in to comment.