https://kotlinlang.org logo
#dokka
Title
# dokka
s

spechard

08/01/2022, 12:42 PM
Hello, Can dokka generate two separate documentation from a single multi-module project? Something like one with a defined list of
*.md
files and another one in a different output directory with a different set of files. Thanks
i

Ignat Beresnev

08/03/2022, 11:41 AM
Hi! I believe this can be done using gradle's features and options. You can introduce a flag that you can either specify in
gradle.properties
or pass as `./gradlew dokkaHtmlMultiModule -Pflag=value`:
Copy code
val property = project.property("withInternal")

if (property == "true") {
    tasks.withType<DokkaTask>().configureEach {
        dokkaSourceSets.configureEach {
            documentedVisibilities.set(
                setOf(
                    Visibility.PUBLIC,
                    Visibility.INTERNAL,
                )
            )
        }
    }
} else {
    tasks.withType<DokkaTask>().configureEach {
        dokkaSourceSets.configureEach {
            documentedVisibilities.set(
                setOf(
                    Visibility.PUBLIC,
                )
            )
        }
    }
}
Alternatively, you could introduce your own Dokka tasks, although getting it to work in multi-module environment may be tricky An example can be seen here: https://github.com/Kotlin/dokka/blob/018af7d18f50b0677a31714e29744ac2d8713c4f/examples/gradle/dokka-customFormat-example/build.gradle.kts#L21 So you'd have two different tasks, both with different configuration All in all, I think this question is best addressed to gradle/maven gurus 🙂
s

spechard

08/03/2022, 3:04 PM
Ok, thanks a lot for your ideas, I will try this!
68 Views