Hey friends,
Is there a way to either
• get the
KotlinCompile
task for a given
KotlinCompilation
, or alternatively
• get the
KotlinCompilation
for a given
KotlinCompile
task?
For background (in case there's a better way to do what I'm trying to do) I have a multiplatform project with a
JS(IR)
target.
I'm trying to get the
KotlinJsIrLink
task (a subclass of
KotlinCompile
) for the production, main artifact so that I can write a Gradle task to send the generated
.d.ts
file elsewhere.
I can do
tasks.withType<KotlinJsIrLink>.filter { it.mode == KotlinJsBinaryMode.PRODUCTION }
but I still get the tasks corresponding to test compilations in there.
I can also do
kotlin.targets.flatMap { it.compilations }.filter { it is KotlinJsIrCompilation && it.name == KotlinCompilation.MAIN_COMPILATION_NAME }
but that includes non-production compilations, and I can't figure out how to go from that to the
KotlinJsIrLink
tasks.
Any tips would be appreciated!