jordond
06/18/2023, 11:20 PMbuild.gradle.kts
I enable strict mode for the libraries by doing:
configure(allprojects.filter { it.name != "demo" }) {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xexplicit-api=strict"
}
}
}
This works for the code inside of androidMain
but the stuff in commonMain
is not affected.
I’ve tried:
configure(allprojects.filter { it.name != "demo" }) {
tasks.withType<KotlinCompileCommon>().configureEach {
compilerOptions {
freeCompilerArgs = freeCompilerArgs + "-Xexplicit-api=strict"
}
}
}
But freeCompilerArgs
is a val
and cannot me changed.
Any ideas on how to enable strict mode for the libraries?Alexander.Likhachev
06/19/2023, 12:31 PMfreeCompilerArgs
in compilerOptions
is of the org.gradle.api.provider.ListProperty
type. You should modify your snippet to use freeCompilerArgs.add("-Xexplicit-api=strict")
jordond
06/19/2023, 4:00 PM