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 (Kotlin#2518)
  • Loading branch information
whyoleg authored and xiaozhikang0916 committed Jan 14, 2024
1 parent b3f6e0f commit ca45932
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 ca45932

Please sign in to comment.