Skip to content

Commit

Permalink
Simplify multimodule source link configuration example (#2974)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnatBeresnev committed Apr 25, 2023
1 parent 227eb28 commit 5315c6a
Showing 1 changed file with 2 additions and 8 deletions.
Expand Up @@ -19,18 +19,12 @@ subprojects {
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.
//
// Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration
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(projectDir.resolve("src"))
remoteUrl.set(URL("$exampleDir/$projectRelativePath/src"))
localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL("$exampleDir"))
remoteLineSuffix.set("#L")
}
}
Expand Down

0 comments on commit 5315c6a

Please sign in to comment.