aboutsummaryrefslogtreecommitdiff
path: root/examples/gradle/dokka-multimodule-example
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-04-21 20:19:06 +0200
committerGitHub <noreply@github.com>2023-04-21 20:19:06 +0200
commit2a1c55a0ed167019ae187cd2df93b069ae97e0ee (patch)
tree8c96f73864370c0fd3192dc33174eca8d07df8f9 /examples/gradle/dokka-multimodule-example
parentf90b4287399d9fedb7e11295d853b0bda98e11e9 (diff)
downloaddokka-2a1c55a0ed167019ae187cd2df93b069ae97e0ee.tar.gz
dokka-2a1c55a0ed167019ae187cd2df93b069ae97e0ee.tar.bz2
dokka-2a1c55a0ed167019ae187cd2df93b069ae97e0ee.zip
Add source links to the dokka-multimodule-example project (#2966)
Diffstat (limited to 'examples/gradle/dokka-multimodule-example')
-rw-r--r--examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts
index da7b382e..7fb7c115 100644
--- a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts
+++ b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts
@@ -1,5 +1,6 @@
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.gradle.DokkaTaskPartial
+import java.net.URL
plugins {
kotlin("jvm")
@@ -17,6 +18,21 @@ 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.
+ //
+ // 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"))
+ remoteLineSuffix.set("#L")
+ }
}
}
}