Skip to content

Commit

Permalink
migrate to dokka 2
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusMcCloud committed Oct 9, 2024
1 parent 984255b commit 43932ac
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-pages-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
23 changes: 15 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -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()
Expand All @@ -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<Delete>("deleteDokkaOutputDirectory") {
delete(dokkaOutputDir)
}
val javadocJar = tasks.register<Jar>("javadocJar") {
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
dependsOn(deleteDokkaOutputDir, tasks.dokkaGenerate)
archiveClassifier.set("javadoc")
from(dokkaOutputDir)
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true

artifactVersion = 1.7.0
artifactVersion = 1.7.1
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

0 comments on commit 43932ac

Please sign in to comment.