aboutsummaryrefslogtreecommitdiff
path: root/dokka-runners/dokkatoo/examples/multimodule-example
diff options
context:
space:
mode:
Diffstat (limited to 'dokka-runners/dokkatoo/examples/multimodule-example')
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/README.md25
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/build.gradle.kts5
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/demo.pngbin0 -> 93395 bytes
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/build.gradle.kts38
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/ModuleA.md5
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts16
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt8
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/ModuleB.md5
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts16
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt8
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokka/settings.gradle.kts15
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/build.gradle.kts8
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/settings.gradle.kts21
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/src/main/kotlin/dokka-convention.gradle.kts17
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/build.gradle.kts23
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/ModuleA.md5
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/build.gradle.kts21
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt8
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/ModuleB.md5
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/build.gradle.kts21
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt8
-rw-r--r--dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/settings.gradle.kts21
22 files changed, 299 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
new file mode 100644
index 00000000..d25576b8
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokka/demo.png
Binary files differ
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"
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/build.gradle.kts
new file mode 100644
index 00000000..4ee5b079
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/build.gradle.kts
@@ -0,0 +1,8 @@
+plugins {
+ `kotlin-dsl`
+}
+
+dependencies {
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0")
+ implementation("org.jetbrains.dokka.dokkatoo:dokkatoo-plugin:2.1.0-SNAPSHOT")
+}
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/settings.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/settings.gradle.kts
new file mode 100644
index 00000000..b7510ccf
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/settings.gradle.kts
@@ -0,0 +1,21 @@
+rootProject.name = "buildSrc"
+
+pluginManagement {
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
+
+@Suppress("UnstableApiUsage")
+dependencyResolutionManagement {
+
+ repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
+
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/src/main/kotlin/dokka-convention.gradle.kts
new file mode 100644
index 00000000..04970e8a
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/buildSrc/src/main/kotlin/dokka-convention.gradle.kts
@@ -0,0 +1,17 @@
+/**
+ * Common conventions for generating documentation with Dokkatoo.
+ */
+
+plugins {
+ id("org.jetbrains.dokka.dokkatoo")
+}
+
+dokkatoo {
+ dokkatooSourceSets.configureEach {
+ sourceLink {
+ // Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration
+ remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example")
+ localDirectory.set(rootDir)
+ }
+ }
+}
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/build.gradle.kts
new file mode 100644
index 00000000..2a698a7b
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/build.gradle.kts
@@ -0,0 +1,23 @@
+plugins {
+ kotlin("jvm") apply false
+ `dokka-convention`
+}
+
+dependencies {
+ dokkatoo(project(":parentProject:childProjectA"))
+ dokkatoo(project(":parentProject:childProjectB"))
+ dokkatooPluginHtml(
+ dokkatoo.versions.jetbrainsDokka.map { dokkaVersion ->
+ "org.jetbrains.dokka:all-modules-page-plugin:$dokkaVersion"
+ }
+ )
+ dokkatooPluginHtml(
+ dokkatoo.versions.jetbrainsDokka.map { dokkaVersion ->
+ "org.jetbrains.dokka:templating-plugin:$dokkaVersion"
+ }
+ )
+}
+
+dokkatoo {
+ moduleName.set("Dokka MultiModule Example")
+}
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/ModuleA.md b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/ModuleA.md
new file mode 100644
index 00000000..12712d97
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/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/dokkatoo/parentProject/childProjectA/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/build.gradle.kts
new file mode 100644
index 00000000..51c17118
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/build.gradle.kts
@@ -0,0 +1,21 @@
+plugins {
+ kotlin("jvm")
+ `dokka-convention`
+}
+
+dokkatoo {
+ dokkatooSourceSets.configureEach {
+ includes.from("ModuleA.md")
+ }
+}
+
+//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
+dokkatoo {
+ modulePath.set("childProjectA") // match the original dokka default
+}
+tasks.withType<org.jetbrains.dokka.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
+ generator.dokkaSourceSets.configureEach {
+ sourceSetScope.set(":parentProject:childProjectA:dokkaHtmlPartial")
+ }
+}
+//endregion
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt
new file mode 100644
index 00000000..533b305c
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/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/dokkatoo/parentProject/childProjectB/ModuleB.md b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/ModuleB.md
new file mode 100644
index 00000000..18a92a33
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/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/dokkatoo/parentProject/childProjectB/build.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/build.gradle.kts
new file mode 100644
index 00000000..69e066bb
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/build.gradle.kts
@@ -0,0 +1,21 @@
+plugins {
+ kotlin("jvm")
+ `dokka-convention`
+}
+
+dokkatoo {
+ dokkatooSourceSets.configureEach {
+ includes.from("ModuleB.md")
+ }
+}
+
+//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
+dokkatoo {
+ modulePath.set("childProjectB") // match the original dokka default
+}
+tasks.withType<org.jetbrains.dokka.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
+ generator.dokkaSourceSets.configureEach {
+ sourceSetScope.set(":parentProject:childProjectB:dokkaHtmlPartial")
+ }
+}
+//endregion
diff --git a/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt
new file mode 100644
index 00000000..6bfd22eb
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/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/dokkatoo/settings.gradle.kts b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/settings.gradle.kts
new file mode 100644
index 00000000..a091e8cc
--- /dev/null
+++ b/dokka-runners/dokkatoo/examples/multimodule-example/dokkatoo/settings.gradle.kts
@@ -0,0 +1,21 @@
+rootProject.name = "dokkatoo-multimodule-example"
+
+pluginManagement {
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
+
+@Suppress("UnstableApiUsage")
+dependencyResolutionManagement {
+ repositories {
+ mavenCentral()
+ maven(providers.gradleProperty("testMavenRepo"))
+ }
+}
+
+include(":parentProject")
+include(":parentProject:childProjectA")
+include(":parentProject:childProjectB")