Skip to content

Commit 2e7f767

Browse files
committed
Simplify Dokka source link configuration
1 parent 69dc487 commit 2e7f767

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

gradle/dokka.gradle.kts

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,12 @@ tasks.withType(DokkaTaskPartial::class).configureEach {
3737
}
3838
}
3939

40-
fun GradleDokkaSourceSetBuilder.makeLinkMapping(projectDir: File) {
41-
sourceLink {
42-
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
43-
localDirectory.set(projectDir.resolve("src"))
44-
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
45-
remoteLineSuffix.set("#L")
46-
}
47-
}
48-
49-
if (project.isMultiplatform) {
50-
// Configuration for MPP modules
51-
tasks.withType(DokkaTaskPartial::class).configureEach {
52-
// sources in MPP are located in moduleDir/PLATFORM/src,
53-
// where PLATFORM could be jvm, js, jdk8, concurrent, etc
54-
// configuration happens in buildSrc/src/main/kotlin/SourceSetsKt.configureMultiplatform
55-
dokkaSourceSets.matching { it.name.endsWith("Main") }.configureEach {
56-
val platform = name.dropLast(4)
57-
makeLinkMapping(project.file(platform))
58-
}
59-
}
60-
} else {
61-
// Configuration for JVM modules
62-
tasks.withType(DokkaTaskPartial::class).configureEach {
63-
dokkaSourceSets.named("main") {
64-
makeLinkMapping(projectDir)
40+
tasks.withType(DokkaTaskPartial::class).configureEach {
41+
dokkaSourceSets.configureEach {
42+
sourceLink {
43+
localDirectory.set(rootDir)
44+
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master"))
45+
remoteLineSuffix.set("#L")
6546
}
6647
}
6748
}

0 commit comments

Comments
 (0)