From 720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Mon, 6 Apr 2020 15:58:55 +0200 Subject: Adds asynchronous rendering --- core/src/main/kotlin/DokkaGenerator.kt | 11 ++++++++++- core/src/main/kotlin/renderers/Renderer.kt | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 053b4cb6..0a797769 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -3,6 +3,10 @@ package org.jetbrains.dokka import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.PsiJavaFile import com.intellij.psi.PsiManager +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import org.jetbrains.dokka.analysis.AnalysisEnvironment import org.jetbrains.dokka.analysis.DokkaResolutionFacade import org.jetbrains.dokka.model.DModule @@ -109,7 +113,12 @@ class DokkaGenerator( context: DokkaContext ) { val renderer = context.single(CoreExtensions.renderer) - renderer.render(transformedPages) + runBlocking { + val scope = this + with(renderer) { + scope.render(transformedPages).join() + } + } } private fun createEnvironmentAndFacade(pass: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade = diff --git a/core/src/main/kotlin/renderers/Renderer.kt b/core/src/main/kotlin/renderers/Renderer.kt index 10235f21..9d054503 100644 --- a/core/src/main/kotlin/renderers/Renderer.kt +++ b/core/src/main/kotlin/renderers/Renderer.kt @@ -1,7 +1,9 @@ package org.jetbrains.dokka.renderers +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Job import org.jetbrains.dokka.pages.RootPageNode interface Renderer { - fun render(root: RootPageNode) + fun CoroutineScope.render(root: RootPageNode): Job } \ No newline at end of file -- cgit