I’m trying to fix <a problem with Dokkatoo>. How c...
# gradle
a
I’m trying to fix a problem with Dokkatoo. How can I get the details of all Kotlin Multiplatform source sets in a config-cache and build-cache compatible way? For each Kotlin source set I need to get • the target (one of: Common, JS, JVM, Native, WASM) • the classpath, runtime + compile time dependencies (not the compiled source of the project). Must be target specific, so .jar or .klib • the source directory (e.g.
src/commonMain/kotlin
or
src/jsMain/kotlin
or any custom source) • whether it is test or main (just using
sourceSet.name.endsWith("Test")
is fine) In essence the problem is that the source sets don’t have information about the target, and the targets don’t have information about the source sets. I’m not sure how to combine the two in a CC safe way, since the two source types are very info-dense and contain lots of CC incompatible types. Maybe it’s possible to get the information from the compiled library? Or a task that compiles the libraries? Dokka’s original attempt isn’t config-cache compatible, but I need to recreate it. My attempt is here. It works for Kotlin/JVM projects.
so the task is to combine two
NamedDomainObjectContainers
into a single
NamedDomainObjectContainers
. One of the containers is the compilation config (
KotlinProjectExtension.targets.compilations
), and the other is the source sets (
KotlinProjectExtension.sourceSets
). I think the trick is to create a specific Gradle class for each type, that’s CC compatible. And then inside a
provider {}
map both compilations/source sets to my custom classes. And then both providers can be zipped together to create a list of the end result, a
DokkaSourceSet
.