Skip to content

Change Gradle configuration to make sure "source" button is visible in all API docs (#3929) #3930

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
Nov 21, 2023
Merged
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
35 changes: 8 additions & 27 deletions gradle/dokka.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import java.net.*
apply<DokkaPlugin>()
//apply<JavaPlugin>()

fun GradleDokkaSourceSetBuilder.makeLinkMapping(projectDir: File) {
sourceLink {
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
remoteLineSuffix.set("#L")
}
}

val knit_version: String by project
tasks.withType(DokkaTaskPartial::class).configureEach {
Expand Down Expand Up @@ -45,25 +37,14 @@ tasks.withType(DokkaTaskPartial::class).configureEach {
}
}

if (project.name == "kotlinx-coroutines-core") {
// Custom configuration for MPP modules
tasks.withType(DokkaTaskPartial::class).configureEach {
dokkaSourceSets {
val commonMain by getting {
makeLinkMapping(project.file("common"))
}

val nativeMain by getting {
makeLinkMapping(project.file("native"))
}

val jsMain by getting {
makeLinkMapping(project.file("js"))
}

val jvmMain by getting {
makeLinkMapping(project.file("jvm"))
}
// Custom configuration for MPP modules
tasks.withType(DokkaTaskPartial::class).configureEach {
dokkaSourceSets.configureEach {
sourceLink {
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
remoteLineSuffix.set("#L")
}
}
}