diff options
Diffstat (limited to 'examples/gradle/dokka-versioning-multimodule-example/parentProject')
5 files changed, 55 insertions, 19 deletions
diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts index dc909192..8387d9c8 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts @@ -1,25 +1,31 @@ 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.7.20") + } + + repositories { + mavenCentral() + } +} dependencies { implementation(kotlin("stdlib")) } -val olderVersionsFolder = "olderVersions" - -// The previously documentations should be generated with the versioning plugin -val generatePreviouslyDocTask by tasks.register<DokkaMultiModuleTask>("dokkaPreviouslyDocumentation") { - dependencies { - dokkaPlugin("org.jetbrains.dokka:all-modules-page-plugin:1.7.20") - dokkaPlugin("org.jetbrains.dokka:versioning-plugin:1.7.20") - } - val configuredVersion = "0.9" - outputDirectory.set(file(projectDir.resolve(olderVersionsFolder).resolve(configuredVersion))) - pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.versioning.VersioningPlugin" to """{ "version": "$configuredVersion" }""")) - addChildTasks(listOf(project("childProjectA"), project("childProjectB")), "dokkaHtmlPartial") -} +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 { - dependsOn(generatePreviouslyDocTask) - val configuredVersion = "1.0" - pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.versioning.VersioningPlugin" to """{ "version": "$configuredVersion", "olderVersionsDir": "${projectDir.resolve(olderVersionsFolder).invariantSeparatorsPath}" }""")) + pluginConfiguration<VersioningPlugin, VersioningConfiguration> { + version = currentVersion + olderVersionsDir = file(previousVersionsDirectory) + } } diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt index 533b305c..e0f9e86a 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/ChildProjectAClass.kt @@ -3,6 +3,16 @@ package demo /** - * Class defined in child project a + * Class defined in child project A + * + * @since 0.9 */ -class ChildProjectAClass +class ChildProjectAClass { + + /** + * Function that extends [ChildProjectAClass] + * + * @since 1.0 + */ + fun extend() {} +} diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/FancyAPI.kt b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/src/main/kotlin/demo/FancyAPI.kt new file mode 100644 index 00000000..e691be03 --- /dev/null +++ b/examples/gradle/dokka-versioning-multimodule-example/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/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt index 6bfd22eb..6978a176 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/ChildProjectBClass.kt @@ -3,6 +3,8 @@ package demo /** - * Class defined in child module b + * Class defined in child module B + * + * @since 0.9 */ class ChildProjectBClass diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/Functions.kt b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/src/main/kotlin/demo/Functions.kt new file mode 100644 index 00000000..35a9275b --- /dev/null +++ b/examples/gradle/dokka-versioning-multimodule-example/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() {} |