I’m converting my Android Compose library to a Mul...
# multiplatform
j
I’m converting my Android Compose library to a Multiplatform Compose library. Currently in my root
build.gradle.kts
I enable strict mode for the libraries by doing:
Copy code
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:
Copy code
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?
a
freeCompilerArgs
in
compilerOptions
is of the
org.gradle.api.provider.ListProperty
type. You should modify your snippet to use
freeCompilerArgs.add("-Xexplicit-api=strict")
j
Ah, I’m an idiot 😅 , thanks for your help! 👍