https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

Marc

04/02/2024, 4:05 PM
maybe a silly question but: is there a way to set a compiler argument for all the test environments at once or at least knowing which environment I’m missing? example: I’m setting a flag in the tests for Context Receivers (I know they are experimental and going to be supereeded by context parameters but even tho I’m experimenting…) the issue is that I tryed to enable the flag in all the possible environment I can think of but still see the alert:
To use contextual declarations, specify the -Xcontext-receivers compiler option
making me think that I’m still missing one. How can i guess which one? 🙏🏻 thanks
w

William Walker

04/02/2024, 4:12 PM
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xexplicit-api=strict",
)
}
❤️ 1
🙏🏻 1
h

hfhbd

04/02/2024, 5:15 PM
Use
configureEach
instead of
all
. Starting with Kotlin 2.0, there is also a new
kotlin.compilerOption
to set up all compilations directly, and the tasks one is deprecated.
👍 1
👍🏻 1
m

Marc

04/02/2024, 5:16 PM
nice one, thank you!
2 Views