I'm trying to set up Dokka for my multimodule &amp...
# dokka
a
I'm trying to set up Dokka for my multimodule & multiplatform. This is the configuration I have in the root project. the kotlin multiplatform plugin is applied in all projects, and I only apply Dokka in the root:
Copy code
tasks {
    withType<DokkaTask> {

        outputFormat = "html"
        outputDirectory = "docs"

        subProjects = rootProject.childProjects.map { it.key }
        multiplatform {
            rootProject.childProjects.forEach { (name, project) ->
                register(name) {
                    targets = listOf("JVM", "JS")
                    listOf("commonMain", "jvmMain", "jsMain").forEach { dir ->
                        val sourceDir = "${projectDir}/$name/src/$dir/kotlin"
                        if (File(sourceDir).exists()) {
                            sourceRoot {
                                path = "${projectDir}/$name/src/$dir/kotlin"
                            }
                        }
                    }
                }
            }
        }
    }
}
What am I doing wrong? I'm trying to register each module and their corresponding sources, but it is not working. The docs are generated but it is not grouped by subprojects and I also get hundreds of errors stating that
Found an unresolved type
and other errors stating that
Cannot extract sources from subProjects. Do you have the Kotlin plugin in version 1.3.30+ and the Kotlin plugin applied in the root project?
and
Could not find target with name: myproject
. How am I supposed to use Dokka for my setup?
k
You shouldn’t need to register each project. In the
multiplatform
closure you should only register platforms you want to document (like
jvm
and
js
)
a
how do I do this with a multi-module project?
Dokka doesn't work when applied in individual modules and it doesn't generate a consistent documentation either
is it even possible to do this?