Skip to content

Fix dokka API button for all modules #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import util.KOTLINX_RPC_PREFIX
import util.other.libs
import java.time.Year
import util.setupPage

plugins {
id("org.jetbrains.dokka")
}

dokka {
val globalRootDir: String by project.extra

pluginsConfiguration {
html {
footerMessage = "© ${Year.now()} JetBrains s.r.o and contributors. Apache License 2.0"
setupPage(globalRootDir)
}
}

Expand Down
28 changes: 9 additions & 19 deletions gradle-conventions/src/main/kotlin/conventions-root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import util.other.isPublicModule
import util.other.libs
import util.other.maybeNamed
import util.setupPage
import util.tasks.ValidatePublishedArtifactsTask
import util.tasks.configureNpm
import util.tasks.registerChangelogTask
import util.tasks.registerDumpPlatformTableTask
import util.tasks.registerVerifyPlatformTableTask
import java.time.Year
import kotlin.io.path.exists
import kotlin.io.path.isDirectory
import kotlin.io.path.listDirectoryEntries
Expand Down Expand Up @@ -46,29 +46,19 @@ dokka {

moduleVersion.set(libVersion)

val pagesDirectory = layout.projectDirectory
.dir("docs")
.dir("pages")
val globalRootDir: String by project.extra

val dokkaVersionsDirectory = pagesDirectory
.dir("api")
.asFile
val pagesDirectory = kotlin.io.path.Path(globalRootDir)
.resolve("docs")
.resolve("pages")

val templatesDirectory = pagesDirectory
.dir("templates")
val dokkaVersionsDirectory = pagesDirectory
.resolve("api")
.toFile()

pluginsConfiguration {
html {
customAssets.from(
"docs/pages/assets/logo-icon.svg",
"docs/pages/assets/homepage.svg", // Doesn't work due to https://github.com/Kotlin/dokka/issues/4007
)

footerMessage = "© ${Year.now()} JetBrains s.r.o and contributors. Apache License 2.0"
homepageLink = "https://kotlin.github.io/kotlinx-rpc/get-started.html"

// replace with homepage.svg once the mentioned issue is resolved
templatesDir.set(templatesDirectory)
setupPage(globalRootDir)
}
}

Expand Down
28 changes: 28 additions & 0 deletions gradle-conventions/src/main/kotlin/util/dokka.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

package util

import org.gradle.kotlin.dsl.assign
import org.jetbrains.dokka.gradle.engine.plugins.DokkaHtmlPluginParameters
import java.time.Year

fun DokkaHtmlPluginParameters.setupPage(globalRootDir: String) {
val templatesDirectory = kotlin.io.path.Path(globalRootDir)
.resolve("docs")
.resolve("pages")
.resolve("templates")
.toFile()

customAssets.from(
"$globalRootDir/docs/pages/assets/logo-icon.svg",
"$globalRootDir/docs/pages/assets/homepage.svg", // Doesn't work due to https://github.com/Kotlin/dokka/issues/4007
)

footerMessage = "© ${Year.now()} JetBrains s.r.o and contributors. Apache License 2.0"
homepageLink = "https://kotlin.github.io/kotlinx-rpc/get-started.html"

// replace with homepage.svg once the mentioned issue is resolved
templatesDir.set(templatesDirectory)
}