aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/DokkaGenerator.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/kotlin/DokkaGenerator.kt')
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 6f42b259..bee85325 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -9,6 +9,8 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.dokka.utilities.report
+import kotlinx.coroutines.*
+import org.jetbrains.dokka.utilities.parallelMap
/**
@@ -73,9 +75,10 @@ class DokkaGenerator(
fun createDocumentationModels(
context: DokkaContext
- ) = context.configuration.sourceSets
- .flatMap { sourceSet -> translateSources(sourceSet, context) }
- .also { modules -> if (modules.isEmpty()) exitGenerationGracefully("Nothing to document") }
+ ) = runBlocking(Dispatchers.Default) {
+ context.configuration.sourceSets.parallelMap { sourceSet -> translateSources(sourceSet, context) }.flatten()
+ .also { modules -> if (modules.isEmpty()) exitGenerationGracefully("Nothing to document") }
+ }
fun transformDocumentationModelBeforeMerge(
modulesFromPlatforms: List<DModule>,
@@ -133,8 +136,8 @@ class DokkaGenerator(
}
}
- private fun translateSources(sourceSet: DokkaSourceSet, context: DokkaContext) =
- context[CoreExtensions.sourceToDocumentableTranslator].map {
+ private suspend fun translateSources(sourceSet: DokkaSourceSet, context: DokkaContext) =
+ context[CoreExtensions.sourceToDocumentableTranslator].parallelMap {
it.invoke(sourceSet, context)
}
}