In Kotlin 1.9.20-Beta, what's the correct way to p...
# compiler
l
In Kotlin 1.9.20-Beta, what's the correct way to pass a compiler flag (in an mpp project)? I currently have:
Copy code
val extension: KotlinProjectExtension = ...
extension.targets.forEach {
  it.compilerOptions.freeCompilerArgs.add("-Xfoo")
}
d
cc @tapchicoma
thank you color 1
t
I would advice you to try this new DSL
if you want to do it in convention plugin - then please use
KotlinMultiplatfromExtension.compilerOptions { ... }
or
KotlinMultiplatformExtension.compilerOptions.optIn.add(...)
l
Thank you! Yep I wanted to do in a convention plugin, and this works ☝️ One aside is that I have a shared function for both
KotlinMultiplatfromExtension
and
KotlinAndroidProjectExtension
and wished I could apply there (through the common type
KotlinProjectExtension
), but I just need to pass
-Xexpect-actual-classes
and this might not be necessary for kotlin-android modules, I think?
t
I suspect - not - it is not needed for Kotlin/Android project as there is no common code
You could also vote for this issue
l
Thanks for the pointer, much appreciated!