diff options
Diffstat (limited to 'dokka-runners/dokkatoo/examples/versioning-multimodule-example')
12 files changed, 141 insertions, 0 deletions
diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/README.md b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/README.md new file mode 100644 index 00000000..dd012003 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/README.md @@ -0,0 +1,25 @@ +# Dokka Versioning MultiModule example + +This example demonstrates configuration of Dokka's [versioning plugin](../../../plugins/versioning), which +allows readers to navigate through different versions of your API reference documentation. + +The example contains some code that exists only in the current documentation version `1.0`. You will not see +this code in the previous version `0.9`, which is located in the [previousDocVersions](previousDocVersions) directory. + +___ + +You can see up-to-date documentation generated for this example on +[GitHub Pages](https://kotlin.github.io/dokka/examples/dokka-versioning-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 the version navigation +dropdown menu. diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/build.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/build.gradle.kts new file mode 100644 index 00000000..14aea2b4 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + kotlin("jvm") version "1.9.0" + id("org.jetbrains.dokka") version "1.9.0" apply false +} + +// The versioning plugin must be applied in all submodules +subprojects { + repositories { + mavenCentral() + } + apply { + plugin("org.jetbrains.kotlin.jvm") + plugin("org.jetbrains.dokka") + } + val dokkaPlugin by configurations + dependencies { + dokkaPlugin("org.jetbrains.dokka:versioning-plugin:1.9.0") + } +} diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/demo.png b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/demo.png Binary files differnew file mode 100644 index 00000000..9ac1d382 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/demo.png diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/build.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/build.gradle.kts new file mode 100644 index 00000000..6d830079 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/build.gradle.kts @@ -0,0 +1,27 @@ +import org.jetbrains.dokka.gradle.DokkaMultiModuleTask +import org.jetbrains.dokka.versioning.VersioningPlugin +import org.jetbrains.dokka.versioning.VersioningConfiguration + +buildscript { + dependencies { + classpath("org.jetbrains.dokka:versioning-plugin:1.9.0") + } + + repositories { + mavenCentral() + } +} + +val currentVersion = "1.0" +val previousVersionsDirectory = project.rootProject.projectDir.resolve("previousDocVersions").invariantSeparatorsPath + +// Main configuration for the versioning plugin. It will generate documentation for +// the current version of the application, and look for previous versions of docs +// in the directory defined in previousVersionsDirectory, allowing it to create +// the version navigation dropdown menu. +tasks.dokkaHtmlMultiModule { + pluginConfiguration<VersioningPlugin, VersioningConfiguration> { + version = currentVersion + olderVersionsDir = file(previousVersionsDirectory) + } +} diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts new file mode 100644 index 00000000..bf1513f8 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/build.gradle.kts @@ -0,0 +1 @@ +// intentionally empty - build config is set in the root build.gradle.kts diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt new file mode 100644 index 00000000..e0f9e86a --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt @@ -0,0 +1,18 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child project A + * + * @since 0.9 + */ +class ChildProjectAClass { + + /** + * Function that extends [ChildProjectAClass] + * + * @since 1.0 + */ + fun extend() {} +} diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/FancyAPI.kt b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/FancyAPI.kt new file mode 100644 index 00000000..e691be03 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectA/src/main/kotlin/demo/FancyAPI.kt @@ -0,0 +1,10 @@ +package demo + +/** + * New shiny fancy API + * + * @since 1.0 + */ +class FancyAPI { + fun doSomething() {} +} diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts new file mode 100644 index 00000000..bf1513f8 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/build.gradle.kts @@ -0,0 +1 @@ +// intentionally empty - build config is set in the root build.gradle.kts diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt new file mode 100644 index 00000000..6978a176 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt @@ -0,0 +1,10 @@ +@file:Suppress("unused") + +package demo + +/** + * Class defined in child module B + * + * @since 0.9 + */ +class ChildProjectBClass diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/Functions.kt b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/Functions.kt new file mode 100644 index 00000000..35a9275b --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/parentProject/childProjectB/src/main/kotlin/demo/Functions.kt @@ -0,0 +1,8 @@ +package demo + +/** + * New super function that does everything + * + * @since 1.0 + */ +fun superFunction42() {} diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/settings.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/settings.gradle.kts new file mode 100644 index 00000000..ec6614f0 --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokka/settings.gradle.kts @@ -0,0 +1,5 @@ +include(":parentProject") +include(":parentProject:childProjectA") +include(":parentProject:childProjectB") + +rootProject.name = "dokka-versioning-multimodule-example"
\ No newline at end of file diff --git a/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokkatoo/settings.gradle.kts b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokkatoo/settings.gradle.kts new file mode 100644 index 00000000..850a82bf --- /dev/null +++ b/dokka-runners/dokkatoo/examples/versioning-multimodule-example/dokkatoo/settings.gradle.kts @@ -0,0 +1,17 @@ +rootProject.name = "versioning-multimodule-example" + +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven(providers.gradleProperty("testMavenRepo")) + } +} + +@Suppress("UnstableApiUsage") +dependencyResolutionManagement { + repositories { + mavenCentral() + maven(providers.gradleProperty("testMavenRepo")) + } +} |