From 8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Fri, 19 Jun 2020 14:08:49 +0200 Subject: Remove SourceSetDataCache, rename PassConfiguration to DokkaSourceSet and use it instead of SourceSetData --- core/src/main/kotlin/DokkaGenerator.kt | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'core/src/main/kotlin/DokkaGenerator.kt') diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index b88c6223..ce8d229a 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -1,8 +1,7 @@ package org.jetbrains.dokka import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.model.SourceSetCache -import org.jetbrains.dokka.model.SourceSetData +import org.jetbrains.dokka.DokkaConfiguration.* import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -18,13 +17,11 @@ class DokkaGenerator( private val logger: DokkaLogger ) { fun generate() = timed { - val sourceSetsCache = SourceSetCache() - report("Initializing plugins") - val context = initializePlugins(configuration, logger, sourceSetsCache) + val context = initializePlugins(configuration, logger) report("Creating documentation models") - val modulesFromPlatforms = createDocumentationModels(context, sourceSetsCache) + val modulesFromPlatforms = createDocumentationModels(context) report("Transforming documentation model before merging") val transformedDocumentationBeforeMerge = transformDocumentationModelBeforeMerge(modulesFromPlatforms, context) @@ -48,9 +45,8 @@ class DokkaGenerator( }.dump("\n\n === TIME MEASUREMENT ===\n") fun generateAllModulesPage() = timed { - val sourceSetsCache = SourceSetCache() report("Initializing plugins") - val context = initializePlugins(configuration, logger, sourceSetsCache) + val context = initializePlugins(configuration, logger) report("Creating all modules page") val pages = createAllModulePage(context) @@ -66,15 +62,12 @@ class DokkaGenerator( fun initializePlugins( configuration: DokkaConfiguration, logger: DokkaLogger, - sourceSetsCache: SourceSetCache, pluginOverrides: List = emptyList() - ) = DokkaContext.create(configuration, logger, sourceSetsCache, pluginOverrides) + ) = DokkaContext.create(configuration, logger, pluginOverrides) fun createDocumentationModels( - context: DokkaContext, - sourceSetsCache: SourceSetCache - ) = context.configuration.passesConfigurations - .map { passConfiguration -> sourceSetsCache.getSourceSet(passConfiguration) } + context: DokkaContext + ) = context.configuration.sourceSets .flatMap { passConfiguration -> translateSources(passConfiguration, context) } fun transformDocumentationModelBeforeMerge( @@ -133,9 +126,9 @@ class DokkaGenerator( } } - private fun translateSources(platformData: SourceSetData, context: DokkaContext) = + private fun translateSources(sourceSet: DokkaSourceSet, context: DokkaContext) = context[CoreExtensions.sourceToDocumentableTranslator].map { - it.invoke(platformData, context) + it.invoke(sourceSet, context) } } -- cgit