diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-02-12 16:01:38 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-02-18 13:28:23 +0100 |
commit | 848f2e0656e80604cb54932db5b250303aaccca8 (patch) | |
tree | 2d577faf9ee5f894fb2a97aa01a89d75d3c59841 /plugins/kotlin-as-java/src/main/kotlin | |
parent | 46b4bbb68ce1285a1aea700cc0d0000c6b7ed97b (diff) | |
download | dokka-848f2e0656e80604cb54932db5b250303aaccca8.tar.gz dokka-848f2e0656e80604cb54932db5b250303aaccca8.tar.bz2 dokka-848f2e0656e80604cb54932db5b250303aaccca8.zip |
Moves DescriptorToDocumentableTransformer to base plugin
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin')
5 files changed, 14 insertions, 11 deletions
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaDescriptorToDocumentationTranslator.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaDescriptorToDocumentationTranslator.kt index 9c4ee9aa..1edf4aa1 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaDescriptorToDocumentationTranslator.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaDescriptorToDocumentationTranslator.kt @@ -1,6 +1,9 @@ package org.jetbrains.dokka.kotlinAsJava import org.jetbrains.dokka.analysis.DokkaResolutionFacade +import org.jetbrains.dokka.base.transformers.descriptors.DRIWithPlatformInfo +import org.jetbrains.dokka.base.transformers.descriptors.DokkaDescriptorVisitor +import org.jetbrains.dokka.base.transformers.descriptors.withEmptyInfo import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.withClass @@ -8,18 +11,16 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.pages.PlatformData import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.transformers.descriptors.DRIWithPlatformInfo import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentationTranslator -import org.jetbrains.dokka.transformers.descriptors.DokkaDescriptorVisitor -import org.jetbrains.dokka.transformers.descriptors.withEmptyInfo import org.jetbrains.kotlin.descriptors.* -object KotlinAsJavaDescriptorToDocumentationTranslator : DescriptorToDocumentationTranslator { +class KotlinAsJavaDescriptorToDocumentationTranslator( + private val context: DokkaContext +) : DescriptorToDocumentationTranslator { override fun invoke( moduleName: String, packageFragments: Iterable<PackageFragmentDescriptor>, - platformData: PlatformData, - context: DokkaContext + platformData: PlatformData ): Module = KotlinAsJavaDokkaDescriptorVisitor(platformData, context.platforms[platformData]?.facade!!).run { packageFragments.map { visitPackageFragmentDescriptor(it, DRI.topLevel.withEmptyInfo()) } diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt index 8f026477..6fe10ce1 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt @@ -9,7 +9,6 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Enum import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.transformers.descriptors.KotlinClassKindTypes import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt index 05896d11..a5d0bd33 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt @@ -2,8 +2,8 @@ package org.jetbrains.dokka.kotlinAsJava import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.Function +import org.jetbrains.dokka.model.JavaTypeWrapper import org.jetbrains.dokka.pages.* -import org.jetbrains.dokka.transformers.psi.JavaTypeWrapper import org.jetbrains.dokka.utilities.DokkaLogger class KotlinAsJavaPageContentBuilder( diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt index 345dc9be..e99e0843 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt @@ -12,8 +12,12 @@ import org.jetbrains.dokka.transformers.documentation.DocumentationToPageTransla import org.jetbrains.kotlin.descriptors.DeclarationDescriptor class KotlinAsJavaPlugin : DokkaPlugin() { - val kotlinAsJavaDescriptorToDocumentableTranslator by extending { CoreExtensions.descriptorToDocumentationTranslator with KotlinAsJavaDescriptorToDocumentationTranslator } - val kotlinAsJavaDocumentableToPageTranslator by extending { CoreExtensions.documentationToPageTranslator with KotlinAsJavaDocumentationToPageTranslator } + val kotlinAsJavaDescriptorToDocumentableTranslator by extending { + CoreExtensions.descriptorToDocumentationTranslator providing ::KotlinAsJavaDescriptorToDocumentationTranslator + } + val kotlinAsJavaDocumentableToPageTranslator by extending { + CoreExtensions.documentationToPageTranslator with KotlinAsJavaDocumentationToPageTranslator + } } object DescriptorCache { diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinToJVMResolver.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinToJVMResolver.kt index 87a173f3..7b0495e9 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinToJVMResolver.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinToJVMResolver.kt @@ -5,7 +5,6 @@ import org.jetbrains.dokka.links.* import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.model.Enum -import org.jetbrains.dokka.transformers.psi.JavaTypeWrapper import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor |