From aa745c95adde72a66ad559223c2055a15842736b Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Thu, 24 Sep 2020 17:07:17 +0200 Subject: Remove dokka context from creating analysis (#1482) --- .../org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt | 4 ++-- .../kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'kotlin-analysis') 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 38b0b69b..ea8ce2f6 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 @@ -10,7 +10,7 @@ import java.io.File internal fun createEnvironmentAndFacade( logger: DokkaLogger, - configuration: DokkaConfiguration, + sourceSets: List, sourceSet: DokkaConfiguration.DokkaSourceSet ): EnvironmentAndFacade = AnalysisEnvironment(DokkaMessageCollector(logger), sourceSet.analysisPlatform).run { @@ -20,7 +20,7 @@ internal fun createEnvironmentAndFacade( sourceSet.classpath.forEach(::addClasspath) addSources( - (sourceSet.sourceRoots + configuration.sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets } + (sourceSet.sourceRoots + sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets } .flatMap { it.sourceRoots }) ) 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 b37c6688..e7c26c25 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 @@ -6,12 +6,13 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.model.SourceSetDependent import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.utilities.DokkaLogger -fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis { - val environments = context.configuration.sourceSets.associateWith { sourceSet -> +fun KotlinAnalysis(sourceSets: List, logger: DokkaLogger): KotlinAnalysis { + val environments = sourceSets.associateWith { sourceSet -> createEnvironmentAndFacade( - logger = context.logger, - configuration = context.configuration, + logger = logger, + sourceSets = sourceSets, sourceSet = sourceSet ) } @@ -19,6 +20,11 @@ fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis { return KotlinAnalysisImpl(environments) } +@Deprecated(message = "Construct using list of DokkaSourceSets and logger", + replaceWith = ReplaceWith("KotlinAnalysis(context.configuration.sourceSets, context.logger)") +) +fun KotlinAnalysis(context: DokkaContext): KotlinAnalysis = KotlinAnalysis(context.configuration.sourceSets, context.logger) + interface KotlinAnalysis : SourceSetDependent { override fun get(key: DokkaSourceSet): EnvironmentAndFacade operator fun get(sourceSetID: DokkaSourceSetID): EnvironmentAndFacade -- cgit