Do not reset freeCompilerArgs for some kotlin-native modules

Otherwise common compiler arguments which are set for all modules in the
project in `buildSrc/src/main/kotlin/common-configuration.gradle.kts`
are not applied. The most interesting of those are `-Xuse-k2` (if K2 is
enabled) and `-Xjvm-default=all`.
This commit is contained in:
Alexander Udalov
2022-09-20 01:45:11 +02:00
committed by Space
parent b1a26f7439
commit c410c5d3cd
8 changed files with 22 additions and 10 deletions
@@ -154,8 +154,21 @@ fun Project.configureKotlinCompilationOptions() {
":wasm:wasm.ir",
// Uses multiplatform
":kotlin-stdlib-jvm-minimal-for-test",
":kotlin-native:endorsedLibraries:kotlinx.cli",
":kotlin-native:klib",
// Requires serialization plugin
":js:js.tests",
// ISE "Cannot serialize error type: ERROR CLASS: Cannot calculate return type (local class/object?)"
":kotlin-native-shared",
// Warnings about deprecated usages of companion objects in `::class`
":kotlin-native:Interop:Runtime",
// Some warnings which are not printed out for some reason
":kotlin-native:Interop:Indexer",
":kotlin-native:Interop:Skia",
// ISE "Fake override should have at least one overridden descriptor",
":kotlin-native:Interop:StubGenerator",
// Overload resolution ambiguity between candidates
":kotlin-native:backend.native",
)
// TODO: fix remaining warnings and remove this property.
@@ -176,7 +176,7 @@ val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
allWarningsAsErrors = true
freeCompilerArgs = listOf("-Xskip-prerelease-check")
freeCompilerArgs += listOf("-Xskip-prerelease-check")
}
}
@@ -73,9 +73,8 @@ sourceSets.main.get().java.srcDir("src/jvm/kotlin")
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = listOf(
freeCompilerArgs += listOf(
"-opt-in=kotlin.ExperimentalUnsignedTypes",
"-opt-in=kotlin.RequiresOptIn",
"-Xskip-prerelease-check"
)
allWarningsAsErrors = true
@@ -46,9 +46,9 @@ dependencies {
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xskip-metadata-version-check"
freeCompilerArgs += listOf(
"-opt-in=kotlin.ExperimentalUnsignedTypes",
"-Xskip-metadata-version-check"
)
allWarningsAsErrors = true
}
@@ -46,7 +46,7 @@ kotlin {
compilations.all {
kotlinOptions {
freeCompilerArgs = listOf("-opt-in=kotlinx.cli.ExperimentalCli", "-opt-in=kotlin.RequiresOptIn")
freeCompilerArgs += listOf("-opt-in=kotlinx.cli.ExperimentalCli")
suppressWarnings = true
}
}
+1 -1
View File
@@ -41,7 +41,7 @@ sourceSets["main"].withConvention(KotlinSourceSet::class) {
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf("-Xskip-prerelease-check")
kotlinOptions.freeCompilerArgs += listOf("-Xskip-prerelease-check")
}
tasks.jar {
@@ -15,7 +15,7 @@ plugins {
tasks.named<KotlinCompile>("compileKotlin") {
kotlinOptions {
freeCompilerArgs = listOf("-Xskip-metadata-version-check")
freeCompilerArgs += listOf("-Xskip-metadata-version-check")
}
}
@@ -10,7 +10,7 @@ apply plugin: 'kotlin'
compileKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xskip-metadata-version-check']
freeCompilerArgs += ['-Xskip-metadata-version-check']
}
}