From 47008286803ad6e01b7ef61c5d81b27028a09fa5 Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Tue, 17 Dec 2024 13:49:11 +0100 Subject: [PATCH] Update to Dokka 2.0 (#3553) --- .github/workflows/githubpages.yaml | 5 +- .../core/arrow-annotations/build.gradle.kts | 1 + arrow-libs/core/arrow-atomic/build.gradle.kts | 1 + .../core/arrow-autoclose/build.gradle.kts | 1 + .../core/arrow-cache4k/build.gradle.kts | 1 + .../arrow-core-high-arity/build.gradle.kts | 1 + .../core/arrow-core-retrofit/build.gradle.kts | 1 + .../arrow-core-serialization/build.gradle.kts | 1 + arrow-libs/core/arrow-core/build.gradle.kts | 1 + arrow-libs/core/arrow-eval/build.gradle.kts | 1 + .../core/arrow-functions/build.gradle.kts | 1 + .../core/arrow-platform/build.gradle.kts | 1 + .../fx/arrow-collectors/build.gradle.kts | 1 + .../fx/arrow-fx-coroutines/build.gradle.kts | 1 + arrow-libs/fx/arrow-fx-stm/build.gradle.kts | 1 + .../arrow-optics-compose/build.gradle.kts | 1 + .../arrow-optics-reflect/build.gradle.kts | 1 + .../optics/arrow-optics/build.gradle.kts | 1 + .../arrow-resilience/build.gradle.kts | 1 + build.gradle.kts | 56 +++++++++++-------- gradle.properties | 5 ++ gradle/libs.versions.toml | 2 +- static/img/logo/logo-icon.svg | 6 ++ 23 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 static/img/logo/logo-icon.svg diff --git a/.github/workflows/githubpages.yaml b/.github/workflows/githubpages.yaml index be75c8a6949..947ef5dc315 100644 --- a/.github/workflows/githubpages.yaml +++ b/.github/workflows/githubpages.yaml @@ -29,7 +29,10 @@ jobs: cache-read-only: ${{ github.ref != 'refs/heads/main' }} - name: assemble - run: ./gradlew -Pversion=${{ github.event.release.tag_name }} dokkaHtmlMultiModule -Pgithubpages=true --max-workers 1 + run: ./gradlew -Pversion=${{ github.event.release.tag_name }} :dokkaGenerate -Pgithubpages=true + + - name: copy CNAME + run: cp static/CNAME docs - name: Deploy to gh-pages uses: peaceiris/actions-gh-pages@v4 diff --git a/arrow-libs/core/arrow-annotations/build.gradle.kts b/arrow-libs/core/arrow-annotations/build.gradle.kts index 1b9e385f48d..acacd800ceb 100644 --- a/arrow-libs/core/arrow-annotations/build.gradle.kts +++ b/arrow-libs/core/arrow-annotations/build.gradle.kts @@ -9,6 +9,7 @@ plugins { alias(libs.plugins.arrowGradleConfig.kotlin) alias(libs.plugins.publish) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-atomic/build.gradle.kts b/arrow-libs/core/arrow-atomic/build.gradle.kts index 24c46d57792..2ed417786a0 100644 --- a/arrow-libs/core/arrow-atomic/build.gradle.kts +++ b/arrow-libs/core/arrow-atomic/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-autoclose/build.gradle.kts b/arrow-libs/core/arrow-autoclose/build.gradle.kts index ed91a7a6df8..5fd1eb9d32b 100644 --- a/arrow-libs/core/arrow-autoclose/build.gradle.kts +++ b/arrow-libs/core/arrow-autoclose/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-cache4k/build.gradle.kts b/arrow-libs/core/arrow-cache4k/build.gradle.kts index 4ea66333c98..cc22892117e 100644 --- a/arrow-libs/core/arrow-cache4k/build.gradle.kts +++ b/arrow-libs/core/arrow-cache4k/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } apply(from = property("ANIMALSNIFFER_MPP")) diff --git a/arrow-libs/core/arrow-core-high-arity/build.gradle.kts b/arrow-libs/core/arrow-core-high-arity/build.gradle.kts index a6d64bbe79f..102f708064e 100644 --- a/arrow-libs/core/arrow-core-high-arity/build.gradle.kts +++ b/arrow-libs/core/arrow-core-high-arity/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-core-retrofit/build.gradle.kts b/arrow-libs/core/arrow-core-retrofit/build.gradle.kts index 27346d0ab9a..ace23bd4949 100644 --- a/arrow-libs/core/arrow-core-retrofit/build.gradle.kts +++ b/arrow-libs/core/arrow-core-retrofit/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.kotlinx.serialization) // Needed for testing only alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-core-serialization/build.gradle.kts b/arrow-libs/core/arrow-core-serialization/build.gradle.kts index aadc1dfd6b1..51aade60491 100644 --- a/arrow-libs/core/arrow-core-serialization/build.gradle.kts +++ b/arrow-libs/core/arrow-core-serialization/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) id(libs.plugins.kotlinx.serialization.get().pluginId) } diff --git a/arrow-libs/core/arrow-core/build.gradle.kts b/arrow-libs/core/arrow-core/build.gradle.kts index 308d0932623..844c9e33ea5 100644 --- a/arrow-libs/core/arrow-core/build.gradle.kts +++ b/arrow-libs/core/arrow-core/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-eval/build.gradle.kts b/arrow-libs/core/arrow-eval/build.gradle.kts index ee0313aed2d..ed14ceb25e8 100644 --- a/arrow-libs/core/arrow-eval/build.gradle.kts +++ b/arrow-libs/core/arrow-eval/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-functions/build.gradle.kts b/arrow-libs/core/arrow-functions/build.gradle.kts index b9914abb255..9fe53d91046 100644 --- a/arrow-libs/core/arrow-functions/build.gradle.kts +++ b/arrow-libs/core/arrow-functions/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/core/arrow-platform/build.gradle.kts b/arrow-libs/core/arrow-platform/build.gradle.kts index e863afadf7b..e20744c592a 100644 --- a/arrow-libs/core/arrow-platform/build.gradle.kts +++ b/arrow-libs/core/arrow-platform/build.gradle.kts @@ -9,6 +9,7 @@ plugins { alias(libs.plugins.arrowGradleConfig.kotlin) alias(libs.plugins.publish) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/fx/arrow-collectors/build.gradle.kts b/arrow-libs/fx/arrow-collectors/build.gradle.kts index cd714dfd748..cd193a68826 100644 --- a/arrow-libs/fx/arrow-collectors/build.gradle.kts +++ b/arrow-libs/fx/arrow-collectors/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.spotless) alias(libs.plugins.kotlinx.kover) + alias(libs.plugins.dokka) } apply(from = property("ANIMALSNIFFER_MPP")) diff --git a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts index dc909f0efc5..034993836b0 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts +++ b/arrow-libs/fx/arrow-fx-coroutines/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/fx/arrow-fx-stm/build.gradle.kts b/arrow-libs/fx/arrow-fx-stm/build.gradle.kts index 6cc4466bf75..de813971830 100644 --- a/arrow-libs/fx/arrow-fx-stm/build.gradle.kts +++ b/arrow-libs/fx/arrow-fx-stm/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/optics/arrow-optics-compose/build.gradle.kts b/arrow-libs/optics/arrow-optics-compose/build.gradle.kts index 15945d271d8..91f27a1cace 100644 --- a/arrow-libs/optics/arrow-optics-compose/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics-compose/build.gradle.kts @@ -18,6 +18,7 @@ plugins { alias(libs.plugins.compose.jetbrains) alias(libs.plugins.compose.compiler) alias(libs.plugins.android.library) + alias(libs.plugins.dokka) } apply(from = property("ANIMALSNIFFER_MPP")) diff --git a/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts b/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts index 6f57cda752f..5b22bdbf3a0 100644 --- a/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics-reflect/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/optics/arrow-optics/build.gradle.kts b/arrow-libs/optics/arrow-optics/build.gradle.kts index eb419c1654c..2c0cbc11d93 100644 --- a/arrow-libs/optics/arrow-optics/build.gradle.kts +++ b/arrow-libs/optics/arrow-optics/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/arrow-libs/resilience/arrow-resilience/build.gradle.kts b/arrow-libs/resilience/arrow-resilience/build.gradle.kts index 0df872e9388..5e9807ed372 100644 --- a/arrow-libs/resilience/arrow-resilience/build.gradle.kts +++ b/arrow-libs/resilience/arrow-resilience/build.gradle.kts @@ -10,6 +10,7 @@ plugins { alias(libs.plugins.publish) alias(libs.plugins.kotlinx.kover) alias(libs.plugins.spotless) + alias(libs.plugins.dokka) } spotless { diff --git a/build.gradle.kts b/build.gradle.kts index de73f797c26..ea865b2f98f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,12 +2,9 @@ import kotlinx.knit.KnitPluginExtension import kotlinx.validation.ExperimentalBCVApi -import org.jetbrains.dokka.gradle.DokkaMultiModuleTask import org.jetbrains.dokka.gradle.DokkaTaskPartial -import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi -import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import java.net.URL allprojects { if (property("version") == "unspecified") { @@ -89,6 +86,28 @@ allprojects { group = property("projects.group").toString() } +dependencies { + dokka(projects.arrowAnnotations) + dokka(projects.arrowAtomic) + dokka(projects.arrowAutoclose) + dokka(projects.arrowCore) + dokka(projects.arrowCoreHighArity) + dokka(projects.arrowCoreRetrofit) + dokka(projects.arrowCoreSerialization) + dokka(projects.arrowCache4k) + dokka(projects.arrowEval) + dokka(projects.arrowFunctions) + dokka(projects.arrowPlatform) + dokka(projects.arrowFxCoroutines) + dokka(projects.arrowFxStm) + dokka(projects.arrowCollectors) + dokka(projects.arrowOptics) + dokka(projects.arrowOpticsReflect) + dokka(projects.arrowOpticsCompose) + dokka(projects.arrowResilience) +} + + private val kotlinXUpstream = setOf( "arrow-fx-coroutines", @@ -114,7 +133,7 @@ subprojects { kotlinSourceSet.kotlin.srcDirs.filter { it.exists() }.forEach { srcDir -> sourceLink { localDirectory.set(srcDir) -remoteUrl.set(uri("https://github.com/arrow-kt/arrow/blob/main/${srcDir.relativeTo(rootProject.rootDir)}").toURL()) + remoteUrl.set(URL("https://github.com/arrow-kt/arrow/blob/main/${srcDir.relativeTo(rootProject.rootDir)}")) remoteLineSuffix.set("#L") } } @@ -123,26 +142,19 @@ remoteUrl.set(uri("https://github.com/arrow-kt/arrow/blob/main/${srcDir.relative } } -tasks { - val undocumentedProjects = - listOf(project(":arrow-optics-ksp-plugin")) - - val copyCNameFile = register("copyCNameFile") { - from(layout.projectDirectory.dir("static").file("CNAME")) - into(layout.projectDirectory.dir("docs")) +dokka { + dokkaPublications.html { + outputDirectory.set(layout.projectDirectory.dir("docs")) } - - dokkaHtmlMultiModule { - dependsOn(copyCNameFile) - removeChildTasks(undocumentedProjects) + moduleName.set("Arrow") + pluginsConfiguration.html { + customAssets.from("static/img/logo/logo-icon.svg") + footerMessage.set("© Arrow Contributors") } +} - getByName("knitPrepare").dependsOn(getTasksByName("dokka", true)) - - withType().configureEach { - outputDirectory.set(file("docs")) - moduleName.set("Arrow") - } +tasks.getByName("knitPrepare") { + dependsOn(tasks.dokkaGenerate) } apiValidation { diff --git a/gradle.properties b/gradle.properties index ac7d7e95354..21f96c5cd71 100644 --- a/gradle.properties +++ b/gradle.properties @@ -32,6 +32,11 @@ systemProp.org.gradle.internal.publish.checksums.insecure=true kotlin.stdlib.default.dependency=false kotlin.mpp.applyDefaultHierarchyTemplate=false +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled +org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true +org.jetbrains.dokka.experimental.tryK2=true +org.jetbrains.dokka.experimental.tryK2.nowarn=true + ANIMALSNIFFER=../../gradle/animalsniffer.gradle ANIMALSNIFFER_MPP=../../gradle/animalsniffer-mpp.gradle diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cb1e2729169..9920e079010 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ animalSniffer = "1.7.2" arrowGradleConfig = "0.12.0-rc.24" coroutines = "1.9.0" classgraph = "4.8.179" -dokka = "1.9.20" +dokka = "2.0.0" kotest = "6.0.0.M1" kover = "0.9.0" kotlin = "2.1.0" diff --git a/static/img/logo/logo-icon.svg b/static/img/logo/logo-icon.svg new file mode 100644 index 00000000000..85f7b2f77a7 --- /dev/null +++ b/static/img/logo/logo-icon.svg @@ -0,0 +1,6 @@ + + + + + +