diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle index 58be66b2ea..b4c6c22076 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") + } } } }