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 --- .../src/main/kotlin/testApi/context/MockContext.kt | 6 ++---- .../testApi/testRunner/DokkaTestGenerator.kt | 8 +++----- .../main/kotlin/testApi/testRunner/TestRunner.kt | 22 ++++++++++------------ 3 files changed, 15 insertions(+), 21 deletions(-) (limited to 'testApi') diff --git a/testApi/src/main/kotlin/testApi/context/MockContext.kt b/testApi/src/main/kotlin/testApi/context/MockContext.kt index e3da5f68..07aedf28 100644 --- a/testApi/src/main/kotlin/testApi/context/MockContext.kt +++ b/testApi/src/main/kotlin/testApi/context/MockContext.kt @@ -1,8 +1,7 @@ package org.jetbrains.dokka.testApi.context import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.model.SourceSetCache -import org.jetbrains.dokka.model.SourceSetData +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.plugability.ExtensionPoint @@ -15,8 +14,7 @@ import kotlin.reflect.full.memberProperties class MockContext( vararg extensions: Pair, (DokkaContext) -> Any>, private val testConfiguration: DokkaConfiguration? = null, - private val unusedExtensionPoints: List>? = null, - override val sourceSetCache: SourceSetCache + private val unusedExtensionPoints: List>? = null ) : DokkaContext { private val extensionMap by lazy { extensions.groupBy(Pair, (DokkaContext) -> Any>::first) { diff --git a/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt b/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt index 7248a4cb..ec2be689 100644 --- a/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt +++ b/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt @@ -1,9 +1,8 @@ package org.jetbrains.dokka.testApi.testRunner import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaGenerator -import org.jetbrains.dokka.model.SourceSetCache -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.utilities.DokkaLogger @@ -16,13 +15,12 @@ internal class DokkaTestGenerator( fun generate() = with(testMethods) { val dokkaGenerator = DokkaGenerator(configuration, logger) - val sourceSetsCache = SourceSetCache() val context = - dokkaGenerator.initializePlugins(configuration, logger, sourceSetsCache, pluginOverrides) + dokkaGenerator.initializePlugins(configuration, logger, pluginOverrides) pluginsSetupStage(context) - val modulesFromPlatforms = dokkaGenerator.createDocumentationModels(context, sourceSetsCache) + val modulesFromPlatforms = dokkaGenerator.createDocumentationModels(context) documentablesCreationStage(modulesFromPlatforms) val filteredModules = dokkaGenerator.transformDocumentationModelBeforeMerge(modulesFromPlatforms, context) diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt index 88595f85..624ea914 100644 --- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt +++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt @@ -3,13 +3,11 @@ package org.jetbrains.dokka.testApi.testRunner import com.intellij.openapi.application.PathManager import org.jetbrains.dokka.* import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.model.SourceSetData -import org.jetbrains.dokka.pages.ModulePageNode +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.utilities.DokkaConsoleLogger -import org.jetbrains.dokka.utilities.DokkaLogger import org.junit.rules.TemporaryFolder import testApi.logger.TestLogger import java.io.File @@ -66,7 +64,7 @@ abstract class AbstractCoreTest { val newConfiguration = configuration.copy( outputDir = testDirPath.toAbsolutePath().toString(), - passesConfigurations = configuration.passesConfigurations.map { + sourceSets = configuration.sourceSets.map { it.copy(sourceRoots = it.sourceRoots.map { it.copy(path = "${testDirPath.toAbsolutePath()}/${it.path}") }) } ) @@ -143,13 +141,13 @@ abstract class AbstractCoreTest { var pluginsClasspath: List = emptyList() var pluginsConfigurations: Map = emptyMap() var failOnWarning: Boolean = false - private val passesConfigurations = mutableListOf() + private val sourceSets = mutableListOf() fun build() = DokkaConfigurationImpl( outputDir = outputDir, format = format, cacheRoot = cacheRoot, offlineMode = offlineMode, - passesConfigurations = passesConfigurations, + sourceSets = sourceSets, pluginsClasspath = pluginsClasspath, pluginsConfiguration = pluginsConfigurations, modules = emptyList(), @@ -157,18 +155,18 @@ abstract class AbstractCoreTest { ) fun passes(block: Passes.() -> Unit) { - passesConfigurations.addAll(Passes().apply(block)) + sourceSets.addAll(Passes().apply(block)) } } @DokkaConfigurationDsl - protected class Passes : ArrayList() { - fun pass(block: DokkaPassConfigurationBuilder.() -> Unit) = - add(DokkaPassConfigurationBuilder().apply(block).build()) + protected class Passes : ArrayList() { + fun pass(block: DokkaSourceSetBuilder.() -> Unit) = + add(DokkaSourceSetBuilder().apply(block).build()) } @DokkaConfigurationDsl - protected class DokkaPassConfigurationBuilder( + protected class DokkaSourceSetBuilder( var moduleName: String = "root", var sourceSetID: String = "main", var displayName: String = "JVM", @@ -193,7 +191,7 @@ abstract class AbstractCoreTest { var externalDocumentationLinks: List = emptyList(), var sourceLinks: List = emptyList() ) { - fun build() = PassConfigurationImpl( + fun build() = DokkaSourceSetImpl( moduleName = moduleName, displayName = displayName, sourceSetID = sourceSetID, -- cgit