Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source links to the dokka-multimodule-example project #2966

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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,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.
IgnatBeresnev marked this conversation as resolved.
Show resolved Hide resolved
//
// 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"))
IgnatBeresnev marked this conversation as resolved.
Show resolved Hide resolved
remoteUrl.set(URL("$exampleDir/$projectRelativePath/src"))
remoteLineSuffix.set("#L")
}
}
}
}
Expand Down
Loading