Hi, im developing a gradle plugin compat for kotli...
# plugin-development
r
Hi, im developing a gradle plugin compat for kotlin multiplatform project, i want to set the generated/kotlin/commonMain for commonMain sourceSet, set generated/kotlin/nativeMain for nativeMain sourceSet, my code is here
Copy code
target.extensions.getByType(KotlinMultiplatformExtension::class.java)
                        .sourceSets.findByName(it.value.targetName)?.kotlin
                        ?.srcDir("build/generated/kotlin/${it.value.targetName}")
but it not work, only commonMain sourceSet are be set
v
The other source set does probably not exist yet when you call that, if you apply the plugin and then immediately call that line, as the targets are not configured yet. You probably instead want
Copy code
.sourceSets.named { it == "it.value.targetName" }.configureEach {
        kotlin.srcDir("build/generated/kotlin/"it.value.targetName"})
    }
or something like that.