diff options
Diffstat (limited to 'dokka-runners/dokkatoo/examples/multimodule-example/dokka')
11 files changed, 141 insertions, 0 deletions
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/README.md b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/README.md new file mode 100644 index 00000000..c8b224ec --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/README.md @@ -0,0 +1,25 @@ +# Dokka MultiModule example + +This example demonstrates how to apply and configure Dokka in a +[multi-project build](https://docs.gradle.org/current/userguide/multi_project_builds.html). + +You can also learn how to set Dokka's version in [gradle.properties](gradle.properties) using `pluginManagement` +configuration block in [settings.gradle.kts](settings.gradle.kts). + +____ + +You can see up-to-date documentation generated for this example on +[GitHub Pages](https://kotlin.github.io/dokka/examples/dokka-multimodule-example/htmlMultiModule/index.html). + +![screenshot demonstration of output](demo.png) + +### Running + +Run `dokkaHtmlMultiModule` task to generate documentation for this example: + +```bash +./gradlew dokkaHtmlMultiModule +``` + +It will generate complete documentation for the root project and its subprojects, with a common +Table of Contents. diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/build.gradle.kts new file mode 100644 index 00000000..6b416abc --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/build.gradle.kts @@ -0,0 +1,5 @@ +subprojects { + repositories { + mavenCentral() + } +} diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/demo.png b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/demo.png Binary files differnew file mode 100644 index 00000000..d25576b8 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/demo.png diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/build.gradle.kts new file mode 100644 index 00000000..3563ecca --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/build.gradle.kts @@ -0,0 +1,38 @@ +import org.jetbrains.dokka.DokkaConfiguration.Visibility +import org.jetbrains.dokka.gradle.DokkaTaskPartial +import java.net.URL + +plugins { + kotlin("jvm") + id("org.jetbrains.dokka") +} + +// You can apply and configure Dokka in each subproject +// individially or configure all subprojects at once +subprojects { + apply(plugin = "org.jetbrains.dokka") + + tasks.withType<DokkaTaskPartial>().configureEach { + dokkaSourceSets.configureEach { + documentedVisibilities.set(setOf( + Visibility.PUBLIC, + Visibility.PROTECTED + )) + + // Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration + sourceLink { + val exampleDir = "https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example" + + localDirectory.set(rootProject.projectDir) + remoteUrl.set(URL("$exampleDir")) + remoteLineSuffix.set("#L") + } + } + } +} + +// Configures only the parent MultiModule task, +// this will not affect subprojects +tasks.dokkaHtmlMultiModule { + moduleName.set("Dokka MultiModule Example") +} diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/ModuleA.md b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/ModuleA.md new file mode 100644 index 00000000..12712d97 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/ModuleA.md @@ -0,0 +1,5 @@ +# Module childProjectA +This is the child module A + +# Package demo +This package contains a few examples of Dokka usage. diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts new file mode 100644 index 00000000..7b3b1e23 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts @@ -0,0 +1,16 @@ +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +plugins { + kotlin("jvm") + id("org.jetbrains.dokka") +} + +// configuration specific to this subproject. +// notice the use of Partial task +tasks.withType<DokkaTaskPartial>().configureEach { + dokkaSourceSets { + configureEach { + includes.from("ModuleA.md") + } + } +} diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt new file mode 100644 index 00000000..533b305c --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt @@ -0,0 +1,8 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child project a + */ +class ChildProjectAClass diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/ModuleB.md b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/ModuleB.md new file mode 100644 index 00000000..18a92a33 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/ModuleB.md @@ -0,0 +1,5 @@ +# Module childProjectB +This is the child module B + +# Package demo +This package contains a few examples of Dokka usage. diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts new file mode 100644 index 00000000..e8b40d4a --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts @@ -0,0 +1,16 @@ +import org.jetbrains.dokka.gradle.DokkaTaskPartial + +plugins { + kotlin("jvm") + id("org.jetbrains.dokka") +} + +// configuration specific to this subproject. +// notice the use of Partial task +tasks.withType<DokkaTaskPartial>().configureEach { + dokkaSourceSets { + configureEach { + includes.from("ModuleB.md") + } + } +} diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt new file mode 100644 index 00000000..6bfd22eb --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt @@ -0,0 +1,8 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child module b + */ +class ChildProjectBClass diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokka/settings.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/settings.gradle.kts new file mode 100644 index 00000000..9844b3cc --- /dev/null +++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/settings.gradle.kts @@ -0,0 +1,15 @@ +pluginManagement { + val kotlinVersion: String by settings + val dokkaVersion: String by settings + + plugins { + kotlin("jvm") version kotlinVersion + id("org.jetbrains.dokka") version dokkaVersion + } +} + +include(":parentProject") +include(":parentProject:childProjectA") +include(":parentProject:childProjectB") + +rootProject.name = "dokka-multimodule-example" |