diff options
4 files changed, 5 insertions, 41 deletions
diff --git a/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt b/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt index 29107136..1e7fb60c 100644 --- a/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt +++ b/plugins/all-module-page/src/main/kotlin/MultimoduleLocationProvider.kt @@ -1,8 +1,8 @@ package org.jetbrains.dokka.allModulesPage +import org.jetbrains.dokka.base.resolvers.local.DokkaBaseLocationProvider import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider.Companion.identifierToFilename -import org.jetbrains.dokka.base.resolvers.local.LocationProvider import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.DisplaySourceSet @@ -10,7 +10,7 @@ import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext -class MultimoduleLocationProvider(private val root: RootPageNode, context: DokkaContext) : LocationProvider { +class MultimoduleLocationProvider(private val root: RootPageNode, context: DokkaContext) : DokkaBaseLocationProvider(root, context, ".html") { private val defaultLocationProvider = DokkaLocationProvider(root, context) @@ -38,4 +38,4 @@ class MultimoduleLocationProvider(private val root: RootPageNode, context: Dokka override fun getLocationProvider(pageNode: RootPageNode) = MultimoduleLocationProvider(pageNode, context) } -}
\ No newline at end of file +} diff --git a/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt index c3806b00..46c8bf82 100644 --- a/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt +++ b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt @@ -2,13 +2,13 @@ package org.jetbrains.dokka.allModulesPage import org.jetbrains.dokka.DokkaConfiguration.DokkaModuleDescription import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.allModulesPage.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.Classifier.Module import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentationParsingContext import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentation import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentationFragments import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint -import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.links.DRI diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProviderFactory.kt index 99cc0687..85127d77 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProviderFactory.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProviderFactory.kt @@ -1,6 +1,5 @@ package org.jetbrains.dokka.base.resolvers.local -import org.jetbrains.dokka.pages.MultimoduleRootPageNode import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import java.util.concurrent.ConcurrentHashMap @@ -9,8 +8,7 @@ class DokkaLocationProviderFactory(private val context: DokkaContext) : Location private val cache = ConcurrentHashMap<CacheWrapper, LocationProvider>() override fun getLocationProvider(pageNode: RootPageNode) = cache.computeIfAbsent(CacheWrapper(pageNode)) { - if (pageNode.children.first() is MultimoduleRootPageNode) MultimoduleLocationProvider(pageNode, context) - else DokkaLocationProvider(pageNode, context) + DokkaLocationProvider(pageNode, context) } private class CacheWrapper(val pageNode: RootPageNode) { diff --git a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt deleted file mode 100644 index 60e72319..00000000 --- a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -package org.jetbrains.dokka.base.resolvers.local - -import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider.Companion.identifierToFilename -import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.DisplaySourceSet -import org.jetbrains.dokka.pages.PageNode -import org.jetbrains.dokka.pages.RootPageNode -import org.jetbrains.dokka.plugability.DokkaContext - -class MultimoduleLocationProvider(pageGraphRoot: RootPageNode, dokkaContext: DokkaContext) : - DokkaBaseLocationProvider(pageGraphRoot, dokkaContext, ".html") { - - private val defaultLocationProvider = DokkaLocationProvider(pageGraphRoot, dokkaContext) - - val paths = dokkaContext.configuration.modules.map { - it.name to it.relativePathToOutputDirectory - }.toMap() - - override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?) = - dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let { - "$it/${identifierToFilename(dri.classNames.orEmpty())}/index.html" - } ?: defaultLocationProvider.resolve(dri, sourceSets, context) - - override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean) = - defaultLocationProvider.resolve(node, context, skipExtension) - - override fun pathToRoot(from: PageNode): String = defaultLocationProvider.pathToRoot(from) - - override fun ancestors(node: PageNode): List<PageNode> = listOf(pageGraphRoot) - - companion object { - const val MULTIMODULE_PACKAGE_PLACEHOLDER = ".ext" - } -} |