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

Gradle build successful even though there are Dokka failures #2934

Closed
jush opened this issue Mar 21, 2023 · 0 comments · Fixed by #2935
Closed

Gradle build successful even though there are Dokka failures #2934

jush opened this issue Mar 21, 2023 · 0 comments · Fixed by #2935
Labels

Comments

@jush
Copy link
Contributor

jush commented Mar 21, 2023

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:

  1. add a new undocumented function to class HelloWorld
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant