aboutsummaryrefslogtreecommitdiff
path: root/plugins/all-modules-page/src/main/kotlin/AllModulesPagePlugin.kt
blob: 06202082edaa8a8d8ea9b205fef6885173860ede (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * 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.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProviderFactory
import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory
import org.jetbrains.dokka.generation.Generation
import org.jetbrains.dokka.plugability.*
import org.jetbrains.dokka.templates.CommandHandler
import org.jetbrains.dokka.templates.TemplatingPlugin
import org.jetbrains.dokka.transformers.pages.PageCreator
import org.jetbrains.dokka.transformers.pages.PageTransformer

public class AllModulesPagePlugin : DokkaPlugin() {

    public val partialLocationProviderFactory: ExtensionPoint<LocationProviderFactory> by extensionPoint()
    public val allModulesPageCreator: ExtensionPoint<PageCreator<AllModulesPageGeneration.DefaultAllModulesContext>> by extensionPoint()
    public val allModulesPageTransformer: ExtensionPoint<PageTransformer> by extensionPoint()
    public val externalModuleLinkResolver: ExtensionPoint<ExternalModuleLinkResolver> by extensionPoint()

    public val allModulesPageCreators: Extension<PageCreator<AllModulesPageGeneration.DefaultAllModulesContext>, *, *> by extending {
        allModulesPageCreator providing ::MultimodulePageCreator
    }

    private val dokkaBase: DokkaBase by lazy { plugin<DokkaBase>() }

    public val multimoduleLocationProvider: Extension<LocationProviderFactory, *, *> by extending {
        (dokkaBase.locationProviderFactory
                providing MultimoduleLocationProvider::Factory
                override plugin<DokkaBase>().locationProvider)
    }

    public val baseLocationProviderFactory: Extension<LocationProviderFactory, *, *> by extending {
        partialLocationProviderFactory providing ::DokkaLocationProviderFactory
    }

    public val allModulesPageGeneration: Extension<Generation, *, *> by extending {
        (CoreExtensions.generation
                providing ::AllModulesPageGeneration
                override dokkaBase.singleGeneration)
    }

    public val resolveLinkCommandHandler: Extension<CommandHandler, *, *> by extending {
        plugin<TemplatingPlugin>().directiveBasedCommandHandlers providing ::ResolveLinkCommandHandler
    }

    public val multiModuleLinkResolver: Extension<ExternalModuleLinkResolver, *, *> by extending {
        externalModuleLinkResolver providing ::DefaultExternalModuleLinkResolver
    }

    @OptIn(DokkaPluginApiPreview::class)
    override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement =
        PluginApiPreviewAcknowledgement
}