-
Notifications
You must be signed in to change notification settings - Fork 452
Closed
Labels
Description
Describe the bug
Gradle build contains the following output:
> Task :dokkaHtml
Initializing plugins
Dokka is performing: documentation for Dokka Gradle Example
Validity check
Creating documentation models
Transforming documentation model before merging
Merging documentation models
Transforming documentation model after merging
Undocumented: demo/main/#kotlin.Array[kotlin.String]/ (jvm)
Undocumented: demo/Greeter/undocumentedFun/#/ (jvm)
Creating pages
Transforming pages
Rendering
Running post-actions
BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed
Exception in thread "Thread-539" org.jetbrains.dokka.DokkaException: Failed with warningCount=2 and errorCount=0
at org.jetbrains.dokka.base.generation.SingleModuleGeneration.reportAfterRendering(SingleModuleGeneration.kt:106)
at org.jetbrains.dokka.base.generation.SingleModuleGeneration.generate(SingleModuleGeneration.kt:55)
at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:29)
at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:17)
at org.jetbrains.dokka.DokkaGeneratorKt.timed(DokkaGenerator.kt:76)
at org.jetbrains.dokka.DokkaGeneratorKt.access$timed(DokkaGenerator.kt:1)
at org.jetbrains.dokka.DokkaGenerator.generate(DokkaGenerator.kt:22)
at org.jetbrains.dokka.DokkaBootstrapImpl.generate(DokkaBootstrapImpl.kt:58)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jetbrains.dokka.gradle.DelegatedInvocationHandler.invoke(automagicTypedProxy.kt:40)
at com.sun.proxy.$Proxy191.generate(Unknown Source)
at org.jetbrains.dokka.gradle.AbstractDokkaTask$generateDocumentation$1$1.run(AbstractDokkaTask.kt:208)
at java.base/java.lang.Thread.run(Thread.java:829)
9.19.47: Execution finished 'dokkaHtml'.
Expected behaviour
Build should fail with following output:
> Task :dokkaHtml FAILED
1 actionable task: 1 executed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dokkaHtml'.
> Failed with warningCount=2 and errorCount=0
Screenshots
N/A
To Reproduce
Take dokka-gradle-example and:
- add a new undocumented function to class
HelloWorld
- configure dokka task to report undocumented and fail on warning
See required changes in the following diff:
diff --git a/build.gradle.kts b/build.gradle.kts
index 30cb4d7..6a47044 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -32,6 +32,8 @@ tasks.withType<DokkaTask>().configureEach {
))
remoteLineSuffix.set("#L")
}
+ reportUndocumented.set(true)
+ failOnWarning.set(true)
}
}
}
diff --git a/src/main/kotlin/demo/HelloWorld.kt b/src/main/kotlin/demo/HelloWorld.kt
index 172e18f..5e39c5d 100644
--- a/src/main/kotlin/demo/HelloWorld.kt
+++ b/src/main/kotlin/demo/HelloWorld.kt
@@ -13,6 +13,10 @@ class Greeter(val name: String) {
fun greet() {
println("Hello $name!")
}
+
+ fun undocumentedFun() {
+ TODO()
+ }
}
fun main(args: Array<String>) {
Dokka configuration
Configuration of dokka used to reproduce the bug
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
named("main") {
reportUndocumented.set(true)
failOnWarning.set(true)
}
}
}
Installation
- Operating system: macOS
- Build tool: Gradle v7.6
- Dokka version: 1.8.10
Additional context
The problem was most likely introduced in PR #2678 file AbstractDokkaTask.
A separate thread is created but exceptions are not captured and propagated.
Are you willing to provide a PR?
Yes