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
Configuring sourceLink
per task is incompatible with configuration caching
#54
Comments
Thanks for the issue, I've made a reproducer: #55 It seems to specifically be triggered by cross-project dependencies. I couldn't reproduce it in a single project. I don't know what the cause might be. Unfortunately Gradle's Configuration Cache reports are essentially useless, they don't help diagnose anything. |
Sorry, I forgot to talk about the project where I encountered this issue: https://github.com/GW2ToolBelt/api-generator/tree/0dae12da6a993333511227b59d7905ac515d6815. I didn't prepare a reproducer because the build is fairly straightforward. All relevant stuff is happening in build.gradle.kts. There are no cross-project dependencies involved in my build. The relevant sections should be: plugins {
alias(libs.plugins.binary.compatibility.validator)
alias(libs.plugins.dokkatoo.html) // 1.1.1
alias(libs.plugins.dokkatoo.javadoc) // 1.1.1
alias(libs.plugins.gradle.toolchain.switches)
alias(libs.plugins.kotlin.jvm) // 1.8.20
alias(libs.plugins.kotlin.plugin.serialization) // 1.8.20
id("com.gw2tb.maven-publish-conventions")
} tasks {
dokkatooGenerateModuleHtml.configure {
outputDirectory.set(layout.buildDirectory.dir("mkdocs/sources/api"))
dokkaSourceSets.configureEach {
reportUndocumented.set(true)
skipEmptyPackages.set(true)
jdkVersion.set(8)
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/GW2ToolBelt/api-generator/tree/v${version}/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
} You can reproduce the issue by checking out this specific commit locally and executing the |
I think the issue is actually contained within the build script, and it isn't an issue with Dokkatoo. This line uses the localDirectory.set(file("src/main/kotlin")) If you refactor the script so it assigns the directory to a variable, it should work. tasks {
dokkatooGenerateModuleHtml.configure {
// define a val to be compatible with CC
val srcMainKotlinDir = layout.projectDirectory.dir("src/main/kotlin")
outputDirectory.set(layout.buildDirectory.dir("mkdocs/sources/api"))
dokkaSourceSets.configureEach {
reportUndocumented.set(true)
skipEmptyPackages.set(true)
jdkVersion.set(8)
sourceLink {
localDirectory.set(srcMainKotlinDir)
remoteUrl.set(URL("https://github.com/GW2ToolBelt/api-generator/tree/v${version}/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
} @TheMrMilchmann could you check, please? |
It is not only that, but also diff --git a/build.gradle.kts b/build.gradle.kts
index 1acf54f..be5d7f8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -89,13 +89,15 @@ tasks {
dokkatooGenerateModuleHtml.configure {
outputDirectory.set(layout.buildDirectory.dir("mkdocs/sources/api"))
+ val version = project.version
+ val srcMainKotlin = layout.projectDirectory.dir("src/main/kotlin")
dokkaSourceSets.configureEach {
reportUndocumented.set(true)
skipEmptyPackages.set(true)
jdkVersion.set(8)
sourceLink {
- localDirectory.set(file("src/main/kotlin"))
+ localDirectory.set(srcMainKotlin)
remoteUrl.set(URL("https://github.com/GW2ToolBelt/api-generator/tree/v${version}/src/main/kotlin"))
remoteLineSuffix.set("#L")
} |
Agreed! I wish that the HTML report provided more useful information. gradle/gradle#24030 |
The following snippet introduces references to objects that cause incompatibilities with Gradle's configuration caching:
tasks { dokkatooGenerateModuleHtml.configure { dokkaSourceSets.configureEach { sourceLink { // ... } } } }
Writing the configuration cache fails (see also):
This issue does not occur when configuring the
sourceLink
via thedokkatoo
extension.The text was updated successfully, but these errors were encountered: