From 43932acfbd18b5f97a908f4b6743ee30e705fa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Pr=C3=BCnster?= Date: Wed, 9 Oct 2024 09:39:26 +0200 Subject: [PATCH] migrate to dokka 2 --- .github/workflows/publish-pages-only.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- CHANGELOG.md | 8 ++++++++ build.gradle.kts | 23 +++++++++++++++-------- gradle.properties | 3 ++- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-pages-only.yml b/.github/workflows/publish-pages-only.yml index d8f9a63..542e251 100644 --- a/.github/workflows/publish-pages-only.yml +++ b/.github/workflows/publish-pages-only.yml @@ -17,14 +17,14 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build Dokka HTML - run: ./gradlew dokkaHtml + run: ./gradlew dokkaGenerate - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: # Upload docs folder - path: './docs' + path: './docs/html' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58cd977..b04aae0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,14 +35,14 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build Dokka HTML - run: ./gradlew dokkaHtml + run: ./gradlew dokkaGenerate - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: # Upload docs folder - path: './docs' + path: './docs/html' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b54735..95ad670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,3 +44,11 @@ - add `recoverCatching` to match Kotlin's `result` - add `callsInPlace` contracts - return result fon `onFailure` and `onSuccess` + +## 1.7.1 +- migrate to dokka 2 for documentation +- multi-module project setup +- introduce `kmmresult-test`, enabling + - `result should succeed` + - `result shouldNot succeed` + - `result shouldSucceedWith expectedValue` diff --git a/build.gradle.kts b/build.gradle.kts index 4486921..42a4412 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,13 @@ import io.gitlab.arturbosch.detekt.Detekt import org.gradle.kotlin.dsl.support.listFilesOrdered -import org.jetbrains.kotlin.build.joinToReadableString +import java.net.URI plugins { kotlin("multiplatform") version "2.0.0" id("maven-publish") id("signing") id("io.github.gradle-nexus.publish-plugin") version "1.3.0" - id("org.jetbrains.dokka") version "1.9.20" + id("org.jetbrains.dokka") version "2.0.0-Beta" id("org.jetbrains.kotlinx.kover") version "0.8.0" id("io.gitlab.arturbosch.detekt") version "1.23.6" } @@ -21,8 +21,7 @@ repositories { } val dokkaOutputDir = "$projectDir/docs" -tasks.dokkaHtml { - +dokka { val moduleDesc = File("$rootDir/dokka-tmp.md").also { it.createNewFile() } val readme = File("${rootDir}/README.md").readText() @@ -37,24 +36,32 @@ tasks.dokkaHtml { sourceLink { localDirectory.set(file("src/$name/kotlin")) remoteUrl.set( - uri("https://github.com/a-sit-plus/kmmresult/tree/development/src/$name/kotlin").toURL() + URI("https://github.com/a-sit-plus/kmmresult/tree/development/src/$name/kotlin") ) // Suffix which is used to append the line number to the URL. Use #L for GitHub remoteLineSuffix.set("#L") } } } - outputDirectory.set(file("${rootDir}/docs")) + dokkaPublicationDirectory.set(file("${rootDir}/docs")) + pluginsConfiguration.html { + footerMessage = "© 2024 A-SIT Plus GmbH" + } + +} + +tasks.dokkaGenerate { doLast { rootDir.listFilesOrdered { it.extension.lowercase() == "png" || it.extension.lowercase() == "svg" } - .forEach { it.copyTo(File("$rootDir/docs/${it.name}"), overwrite = true) } + .forEach { it.copyTo(File("$rootDir/docs/html/${it.name}"), overwrite = true) } + } } val deleteDokkaOutputDir by tasks.register("deleteDokkaOutputDirectory") { delete(dokkaOutputDir) } val javadocJar = tasks.register("javadocJar") { - dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml) + dependsOn(deleteDokkaOutputDir, tasks.dokkaGenerate) archiveClassifier.set("javadoc") from(dokkaOutputDir) } diff --git a/gradle.properties b/gradle.properties index 33765e6..44be32f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,5 @@ kotlin.mpp.enableCInteropCommonization=true kotlin.mpp.stability.nowarn=true kotlin.native.ignoreDisabledTargets=true -artifactVersion = 1.7.0 \ No newline at end of file +artifactVersion = 1.7.1 +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled \ No newline at end of file