aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt
blob: 5dbe2bbec0b6905e94cf16e74c7b71e73c04b25a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.jetbrains.dokka.templates

import org.jetbrains.dokka.Timer
import org.jetbrains.dokka.generation.Generation
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.query
import org.jetbrains.dokka.plugability.querySingle

class TestTemplatingGeneration(private val context: DokkaContext) : Generation {

    val templatingPlugin by lazy { context.plugin<TemplatingPlugin>() }

    override fun Timer.generate() {
        report("Processing submodules")
        processSubmodules()

        report("Finishing processing")
        finishProcessing()
    }

    fun processSubmodules() =
        templatingPlugin.querySingle { submoduleTemplateProcessor }.process(context.configuration.modules)

    fun finishProcessing() =
        templatingPlugin.query { templateProcessingStrategy }.forEach { it.finish(context.configuration.outputDir) }


    override val generationName = "test template generation"
}