Skip to content

Commit 70cd332

Browse files
committed
Update Gradle dokka configuration to make sure "source" button is visible in all API docs
1 parent 53ffd13 commit 70cd332

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,5 +381,18 @@ tasks.withType<AbstractDokkaLeafTask>().configureEach {
381381
matchingRegex.set(".*\\.internal\\..*")
382382
suppress.set(true)
383383
}
384+
385+
if (name.endsWith("Main")) {
386+
sourceLink {
387+
// sources are located in PLATFORM/src,
388+
// where PLATFORM could be jvm, js, darwin, etc
389+
// configuration happens upper in the build script
390+
val platform = name.dropLast(4)
391+
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
392+
localDirectory.set(projectDir.resolve("$platform/src"))
393+
remoteUrl.set(URL("https://github.com/kotlin/kotlinx-datetime/tree/master/$relPath/$platform/src"))
394+
remoteLineSuffix.set("#L")
395+
}
396+
}
384397
}
385398
}

0 commit comments

Comments
 (0)