diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2020-09-24 17:07:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-24 17:07:17 +0200 |
commit | aa745c95adde72a66ad559223c2055a15842736b (patch) | |
tree | 03b2d64113191af605e636d39190d4116782637a /kotlin-analysis | |
parent | fb75185dee2184c380dcf9330e93b73b33539f99 (diff) | |
download | dokka-aa745c95adde72a66ad559223c2055a15842736b.tar.gz dokka-aa745c95adde72a66ad559223c2055a15842736b.tar.bz2 dokka-aa745c95adde72a66ad559223c2055a15842736b.zip |
Remove dokka context from creating analysis (#1482)
Diffstat (limited to 'kotlin-analysis')
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt | 4 | ||||
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinAnalysis.kt | 14 |
2 files changed, 12 insertions, 6 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 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<DokkaConfiguration.DokkaSourceSet>, 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<DokkaSourceSet>, 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<EnvironmentAndFacade> { override fun get(key: DokkaSourceSet): EnvironmentAndFacade operator fun get(sourceSetID: DokkaSourceSetID): EnvironmentAndFacade |