From 1d0cdc6759da09cc1b3a85f426c8d541bf91c590 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Wed, 7 Feb 2024 10:53:29 -0800 Subject: [PATCH] Add version to API ref (#314) --- build.gradle.kts | 10 ++++++++++ gradle/libs.versions.toml | 1 + kdoc/build.gradle.kts | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index a19011850..1de87b2aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,3 +25,13 @@ plugins { alias(libs.plugins.kotlin.serialization) apply false alias(libs.plugins.dokka) apply false } + +buildscript { + dependencies { + // there doesn't appear to be a better way to provide this to subprojects. + // this is what lets us put the version number dropdown list in the generated dokka. + // it is a "dokka plugin" which is not a gradle plugin, it needs to be on the classpath + // before any dependent subproject uses its symbols to configure a dokka task. + classpath(libs.dokka.versioning) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6ac06109f..daadcb1c9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -40,6 +40,7 @@ kotlinx-serialization-core = { group = "org.jetbrains.kotlinx", name = "kotlinx- kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesTest" } truth = { group = "com.google.truth", name = "truth", version.ref = "truth" } +dokka-versioning = { group = "org.jetbrains.dokka", name = "versioning-plugin", version.ref = "dokka" } [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } diff --git a/kdoc/build.gradle.kts b/kdoc/build.gradle.kts index b6d0117dc..af135609d 100644 --- a/kdoc/build.gradle.kts +++ b/kdoc/build.gradle.kts @@ -54,6 +54,9 @@ tasks { //./gradlew :documentation:dokkaHtml // doc output will be under `documentation/build/dokka/html`. dokkaHtml { + pluginConfiguration { + version = versionNumber + } moduleName.set("arcgis-maps-kotlin-toolkit") dokkaSourceSets { configureEach { @@ -93,6 +96,9 @@ android { } dependencies { + // Puts the version in the KDoc + dokkaPlugin(libs.dokka.versioning) + project.afterEvaluate { releasedModules.forEach { proj -> proj.configurations.forEach { config ->