# dokka

Robert Jaros

11/13/2023, 10:38 PM
I've got a wasm + js kmp project which can not be built in a standard way (it doesn't compile as a whole, but can be compiled for individual targets). I would like to generate api docs, but dokka "stubbornly" wants to build the project (and fails). I assumed dokka could just analyze the sources, but I can't make it to work this way. Is building the project some kind of requirement for dokka?

Ignat Beresnev

11/14/2023, 10:41 AM
I'm not sure if Dokka actually needs to compile the project (afaik it doesn't), but it for sure needs to go through some Gradle build steps, because it needs to collect the classpath of your project/module, otherwise you might end up with half-baked documentation with unresolved types and such. Is this a single-module kmp project? If yes, then it should be possible to find a way to achieve what you want. You could try suppressing some source sets (
) and play around with the configuration in general. Alternatively, you can just dump Dokka's configuration as a whole
Copy code
import org.jetbrains.dokka.InternalDokkaApi
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.internal.buildJsonConfiguration

tasks.named("dokkaHtml", DokkaTask::class) {
    println("Dokka's HTML configuration: ${this.buildJsonConfiguration(false)}")
And then use the CLI runner with the dumped JSON as input - it might even build docs correctly for all platforms. If your project is multi-module, then things become more complicated, but it should also be doable 🙂