-
Notifications
You must be signed in to change notification settings - Fork 42
Enable allWarningsAsErrors compiler option for :runtime and :examples:kotlin-multiplatform projects #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable allWarningsAsErrors compiler option for :runtime and :examples:kotlin-multiplatform projects #165
Changes from all commits
f297fcc
b1a85a8
8095e77
a1b039f
70d5d37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,10 @@ kotlin { | |
|
||
targets.configureEach { | ||
compilations.configureEach { | ||
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes" | ||
compilerOptions.options.with { | ||
allWarningsAsErrors.set(true) | ||
freeCompilerArgs.add("-Xexpect-actual-classes") | ||
} | ||
} | ||
} | ||
|
||
|
@@ -54,8 +57,6 @@ kotlin { | |
resources.srcDirs = ["$it.name/resources"] | ||
languageSettings { | ||
progressiveMode = true | ||
optIn('kotlin.experimental.ExperimentalNativeApi') | ||
optIn("kotlinx.cinterop.ExperimentalForeignApi") | ||
} | ||
} | ||
|
||
|
@@ -108,3 +109,11 @@ if (project.findProperty("publication_repository") == "space") { | |
tasks.withType(KotlinNativeCompile).matching { it.name.toLowerCase().contains("test") }.configureEach { | ||
it.dependsOn(tasks.withType(Sign)) | ||
} | ||
|
||
tasks.withType(KotlinNativeCompile).configureEach { | ||
compilerOptions.freeCompilerArgs.addAll( | ||
"-opt-in=kotlin.experimental.ExperimentalNativeApi", | ||
"-opt-in=kotlin.native.runtime.NativeRuntimeApi", | ||
"-opt-in=kotlinx.cinterop.ExperimentalForeignApi", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you could continue using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, this approach doesn't work. The opt-ins are not passed to the dependent source sets automatically.
|
||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compilerOptions
can be used instead ofkotlinOptions
to avoid further changes when the latter is deprecated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
But configuring
compilerOptions
in Groovy is not as handy as in Kotlin.It is not possible to call
compilerOptions.configure {}
function because of resolution ambiguity betweenfun configure(configuration: T.() -> Unit)
andfun configure(configuration: Action<T>)
.So the
compilerOptions.options
needs to be configured directly.