aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt')
-rw-r--r--plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt80
1 files changed, 0 insertions, 80 deletions
diff --git a/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
deleted file mode 100644
index 11d2d32c..00000000
--- a/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.allModulesPage
-
-import org.jetbrains.dokka.CoreExtensions
-import org.jetbrains.dokka.Timer
-import org.jetbrains.dokka.generation.Generation
-import org.jetbrains.dokka.pages.RootPageNode
-import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.plugability.plugin
-import org.jetbrains.dokka.plugability.query
-import org.jetbrains.dokka.plugability.querySingle
-import org.jetbrains.dokka.templates.TemplatingPlugin
-import org.jetbrains.dokka.templates.TemplatingResult
-import org.jetbrains.dokka.transformers.pages.CreationContext
-
-public class AllModulesPageGeneration(private val context: DokkaContext) : Generation {
-
- private val allModulesPagePlugin by lazy { context.plugin<AllModulesPagePlugin>() }
- private val templatingPlugin by lazy { context.plugin<TemplatingPlugin>() }
-
- override fun Timer.generate() {
- report("Processing submodules")
- val generationContext = processSubmodules()
-
- report("Creating all modules page")
- val pages = createAllModulesPage(generationContext)
-
- report("Transforming pages")
- val transformedPages = transformAllModulesPage(pages)
-
- report("Rendering")
- render(transformedPages)
-
- report("Processing multimodule")
- processMultiModule(transformedPages)
-
- report("Finish submodule processing")
- finishProcessingSubmodules()
-
- report("Running post-actions")
- runPostActions()
- }
-
- override val generationName: String = "index page for project"
-
- public fun createAllModulesPage(allModulesContext: DefaultAllModulesContext): RootPageNode =
- allModulesPagePlugin.querySingle { allModulesPageCreator }.invoke(allModulesContext)
-
- public fun transformAllModulesPage(pages: RootPageNode): RootPageNode =
- allModulesPagePlugin.query { allModulesPageTransformer }.fold(pages) { acc, t -> t(acc) }
-
- public fun render(transformedPages: RootPageNode) {
- context.single(CoreExtensions.renderer).render(transformedPages)
- }
-
- public fun runPostActions() {
- context[CoreExtensions.postActions].forEach { it() }
- }
-
- public fun processSubmodules(): DefaultAllModulesContext {
- return templatingPlugin.querySingle { submoduleTemplateProcessor }
- .process(context.configuration.modules)
- .let { DefaultAllModulesContext(it) }
- }
-
- public fun processMultiModule(root: RootPageNode) {
- templatingPlugin.querySingle { multimoduleTemplateProcessor }.process(root)
- }
-
- public fun finishProcessingSubmodules() {
- templatingPlugin.query { templateProcessingStrategy }.forEach { it.finish(context.configuration.outputDir) }
- }
-
- public data class DefaultAllModulesContext(val nonEmptyModules: List<String>) : CreationContext {
- public constructor(templating: TemplatingResult) : this(templating.modules)
- }
-}