From 0917459a2eafabc563e79579a0322bb7832cae1f Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Fri, 13 Dec 2019 14:27:25 +0100 Subject: Refactor of DokkaGenerator pipeline, removed ExtensionPoints dependencies other than context --- core/src/main/kotlin/resolvers/DefaultLocationProvider.kt | 5 ++--- core/src/main/kotlin/resolvers/LocationProviderFactory.kt | 13 +++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 core/src/main/kotlin/resolvers/LocationProviderFactory.kt (limited to 'core/src/main/kotlin/resolvers') diff --git a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt index 7442f449..7eae26ca 100644 --- a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt +++ b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt @@ -10,8 +10,7 @@ import org.jetbrains.dokka.plugability.single open class DefaultLocationProvider( private val pageGraphRoot: ModulePageNode, - private val configuration: DokkaConfiguration, - context: DokkaContext + private val context: DokkaContext ) : LocationProvider { // TODO: cache private val extension = context.single(CoreExtensions.fileExtension) @@ -21,7 +20,7 @@ open class DefaultLocationProvider( findInPageGraph(dri, platforms)?.let { resolve(it, context) } ?: // Not found in PageGraph, that means it's an external link ExternalLocationProvider.getLocation(dri, - configuration.passesConfigurations + this@DefaultLocationProvider.context.configuration.passesConfigurations .filter { passConfig -> platforms.toSet().contains(PlatformData(passConfig.moduleName, passConfig.analysisPlatform, passConfig.targets)) } // TODO: change targets to something better? diff --git a/core/src/main/kotlin/resolvers/LocationProviderFactory.kt b/core/src/main/kotlin/resolvers/LocationProviderFactory.kt new file mode 100644 index 00000000..1622045b --- /dev/null +++ b/core/src/main/kotlin/resolvers/LocationProviderFactory.kt @@ -0,0 +1,13 @@ +package org.jetbrains.dokka.resolvers + +import org.jetbrains.dokka.pages.ModulePageNode +import org.jetbrains.dokka.pages.PageNode +import org.jetbrains.dokka.plugability.DokkaContext + +interface LocationProviderFactory { + fun getLocationProvider(pageNode: PageNode, context: DokkaContext): LocationProvider +} + +object DefaultLocationProviderFactory : LocationProviderFactory { + override fun getLocationProvider(pageNode: PageNode, context: DokkaContext) = DefaultLocationProvider(pageNode as ModulePageNode, context) +} \ No newline at end of file -- cgit