Question: I'm trying to integrate the Kotlin multi...
# community-support
k
Question: I'm trying to integrate the Kotlin multiplatform plugin as part of a precompiled script, like so:
Copy code
plugins {
  kotlin("multiplatform")
}

kotlin {
  jvm()
}

tasks.register("doSomething") {
  dependsOn(tasks.jvmTest)
}
That last part doesn't compile, probably because there is no accessor for
jvmTest
even though by all rights it should exist. Of course, changing it to
tasks.named("jvmTest")
works, but what would cause the accessors to not be useable? (Compare this to, say,
commonMain
, which is useable)
e
you can use
Copy code
dependsOn("jvmTest")
accessors are generated for tasks registered by plugins before the rest of your build script, but KGP doesn't register it until during your script execution (with
kotlin { jvm() }
if you wrote a convention plugin that applies KMP and sets up the JVM target, then applying that plugin would give you generated accessors in your build script
k
Ah, makes sense. If there had been another layer of indirection then accessors could be used. Now all I need to do is to use this information to get my plugin to integrate JaCoCo with its aggregation plugin. It works for what I need now - a simple project with a
common
and
jvm
source set, but I'm not sure it's generically applicable and/or involves hardcoding things that I should get from computing it.