From 52f64c664573567259f8f678d32924f86b4f147c Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 23 Sep 2020 19:48:14 +0200 Subject: Add navigation fragments for templating --- .../src/main/kotlin/templates/TemplateProcessor.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt') diff --git a/plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt b/plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt index 4c247d94..cd144046 100644 --- a/plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt +++ b/plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt @@ -5,6 +5,7 @@ import org.jetbrains.dokka.plugability.DokkaContext import java.io.File import java.nio.file.Files import java.nio.file.Path +import kotlin.coroutines.coroutineContext interface TemplateProcessor { fun process() @@ -12,6 +13,7 @@ interface TemplateProcessor { interface TemplateProcessingStrategy { suspend fun process(input: File, output: File) + suspend fun finish(output: File) {} } class DefaultTemplateProcessor( @@ -19,11 +21,14 @@ class DefaultTemplateProcessor( private val strategy: TemplateProcessingStrategy ): TemplateProcessor { override fun process() = runBlocking(Dispatchers.Default) { - context.configuration.modules.forEach { - launch { - it.sourceOutputDirectory.visit(context.configuration.outputDir.resolve(it.relativePathToOutputDirectory)) + coroutineScope { + context.configuration.modules.forEach { + launch { + it.sourceOutputDirectory.visit(context.configuration.outputDir.resolve(it.relativePathToOutputDirectory)) + } } } + strategy.finish(context.configuration.outputDir) } private suspend fun File.visit(target: File): Unit = coroutineScope { -- cgit