https://kotlinlang.org logo
r

Ruckus

08/18/2020, 2:16 PM
Is there a shortcut to turning on the new IR for
compileKotlin
and
compileTestKotlin
at the same time? I just ran into an issue where I forgot to turn it on for tests (and it took far longer than it should have to realize my mistake and what the compiler was complaining about).
u

udalov

08/18/2020, 2:25 PM
I suppose something like this, but I haven't tried it myself. In Groovy:
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        useIR = true
    }
}
or in Kotlin:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
    kotlinOptions.useIR = true
}
(directly adapted from https://kotlinlang.org/docs/reference/using-gradle.html#compiler-options)
r

Ruckus

08/18/2020, 2:26 PM
Interesting, thanks.
3 Views