File tree Expand file tree Collapse file tree 13 files changed +203
-4
lines changed Expand file tree Collapse file tree 13 files changed +203
-4
lines changed Original file line number Diff line number Diff line change @@ -72,21 +72,34 @@ jobs:
72
72
needs : [ build, test ]
73
73
runs-on : ubuntu-latest
74
74
steps :
75
+ - name : Checkout repository
76
+ uses : actions/checkout@v4
77
+ with :
78
+ fetch-depth : 0
79
+
80
+ - name : Move API docs to the publication directory
81
+ run :
82
+ mkdir __docs_publication_dir
83
+ cp -r docs/pages/api __docs_publication_dir/api
84
+
75
85
- name : Download artifacts
76
86
uses : actions/download-artifact@v4
77
87
with :
78
88
name : kotlinx-rpc
79
89
80
90
- name : Unzip artifact
81
- run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir
91
+ run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d __docs_publication_dir
92
+
93
+ - name : Update sitemap.xml
94
+ run : chmod +x updateSitemap.sh && ./updateSitemap.sh __docs_publication_dir/sitemap.xml __docs_publication_dir/api
82
95
83
96
- name : Setup Pages
84
97
uses : actions/configure-pages@v5
85
98
86
99
- name : Package and upload Pages artifact
87
100
uses : actions/upload-pages-artifact@v3
88
101
with :
89
- path : dir
102
+ path : __docs_publication_dir
90
103
91
104
- name : Deploy to GitHub Pages
92
105
id : deployment
Original file line number Diff line number Diff line change
1
+ name : Verify API Docs
2
+
3
+ on :
4
+ pull_request :
5
+
6
+ permissions :
7
+ contents : read
8
+
9
+ jobs :
10
+ verify-api-docs :
11
+ name : Up-To-Date Check
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - name : Checkout Sources
15
+ uses : actions/checkout@v4
16
+ - name : Setup Gradle
17
+ uses : gradle/actions/setup-gradle@v3
18
+ - name : Check Dokka generation is up-to-date
19
+ run : ./gradlew dokkaGenerate
20
+ - name : Check Dokka HTML output is up-to-date
21
+ run : git status --porcelain | grep "docs/pages/api/" && echo "Run `./gradlew dokkaGenerate` to update API docs and commit changes" && exit 1 || exit 0
Original file line number Diff line number Diff line change 3
3
*/
4
4
5
5
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
6
+ import util.asDokkaVersion
6
7
import util.configureApiValidation
7
8
import util.configureNpm
8
9
import util.configureProjectReport
9
10
import util.registerDumpPlatformTableTask
10
11
import util.libs
11
12
import util.registerVerifyPlatformTableTask
13
+ import java.time.Year
12
14
13
15
plugins {
14
16
alias(libs.plugins.serialization) apply false
15
17
alias(libs.plugins.kotlinx.rpc) apply false
16
18
alias(libs.plugins.conventions.kover)
17
19
alias(libs.plugins.conventions.gradle.doctor)
20
+ alias(libs.plugins.dokka)
18
21
alias(libs.plugins.atomicfu)
19
22
id(" build-util" )
20
23
}
21
24
25
+ dokka {
26
+ val libDokkaVersion = libs.versions.kotlinx.rpc.get().asDokkaVersion()
27
+
28
+ moduleVersion.set(libDokkaVersion)
29
+
30
+ val dokkaVersionsDirectory = layout.projectDirectory
31
+ .dir(" docs" )
32
+ .dir(" pages" )
33
+ .dir(" api" )
34
+ .asFile
35
+
36
+
37
+ pluginsConfiguration {
38
+ html {
39
+ customAssets.from(" .github/images/logo-icon.svg" )
40
+ footerMessage = " © ${Year .now()} JetBrains s.r.o and contributors. Apache License 2.0"
41
+ }
42
+
43
+ versioning {
44
+ version = libDokkaVersion
45
+ olderVersionsDir = dokkaVersionsDirectory
46
+ }
47
+ }
48
+
49
+ dokkaPublications.html {
50
+ outputDirectory = dokkaVersionsDirectory.resolve(libDokkaVersion)
51
+ }
52
+
53
+ dokkaGeneratorIsolation = ProcessIsolation {
54
+ // Configures heap size, use if start to fail with OOM on CI
55
+ // maxHeapSize = "4g"
56
+ }
57
+ }
58
+
22
59
configureProjectReport()
23
60
configureNpm()
24
61
configureApiValidation()
Original file line number Diff line number Diff line change 22
22
23
23
<versions-switcher >%docs-raw-path%/help-versions.json</versions-switcher >
24
24
25
- <generate-sitemap-url-prefix >https://www.jetbrains.com/help/ </generate-sitemap-url-prefix >
25
+ <generate-sitemap-url-prefix >%host% </generate-sitemap-url-prefix >
26
26
27
27
<algolia-id >MMA5Z3JT91</algolia-id >
28
28
<algolia-index >prod_kotlin_rpc</algolia-index >
37
37
38
38
<sitemap priority =" 0.35" change-frequency =" monthly" />
39
39
<footer >
40
- <copyright >2000-2024 JetBrains s.r.o.</copyright >
40
+ <copyright >2000-2025 JetBrains s.r.o.</copyright >
41
41
<link href =" https://github.com/Kotlin/kotlinx-rpc/blob/main/CONTRIBUTING.md" >Contribute to kotlinx.rpc</link >
42
42
<link href =" https://kotlinlang.slack.com/archives/C072YJ3Q91V" >Slack Community</link >
43
+ <link href =" %host%/api/%kotlinx-rpc-version%/" >API Reference</link >
43
44
</footer >
44
45
</buildprofiles >
Original file line number Diff line number Diff line change 49
49
<toc-element topic =" 0-2-4.topic" />
50
50
<toc-element topic =" 0-2-1.topic" />
51
51
</toc-element >
52
+ <toc-element toc-title =" API Reference" href =" %host%/api/%kotlinx-rpc-version%/" />
52
53
</instance-profile >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ dependencies {
13
13
14
14
api(libs.kotlin.gradle.plugin)
15
15
api(libs.detekt.gradle.plugin)
16
+ api(libs.dokka.gradle.plugin)
16
17
api(libs.binary.compatibility.validator.gradle.plugin)
17
18
18
19
if (isLatestKotlinVersion) {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+ package util
6
+
7
+ import org.gradle.api.Project
8
+ import org.gradle.kotlin.dsl.configure
9
+ import org.jetbrains.dokka.gradle.DokkaExtension
10
+ import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
11
+
12
+ fun String.asDokkaVersion () = removeSuffix(" -SNAPSHOT" )
13
+
14
+ fun Project.applyDokka () {
15
+ if (! isPublicModule) {
16
+ return
17
+ }
18
+
19
+ plugins.apply (libs.plugins.dokka.get().pluginId)
20
+
21
+ configure<DokkaExtension > {
22
+ moduleName.set(" $KOTLINX_RPC_PREFIX -${project.name} " )
23
+
24
+ dokkaSourceSets.configureEach {
25
+ sourceLink {
26
+ localDirectory.set(rootDir)
27
+ remoteUrl(" https://github.com/Kotlin/kotlinx-rpc/blob/${libs.versions.kotlinx.rpc.get().asDokkaVersion()} " )
28
+ remoteLineSuffix.set(" #L" )
29
+
30
+ documentedVisibilities.set(
31
+ setOf (
32
+ VisibilityModifier .Public ,
33
+ VisibilityModifier .Protected ,
34
+ )
35
+ )
36
+ }
37
+ }
38
+
39
+ dokkaPublications.configureEach {
40
+ suppressObviousFunctions.set(true )
41
+ failOnWarning.set(true )
42
+ }
43
+ }
44
+
45
+ val thisProject = project
46
+
47
+ rootProject.configurations.matching { it.name == " dokka" }.all {
48
+ rootProject.dependencies.add(" dokka" , thisProject)
49
+ }
50
+ }
Original file line number Diff line number Diff line change 5
5
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
6
6
import util.configureJvm
7
7
import util.optInForRpcApi
8
+ import util.applyDokka
8
9
9
10
plugins {
10
11
id(" conventions-common" )
@@ -26,3 +27,5 @@ configure<KotlinJvmProjectExtension> {
26
27
}
27
28
28
29
configureJvm(isKmp = false )
30
+
31
+ applyDokka()
Original file line number Diff line number Diff line change 4
4
5
5
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
6
6
import util.*
7
+ import util.applyDokka
7
8
8
9
plugins {
9
10
id(" conventions-common" )
@@ -23,3 +24,5 @@ withKotlinConfig {
23
24
}
24
25
25
26
configureJvm(isKmp = true )
27
+
28
+ applyDokka()
You can’t perform that action at this time.
0 commit comments