File tree Expand file tree Collapse file tree 15 files changed +203
-4
lines changed Expand file tree Collapse file tree 15 files changed +203
-4
lines changed Original file line number Diff line number Diff line change @@ -72,21 +72,40 @@ 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 : Setup Gradle
81
+ uses : gradle/actions/setup-gradle@v3
82
+
83
+ - name : Run Dokka
84
+ run : ./gradlew dokkaGenerate
85
+
86
+ - name : Move API docs to the publication directory
87
+ run :
88
+ mkdir __docs_publication_dir
89
+ cp -r docs/pages/api __docs_publication_dir/api
90
+
75
91
- name : Download artifacts
76
92
uses : actions/download-artifact@v4
77
93
with :
78
94
name : kotlinx-rpc
79
95
80
96
- name : Unzip artifact
81
- run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir
97
+ run : unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d __docs_publication_dir
98
+
99
+ - name : Update sitemap.xml
100
+ run : chmod +x updateSitemap.sh && ./updateSitemap.sh __docs_publication_dir/sitemap.xml __docs_publication_dir/api
82
101
83
102
- name : Setup Pages
84
103
uses : actions/configure-pages@v5
85
104
86
105
- name : Package and upload Pages artifact
87
106
uses : actions/upload-pages-artifact@v3
88
107
with :
89
- path : dir
108
+ path : __docs_publication_dir
90
109
91
110
- name : Deploy to GitHub Pages
92
111
id : deployment
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ lib-kotlin
19
19
! .idea /icon.svg
20
20
! .idea /detekt.xml
21
21
! .idea /kotlinTestDataPluginTestDataPaths.xml
22
+ ! .idea /kotlinx-rpc.iml
22
23
23
24
samples /** /.idea /*
24
25
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
+ // enable versioning for stable
44
+ // versioning {
45
+ // version = libDokkaVersion
46
+ // olderVersionsDir = dokkaVersionsDirectory
47
+ // }
48
+ }
49
+
50
+ dokkaPublications.html {
51
+ outputDirectory = dokkaVersionsDirectory
52
+ }
53
+
54
+ dokkaGeneratorIsolation = ProcessIsolation {
55
+ // Configures heap size, use if start to fail with OOM on CI
56
+ // maxHeapSize = "4g"
57
+ }
58
+ }
59
+
22
60
configureProjectReport()
23
61
configureNpm()
24
62
configureApiValidation()
Original file line number Diff line number Diff line change
1
+ api /**
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/" >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/" />
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
+ }
You can’t perform that action at this time.
0 commit comments