Skip to content

Commit

Permalink
Add source links to the dokka-multimodule-example project
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Apr 18, 2023
1 parent 115a318 commit 0bab7db
Showing 1 changed file with 14 additions and 0 deletions.
@@ -1,5 +1,6 @@
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL

plugins {
kotlin("jvm")
Expand All @@ -17,6 +18,19 @@ subprojects {
Visibility.PUBLIC,
Visibility.PROTECTED
))

// In multi-project builds, `remoteUrl` must point to that project's dir specifically, so if you
// want to configure sourceLinks at once in `subprojects {}`, you have to find the relative path.
// Alternatively, you can move this configuration up into subproject build scripts,
// and just hardcode the exact paths as demonstrated in the basic dokka-gradle-example.
sourceLink {
val exampleDir = "https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example"
val projectRelativePath = rootProject.projectDir.toPath().relativize(projectDir.toPath())

localDirectory.set(file("src"))
remoteUrl.set(URL("$exampleDir/$projectRelativePath/src"))
remoteLineSuffix.set("#L")
}
}
}
}
Expand Down

0 comments on commit 0bab7db

Please sign in to comment.