What's the best way to add a compiler opt-in only ...
# compiler
j
What's the best way to add a compiler opt-in only on Kotlin/Native source sets? For example
"kotlinx.cinterop.BetaInteropApi"
, while avoiding:
w: Opt-in requirement marker kotlinx.cinterop.BetaInteropApi is unresolved. Please make sure it's present in the module dependencies
from non-native source sets.
Currently I'm doing:
Copy code
sourceSets.configureEach {
    languageSettings {
        if (!name.startsWith("common") &&
            !name.startsWith("jvm") &&
            !name.startsWith("android")
        ) {
            optIn("kotlinx.cinterop.BetaInteropApi")
            optIn("kotlinx.cinterop.ExperimentalForeignApi")
        }
    }
}
But I feel like there should be a proper typed-API for this.
d
It's better to ask in #gradle This channel is more about the compiler itself