diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-11-25 13:17:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 13:17:51 +0100 |
commit | 3fe3a934092cd844a6e0b691c87c367b9fc4d5b3 (patch) | |
tree | 0ba15c94e832657be1c5a12ed5c00287a6a0bc5f /plugins/base/src/main | |
parent | 78850b5786b7b2a767db1dbd7132a374b2f4f227 (diff) | |
download | dokka-3fe3a934092cd844a6e0b691c87c367b9fc4d5b3.tar.gz dokka-3fe3a934092cd844a6e0b691c87c367b9fc4d5b3.tar.bz2 dokka-3fe3a934092cd844a6e0b691c87c367b9fc4d5b3.zip |
Remove suspend from SourceToDocumentableTranslator (#1622)
* Remove suspend from SourceToDocumentableTranslator
* Introduce AsyncSourceToDocumentableTranslator
Co-authored-by: Marcin Aman <marcin.aman@gmail.com>
Diffstat (limited to 'plugins/base/src/main')
2 files changed, 6 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 4695dac5..17cd493a 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -21,6 +21,7 @@ import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle +import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor @@ -65,11 +66,11 @@ import org.jetbrains.kotlin.resolve.constants.KClassValue as ConstantsKtClassVal class DefaultDescriptorToDocumentableTranslator( context: DokkaContext -) : SourceToDocumentableTranslator { +) : AsyncSourceToDocumentableTranslator { private val kotlinAnalysis: KotlinAnalysis = context.plugin<DokkaBase>().querySingle { kotlinAnalysis } - override suspend fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule { + override suspend fun invokeSuspending(sourceSet: DokkaSourceSet, context: DokkaContext): DModule { val (environment, facade) = kotlinAnalysis[sourceSet] val packageFragments = environment.getSourceFiles().asSequence() .map { it.packageFqName } diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 15ef24bb..bf7fbe7d 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -27,6 +27,7 @@ import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle +import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.dokka.utilities.parallelForEach @@ -52,11 +53,11 @@ import java.io.File class DefaultPsiToDocumentableTranslator( context: DokkaContext -) : SourceToDocumentableTranslator { +) : AsyncSourceToDocumentableTranslator { private val kotlinAnalysis: KotlinAnalysis = context.plugin<DokkaBase>().querySingle { kotlinAnalysis } - override suspend fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule { + override suspend fun invokeSuspending(sourceSet: DokkaSourceSet, context: DokkaContext): DModule { return coroutineScope { fun isFileInSourceRoots(file: File): Boolean = sourceSet.sourceRoots.any { root -> file.startsWith(root) } |