diff options
Diffstat (limited to 'examples/gradle/dokka-multimodule-example')
-rw-r--r-- | examples/gradle/dokka-multimodule-example/README.md | 25 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/demo.png | bin | 0 -> 93395 bytes | |||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/gradle.properties | 2 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts | 35 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/parentProject/childProjectA/ModuleA.md (renamed from examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md) | 2 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts | 4 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/parentProject/childProjectB/ModuleB.md (renamed from examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md) | 2 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts | 4 | ||||
-rw-r--r-- | examples/gradle/dokka-multimodule-example/settings.gradle.kts | 7 |
9 files changed, 64 insertions, 17 deletions
diff --git a/examples/gradle/dokka-multimodule-example/README.md b/examples/gradle/dokka-multimodule-example/README.md new file mode 100644 index 00000000..c8b224ec --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/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/examples/gradle/dokka-multimodule-example/demo.png b/examples/gradle/dokka-multimodule-example/demo.png Binary files differnew file mode 100644 index 00000000..d25576b8 --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/demo.png diff --git a/examples/gradle/dokka-multimodule-example/gradle.properties b/examples/gradle/dokka-multimodule-example/gradle.properties new file mode 100644 index 00000000..664b5f0e --- /dev/null +++ b/examples/gradle/dokka-multimodule-example/gradle.properties @@ -0,0 +1,2 @@ +kotlinVersion=1.7.20 +dokkaVersion=1.7.20 diff --git a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts index 397ad22f..66b32b18 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts @@ -1,19 +1,32 @@ +import org.jetbrains.dokka.DokkaConfiguration.Visibility +import org.jetbrains.dokka.gradle.DokkaTaskPartial + plugins { - /** - * Kotlin plugin necessary because of potential Gradle bug! - * This is not necessary if the kotlin gradle plugin is added as buildscript - * dependency like - * - * buildscript { - * dependencies { - * classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") - * } - * } - */ 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 + )) + } + } +} + +// Configures only the parent MultiModule task, +// this will not affect subprojects +tasks.dokkaHtmlMultiModule { + moduleName.set("Dokka MultiModule Example") +} + dependencies { implementation(kotlin("stdlib")) } diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/ModuleA.md index e6cf0e04..12712d97 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/Module.md +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/ModuleA.md @@ -1,5 +1,5 @@ # Module childProjectA -This is the child module a +This is the child module A # Package demo This package contains a few examples of Dokka usage. diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts index b3c42aba..e13819a1 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts @@ -9,10 +9,12 @@ dependencies { implementation(kotlin("stdlib")) } +// configuration specific to this subproject. +// notice the use of Partial task tasks.withType<DokkaTaskPartial>().configureEach { dokkaSourceSets { configureEach { - includes.from("Module.md") + includes.from("ModuleA.md") } } } diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/ModuleB.md index 27031edf..18a92a33 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/Module.md +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/ModuleB.md @@ -1,5 +1,5 @@ # Module childProjectB -This is the child module b +This is the child module B # Package demo This package contains a few examples of Dokka usage. diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts index b3c42aba..089813a8 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts @@ -9,10 +9,12 @@ dependencies { implementation(kotlin("stdlib")) } +// configuration specific to this subproject. +// notice the use of Partial task tasks.withType<DokkaTaskPartial>().configureEach { dokkaSourceSets { configureEach { - includes.from("Module.md") + includes.from("ModuleB.md") } } } diff --git a/examples/gradle/dokka-multimodule-example/settings.gradle.kts b/examples/gradle/dokka-multimodule-example/settings.gradle.kts index ef724ba5..9844b3cc 100644 --- a/examples/gradle/dokka-multimodule-example/settings.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/settings.gradle.kts @@ -1,7 +1,10 @@ pluginManagement { + val kotlinVersion: String by settings + val dokkaVersion: String by settings + plugins { - kotlin("jvm") version "1.7.20" - id("org.jetbrains.dokka") version ("1.7.20") + kotlin("jvm") version kotlinVersion + id("org.jetbrains.dokka") version dokkaVersion } } |