Skip to content

Commit aa54743

Browse files
fzhinkinwhyoleg
andauthored
Updated Dokka Gradle Plugin (#410)
* Updated Dokka Gradle Plugin * Updated templates dir configuration * Bump up DGP version * Fixed sample sourcesets setup * Updated external links setup * Update gradle.properties Co-authored-by: Oleg Yukhnevich <[email protected]> * Fixed templates dir configuration --------- Co-authored-by: Oleg Yukhnevich <[email protected]>
1 parent da5d774 commit aa54743

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,19 @@
11
/*
2-
* Copyright 2017-2024 JetBrains s.r.o. and respective authors and developers.
2+
* Copyright 2017-2025 JetBrains s.r.o. and respective authors and developers.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6-
import org.jetbrains.dokka.gradle.*
7-
import java.net.URL
8-
96
plugins {
107
id("org.jetbrains.dokka")
118
}
129

13-
// shared configuration for all dokka tasks (both partial and multi-module)
14-
tasks.withType<AbstractDokkaTask>().configureEach {
15-
pluginsMapConfiguration.set(
16-
mapOf(
17-
"org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${
18-
rootDir.resolve("dokka-templates")
19-
}" }"""
20-
)
21-
)
22-
}
23-
24-
tasks.withType<DokkaTaskPartial>().configureEach {
10+
dokka {
2511
dokkaSourceSets.configureEach {
2612
includes.from("Module.md")
2713

2814
sourceLink {
2915
localDirectory = rootDir
30-
remoteUrl = URL("https://github.com/kotlin/kotlinx-io/tree/master")
16+
remoteUrl("https://github.com/kotlin/kotlinx-io/tree/master")
3117
remoteLineSuffix = "#L"
3218
}
3319

@@ -39,9 +25,10 @@ tasks.withType<DokkaTaskPartial>().configureEach {
3925

4026
// as in kotlinx-io-multiplatform.gradle.kts:configureSourceSet
4127
val platform = name.dropLast(4)
42-
samples.from(
43-
"common/test/samples",
44-
"$platform/test/samples"
45-
)
28+
samples.from("$platform/test/samples")
29+
30+
}
31+
pluginsConfiguration.html {
32+
templatesDir = rootDir.resolve("dokka-templates")
4633
}
4734
}

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ dependencies {
3434
kover(project(":kotlinx-io-core"))
3535
kover(project(":kotlinx-io-bytestring"))
3636
kover(project(":kotlinx-io-okio"))
37+
38+
dokka(project(":kotlinx-io-bytestring"))
39+
dokka(project(":kotlinx-io-core"))
40+
dokka(project(":kotlinx-io-okio"))
3741
}
3842

3943
kover {

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ kotlin.code.style=official
99
org.gradle.jvmargs=-Xmx4G
1010
nativeBenchmarksEnabled=true
1111
kotlin.mpp.applyDefaultHierarchyTemplate=false
12+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
13+
org.jetbrains.dokka.experimental.gradle.pluginMode.nowarn=true

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kotlin = "2.1.0"
33
java = "8"
44
multi-release-toolchain = "17"
5-
dokka = "1.9.20"
5+
dokka = "2.0.0"
66
kover = "0.8.3"
77
bcv = "0.16.3"
88
benchmark = "0.4.13"

integration/kotlinx-io-okio/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ kotlin {
4141
}
4242
}
4343

44-
tasks.withType(DokkaTaskPartial::class) {
44+
dokka {
4545
dokkaSourceSets.configureEach {
46-
externalDocumentationLink {
47-
url = URL("https://square.github.io/okio/3.x/okio/")
48-
packageListUrl = URL("https://square.github.io/okio/3.x/okio/okio/package-list")
46+
externalDocumentationLinks.register("okio") {
47+
url("https://square.github.io/okio/3.x/okio/")
48+
packageListUrl("https://square.github.io/okio/3.x/okio/okio/package-list")
4949
}
5050
}
5151
}

0 commit comments

Comments
 (0)