diff options
Diffstat (limited to 'kotlin-analysis')
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt | 10 | ||||
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt | 24 |
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)) - } } |