Skip to content

Commit c7f155a

Browse files
Enable Dokka for documentation generation (#225)
Fixes #222
1 parent bd5ac10 commit c7f155a

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

core/build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
66

77
plugins {
88
id("kotlin-multiplatform")
9+
id("org.jetbrains.dokka")
910
`maven-publish`
1011
}
1112

@@ -140,6 +141,29 @@ kotlin {
140141
}
141142
}
142143

144+
dokka {
145+
pluginsConfiguration.html {
146+
templatesDir.set(projectDir.resolve("dokka-templates"))
147+
}
148+
149+
dokkaPublications.html {
150+
failOnWarning.set(true)
151+
// Enum members and undocumented toString()
152+
suppressInheritedMembers.set(true)
153+
}
154+
155+
dokkaSourceSets.configureEach {
156+
val platform = name.dropLast(4)
157+
samples.from("$platform/test")
158+
skipDeprecated.set(true)
159+
sourceLink {
160+
localDirectory.set(rootDir)
161+
remoteUrl("https://github.com/Kotlin/kotlinx.collections.immutable/tree/v0.4.0")
162+
remoteLineSuffix.set("#L")
163+
}
164+
}
165+
}
166+
143167
tasks {
144168
named("jvmTest", Test::class) {
145169
maxHeapSize = "1024m"

core/dokka-templates/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Dokka's template customization
2+
To provide unified navigation for all parts of [kotlinlang.org](https://kotlinlang.org/),
3+
the Kotlin Website Team uses this directory to place custom templates in this folder
4+
during the website build time on TeamCity.
5+
6+
It is not practical to place these templates in the kotlinx.collections.immutable repository because they change from time to time
7+
and aren't related to the library's release cycle.
8+
9+
The folder is defined as a source for custom templates by the templatesDir property through Dokka's plugin configuration.
10+
11+
[Here](https://kotlinlang.org/docs/dokka-html.html#templates), you can
12+
find more about the customization of Dokka's HTML output.

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@ version=0.4
33
versionSuffix=SNAPSHOT
44

55
kotlin_version=2.1.20
6+
dokkaVersion=2.0.0
67

78
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
9+
10+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
11+
org.jetbrains.dokka.experimental.gradle.pluginMode.nowarn=true

settings.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ pluginManagement {
88
maven(kotlinRepoUrl)
99
}
1010
}
11+
val dokkaVersion: String by settings
12+
plugins {
13+
id("org.jetbrains.dokka") version dokkaVersion
14+
}
1115
}
1216

1317
rootProject.name = "Kotlin-Immutable-Collections" // TODO: Make readable name when it's not used in js module names

0 commit comments

Comments
 (0)