aboutsummaryrefslogtreecommitdiff
path: root/kotlin-analysis/src/main/kotlin/org/jetbrains
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-06-19 14:08:49 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-06-25 20:23:58 +0200
commit8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f (patch)
treefe4e24d9f352199e551bd34ba330c0d2c0acf7af /kotlin-analysis/src/main/kotlin/org/jetbrains
parent08f40e2a13006882e8f8425f111b8527e7bbcb0f (diff)
downloaddokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.gz
dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.bz2
dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.zip
Remove SourceSetDataCache, rename PassConfiguration to DokkaSourceSet and use it instead of SourceSetData
Diffstat (limited to 'kotlin-analysis/src/main/kotlin/org/jetbrains')
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt10
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt24
2 files changed, 13 insertions, 21 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
index 9d15123a..a12becee 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
@@ -14,21 +14,21 @@ import java.io.File
internal fun createEnvironmentAndFacade(
logger: DokkaLogger,
configuration: DokkaConfiguration,
- pass: DokkaConfiguration.PassConfiguration
+ sourceSet: DokkaConfiguration.DokkaSourceSet
): EnvironmentAndFacade =
- AnalysisEnvironment(DokkaMessageCollector(logger), pass.analysisPlatform).run {
+ AnalysisEnvironment(DokkaMessageCollector(logger), sourceSet.analysisPlatform).run {
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
}
- pass.classpath.forEach { addClasspath(File(it)) }
+ sourceSet.classpath.forEach { addClasspath(File(it)) }
addSources(
- (pass.sourceRoots + configuration.passesConfigurations.filter { it.sourceSetID in pass.dependentSourceSets }
+ (sourceSet.sourceRoots + configuration.sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
.flatMap { it.sourceRoots })
.map { it.path }
)
- loadLanguageVersionSettings(pass.languageVersion, pass.apiVersion)
+ loadLanguageVersionSettings(sourceSet.languageVersion, sourceSet.apiVersion)
val environment = createCoreEnvironment()
val (facade, _) = createResolutionFacade(environment)
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt
index cd07b2a3..426ffdde 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt
@@ -2,45 +2,37 @@
package org.jetbrains.dokka.analysis
-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.model.SourceSetDependent
import org.jetbrains.dokka.plugability.DokkaContext
fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis {
- val environments = context.configuration.passesConfigurations
- .associate { passConfiguration ->
- context.sourceSetCache.getSourceSet(passConfiguration) to createEnvironmentAndFacade(
+ val environments = context.configuration.sourceSets
+ .associate { sourceSet ->
+ sourceSet to createEnvironmentAndFacade(
logger = context.logger,
configuration = context.configuration,
- pass = passConfiguration
+ sourceSet = sourceSet
)
}
- return KotlinAnalysisImpl(context.sourceSetCache, environments)
+ return KotlinAnalysisImpl(environments)
}
interface KotlinAnalysis : SourceSetDependent<EnvironmentAndFacade> {
- override fun get(key: SourceSetData): EnvironmentAndFacade
+ override fun get(key: DokkaSourceSet): EnvironmentAndFacade
operator fun get(sourceSetID: String): EnvironmentAndFacade
- operator fun get(passConfiguration: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade
}
internal class KotlinAnalysisImpl(
- private val sourceSetCache: SourceSetCache,
private val environments: SourceSetDependent<EnvironmentAndFacade>
) : KotlinAnalysis, SourceSetDependent<EnvironmentAndFacade> by environments {
- override fun get(key: SourceSetData): EnvironmentAndFacade {
+ override fun get(key: DokkaSourceSet): EnvironmentAndFacade {
return environments[key] ?: throw IllegalStateException("Missing EnvironmentAndFacade for sourceSet $key")
}
override fun get(sourceSetID: String): EnvironmentAndFacade {
return environments.entries.first { (sourceSet, _) -> sourceSet.sourceSetID == sourceSetID }.value
}
-
- override fun get(passConfiguration: DokkaConfiguration.PassConfiguration): EnvironmentAndFacade {
- return get(sourceSetCache.getSourceSet(passConfiguration))
- }
}