aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt4
1 files changed, 4 insertions, 0 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt
index d4314e37..066374e5 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/tasks/AbstractDokkaTask.kt
@@ -20,6 +20,7 @@ import org.gradle.work.DisableCachingByDefault
import org.jetbrains.dokka.*
import org.jetbrains.dokka.plugability.ConfigurableBlock
import org.jetbrains.dokka.plugability.DokkaPlugin
+import java.util.concurrent.atomic.AtomicReference
import java.util.function.BiConsumer
import kotlin.reflect.full.createInstance
@@ -203,14 +204,17 @@ abstract class AbstractDokkaTask : DefaultTask() {
internal open fun generateDocumentation() {
DokkaBootstrap(runtime, DokkaBootstrapImpl::class).apply {
configure(buildDokkaConfiguration().toCompactJsonString(), createProxyLogger())
+ val uncaughtExceptionHolder = AtomicReference<Throwable?>()
/**
* Run in a new thread to avoid memory leaks that are related to ThreadLocal (that keeps `URLCLassLoader`)
* Currently, all `ThreadLocal`s leaking are in the compiler/IDE codebase.
*/
Thread { generate() }.apply {
+ setUncaughtExceptionHandler { _, throwable -> uncaughtExceptionHolder.set(throwable) }
start()
join()
}
+ uncaughtExceptionHolder.get()?.let { throw it }
}
}