summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Yukhnevich <whyoleg@gmail.com>2023-12-04 19:26:24 +0200
committerGitHub <noreply@github.com>2023-12-04 18:26:24 +0100
commit93962a82379aac7e3c3c064c9070fa34e82a479d (patch)
treea58633f504486613ff3c59313d1a01a8a0d6cb9d
parente997d3eb33a3f40a695f22b7f75d8ef253e1df47 (diff)
downloadkotlinx.serialization-93962a82379aac7e3c3c064c9070fa34e82a479d.tar.gz
Update Gradle dokka configuration to make sure "source" button is visible in all API docs (#2518)
-rw-r--r--gradle/dokka.gradle13
1 files changed, 13 insertions, 0 deletions
diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle
index 58be66b2..b4c6c220 100644
--- a/gradle/dokka.gradle
+++ b/gradle/dokka.gradle
@@ -12,6 +12,9 @@ def documentedSubprojects = ["kotlinx-serialization-core",
"kotlinx-serialization-properties",
"kotlinx-serialization-hocon",
"kotlinx-serialization-protobuf"]
+
+def jvmOnlySubprojects = ["kotlinx-serialization-hocon"]
+
subprojects {
if (!(name in documentedSubprojects)) return
apply plugin: 'org.jetbrains.dokka'
@@ -72,6 +75,16 @@ subprojects {
matchingRegex.set("org\\.intellij\\.lang\\.annotations(\$|\\.).*")
suppress.set(true)
}
+
+ sourceLink {
+ // sources directory for MPP configured in gradle/configure-source-sets.gradle:61
+ // in short - kotlin.srcDirs = ["$sourceSet.name/src"]
+ def sourcesPath = project.name in jvmOnlySubprojects ? "src/main/kotlin" : "$name/src"
+ def relProjectPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
+ localDirectory.set(file(sourcesPath))
+ remoteUrl.set(new URL("https://github.com/Kotlin/kotlinx.serialization/tree/master/$relProjectPath/$sourcesPath"))
+ remoteLineSuffix.set("#L")
+ }
}
}
}