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:
7272 needs : [ build, test ]
7373 runs-on : ubuntu-latest
7474 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+
7591 - name : Download artifacts
7692 uses : actions/download-artifact@v4
7793 with :
7894 name : kotlinx-rpc
7995
8096 - 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
82101
83102 - name : Setup Pages
84103 uses : actions/configure-pages@v5
85104
86105 - name : Package and upload Pages artifact
87106 uses : actions/upload-pages-artifact@v3
88107 with :
89- path : dir
108+ path : __docs_publication_dir
90109
91110 - name : Deploy to GitHub Pages
92111 id : deployment
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ lib-kotlin
1919! .idea /icon.svg
2020! .idea /detekt.xml
2121! .idea /kotlinTestDataPluginTestDataPaths.xml
22+ ! .idea /kotlinx-rpc.iml
2223
2324samples /** /.idea /*
2425
Original file line number Diff line number Diff line change 33 */
44
55import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
6+ import util.asDokkaVersion
67import util.configureApiValidation
78import util.configureNpm
89import util.configureProjectReport
910import util.registerDumpPlatformTableTask
1011import util.libs
1112import util.registerVerifyPlatformTableTask
13+ import java.time.Year
1214
1315plugins {
1416 alias(libs.plugins.serialization) apply false
1517 alias(libs.plugins.kotlinx.rpc) apply false
1618 alias(libs.plugins.conventions.kover)
1719 alias(libs.plugins.conventions.gradle.doctor)
20+ alias(libs.plugins.dokka)
1821 alias(libs.plugins.atomicfu)
1922 id(" build-util" )
2023}
2124
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+
2260configureProjectReport()
2361configureNpm()
2462configureApiValidation()
Original file line number Diff line number Diff line change 1+ api /**
Original file line number Diff line number Diff line change 2222
2323 <versions-switcher >%docs-raw-path%/help-versions.json</versions-switcher >
2424
25- <generate-sitemap-url-prefix >https://www.jetbrains.com/help/ </generate-sitemap-url-prefix >
25+ <generate-sitemap-url-prefix >%host% </generate-sitemap-url-prefix >
2626
2727 <algolia-id >MMA5Z3JT91</algolia-id >
2828 <algolia-index >prod_kotlin_rpc</algolia-index >
3737
3838 <sitemap priority =" 0.35" change-frequency =" monthly" />
3939 <footer >
40- <copyright >2000-2024 JetBrains s.r.o.</copyright >
40+ <copyright >2000-2025 JetBrains s.r.o.</copyright >
4141 <link href =" https://github.com/Kotlin/kotlinx-rpc/blob/main/CONTRIBUTING.md" >Contribute to kotlinx.rpc</link >
4242 <link href =" https://kotlinlang.slack.com/archives/C072YJ3Q91V" >Slack Community</link >
43+ <link href =" %host%/api/" >API Reference</link >
4344 </footer >
4445</buildprofiles >
Original file line number Diff line number Diff line change 4949 <toc-element topic =" 0-2-4.topic" />
5050 <toc-element topic =" 0-2-1.topic" />
5151 </toc-element >
52+ <toc-element toc-title =" API Reference" href =" %host%/api/" />
5253</instance-profile >
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ dependencies {
1313
1414 api(libs.kotlin.gradle.plugin)
1515 api(libs.detekt.gradle.plugin)
16+ api(libs.dokka.gradle.plugin)
1617 api(libs.binary.compatibility.validator.gradle.plugin)
1718
1819 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