aboutsummaryrefslogtreecommitdiff
path: root/testApi
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-05-05 17:45:12 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-14 13:30:33 +0200
commit3f2a790190da4f40ea6d8a976aa1929b2a1b002b (patch)
tree752ee84451954e9ea5e6d4133e18e41aaee2f7b1 /testApi
parenta440f0cb8756019131a2c15389e747aea3c585e7 (diff)
downloaddokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.tar.gz
dokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.tar.bz2
dokka-3f2a790190da4f40ea6d8a976aa1929b2a1b002b.zip
Changing approach from platform-driven to source-set-driven
Diffstat (limited to 'testApi')
-rw-r--r--testApi/src/main/kotlin/testApi/context/MockContext.kt12
-rw-r--r--testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt11
-rw-r--r--testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt10
3 files changed, 22 insertions, 11 deletions
diff --git a/testApi/src/main/kotlin/testApi/context/MockContext.kt b/testApi/src/main/kotlin/testApi/context/MockContext.kt
index 5236f1f4..11520280 100644
--- a/testApi/src/main/kotlin/testApi/context/MockContext.kt
+++ b/testApi/src/main/kotlin/testApi/context/MockContext.kt
@@ -2,7 +2,8 @@ package org.jetbrains.dokka.testApi.context
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.EnvironmentAndFacade
-import org.jetbrains.dokka.pages.PlatformData
+import org.jetbrains.dokka.model.SourceSetCache
+import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.ExtensionPoint
@@ -15,8 +16,9 @@ import kotlin.reflect.full.memberProperties
class MockContext(
vararg extensions: Pair<ExtensionPoint<*>, (DokkaContext) -> Any>,
private val testConfiguration: DokkaConfiguration? = null,
- private val testPlatforms: Map<PlatformData, EnvironmentAndFacade>? = null,
- private val unusedExtensionPoints: List<ExtensionPoint<*>>? = null
+ private val testSourceSets: Map<SourceSetData, EnvironmentAndFacade>? = null,
+ private val unusedExtensionPoints: List<ExtensionPoint<*>>? = null,
+ override val sourceSetCache: SourceSetCache
) : DokkaContext {
private val extensionMap by lazy {
extensions.groupBy(Pair<ExtensionPoint<*>, (DokkaContext) -> Any>::first) {
@@ -39,8 +41,8 @@ class MockContext(
override val configuration: DokkaConfiguration
get() = testConfiguration ?: throw IllegalStateException("This mock context doesn't provide configuration")
- override val platforms: Map<PlatformData, EnvironmentAndFacade>
- get() = testPlatforms ?: throw IllegalStateException("This mock context doesn't provide platforms data")
+ override val platforms: Map<SourceSetData, EnvironmentAndFacade>
+ get() = testSourceSets ?: throw IllegalStateException("This mock context doesn't provide platforms data")
override val unusedPoints: Collection<ExtensionPoint<*>>
get() = unusedExtensionPoints
?: throw IllegalStateException("This mock context doesn't provide unused extension points")
diff --git a/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt b/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt
index 0e77344d..802bfd93 100644
--- a/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt
+++ b/testApi/src/main/kotlin/testApi/testRunner/DokkaTestGenerator.kt
@@ -3,7 +3,8 @@ package org.jetbrains.dokka.testApi.testRunner
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaGenerator
import org.jetbrains.dokka.EnvironmentAndFacade
-import org.jetbrains.dokka.pages.PlatformData
+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,11 +17,15 @@ internal class DokkaTestGenerator(
fun generate() = with(testMethods) {
val dokkaGenerator = DokkaGenerator(configuration, logger)
+ val sourceSetsCache = SourceSetCache()
- val platforms: Map<PlatformData, EnvironmentAndFacade> = dokkaGenerator.setUpAnalysis(configuration)
+ val platforms: Map<SourceSetData, EnvironmentAndFacade> = dokkaGenerator.setUpAnalysis(
+ configuration,
+ sourceSetsCache
+ )
analysisSetupStage(platforms)
- val context = dokkaGenerator.initializePlugins(configuration, logger, platforms, pluginOverrides)
+ val context = dokkaGenerator.initializePlugins(configuration, logger, platforms, sourceSetsCache, pluginOverrides)
pluginsSetupStage(context)
val modulesFromPlatforms = dokkaGenerator.createDocumentationModels(platforms, context)
diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
index 6c132d3c..43d99dad 100644
--- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
+++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
@@ -3,8 +3,8 @@ 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.pages.PlatformData
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.DokkaPlugin
@@ -104,7 +104,7 @@ abstract class AbstractCoreTest {
}
protected class TestBuilder {
- var analysisSetupStage: (Map<PlatformData, EnvironmentAndFacade>) -> Unit = {}
+ var analysisSetupStage: (Map<SourceSetData, EnvironmentAndFacade>) -> Unit = {}
var pluginsSetupStage: (DokkaContext) -> Unit = {}
var documentablesCreationStage: (List<DModule>) -> Unit = {}
var documentablesFirstTransformationStep: (List<DModule>) -> Unit = {}
@@ -167,8 +167,10 @@ abstract class AbstractCoreTest {
@DokkaConfigurationDsl
protected class DokkaPassConfigurationBuilder(
var moduleName: String = "root",
+ var sourceSetName: String = "main",
var classpath: List<String> = emptyList(),
var sourceRoots: List<String> = emptyList(),
+ var dependentSourceRoots: List<String> = emptyList(),
var samples: List<String> = emptyList(),
var includes: List<String> = emptyList(),
var includeNonPublic: Boolean = true,
@@ -192,8 +194,10 @@ abstract class AbstractCoreTest {
) {
fun build() = PassConfigurationImpl(
moduleName = moduleName,
+ sourceSetName = sourceSetName,
classpath = classpath,
sourceRoots = sourceRoots.map { SourceRootImpl(it) },
+ dependentSourceRoots = dependentSourceRoots.map { SourceRootImpl(it) },
samples = samples,
includes = includes,
includeNonPublic = includeNonPublic,
@@ -235,7 +239,7 @@ abstract class AbstractCoreTest {
}
data class TestMethods(
- val analysisSetupStage: (Map<PlatformData, EnvironmentAndFacade>) -> Unit,
+ val analysisSetupStage: (Map<SourceSetData, EnvironmentAndFacade>) -> Unit,
val pluginsSetupStage: (DokkaContext) -> Unit,
val documentablesCreationStage: (List<DModule>) -> Unit,
val documentablesFirstTransformationStep: (List<DModule>) -> Unit,