diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-09-23 19:48:14 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-11-27 03:15:02 +0100 |
commit | 52f64c664573567259f8f678d32924f86b4f147c (patch) | |
tree | 0882ce51f477acc71412b36307495a0e0ba97359 /plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt | |
parent | 80b6d1824960205e1c1d57c0c51e913d3c2360db (diff) | |
download | dokka-52f64c664573567259f8f678d32924f86b4f147c.tar.gz dokka-52f64c664573567259f8f678d32924f86b4f147c.tar.bz2 dokka-52f64c664573567259f8f678d32924f86b4f147c.zip |
Add navigation fragments for templating
Diffstat (limited to 'plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt')
-rw-r--r-- | plugins/all-module-page/src/main/kotlin/templates/TemplateProcessor.kt | 11 |
1 files changed, 8 insertions, 3 deletions
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 { |