Skip to content

Commit

Permalink
Update Gradle dokka configuration to make sure "source" button is vis…
Browse files Browse the repository at this point in the history
…ible in all API docs (#2518)
  • Loading branch information
whyoleg authored Dec 4, 2023
1 parent e997d3e commit 93962a8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gradle/dokka.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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")
}
}
}
}
Expand Down

0 comments on commit 93962a8

Please sign in to comment.