Skip to content

Commit 28ed2cd

Browse files
Change Gradle configuration to make sure "source" button is visible in all API docs (#3929) (#3930)
1 parent ecb5b3e commit 28ed2cd

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

gradle/dokka.gradle.kts

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ import java.net.*
99
apply<DokkaPlugin>()
1010
//apply<JavaPlugin>()
1111

12-
fun GradleDokkaSourceSetBuilder.makeLinkMapping(projectDir: File) {
13-
sourceLink {
14-
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
15-
localDirectory.set(projectDir.resolve("src"))
16-
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
17-
remoteLineSuffix.set("#L")
18-
}
19-
}
2012

2113
val knit_version: String by project
2214
tasks.withType(DokkaTaskPartial::class).configureEach {
@@ -45,25 +37,14 @@ tasks.withType(DokkaTaskPartial::class).configureEach {
4537
}
4638
}
4739

48-
if (project.name == "kotlinx-coroutines-core") {
49-
// Custom configuration for MPP modules
50-
tasks.withType(DokkaTaskPartial::class).configureEach {
51-
dokkaSourceSets {
52-
val commonMain by getting {
53-
makeLinkMapping(project.file("common"))
54-
}
55-
56-
val nativeMain by getting {
57-
makeLinkMapping(project.file("native"))
58-
}
59-
60-
val jsMain by getting {
61-
makeLinkMapping(project.file("js"))
62-
}
63-
64-
val jvmMain by getting {
65-
makeLinkMapping(project.file("jvm"))
66-
}
40+
// Custom configuration for MPP modules
41+
tasks.withType(DokkaTaskPartial::class).configureEach {
42+
dokkaSourceSets.configureEach {
43+
sourceLink {
44+
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
45+
localDirectory.set(projectDir.resolve("src"))
46+
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
47+
remoteLineSuffix.set("#L")
6748
}
6849
}
6950
}

0 commit comments

Comments
 (0)