From b7c4beec1b6317b1ceaf2520464996e9ee0e93e5 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Tue, 23 Jun 2020 13:09:09 +0200 Subject: Make inherited functions and implemented intefaces source set dependent --- .../descriptors/DefaultDescriptorToDocumentableTranslator.kt | 10 +++++----- .../translators/psi/DefaultPsiToDocumentableTranslator.kt | 4 ++-- .../javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt | 7 +++++-- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 4f292ca1..4764fbcb 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -148,7 +148,7 @@ private class DokkaDescriptorVisitor( extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), - ImplementedInterfaces(info.interfaces) + ImplementedInterfaces(info.interfaces.toSourceSetDependent()) ) ) } @@ -175,7 +175,7 @@ private class DokkaDescriptorVisitor( extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), - ImplementedInterfaces(info.interfaces) + ImplementedInterfaces(info.interfaces.toSourceSetDependent()) ) ) } @@ -204,7 +204,7 @@ private class DokkaDescriptorVisitor( extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), - ImplementedInterfaces(info.interfaces) + ImplementedInterfaces(info.interfaces.toSourceSetDependent()) ) ) } @@ -288,7 +288,7 @@ private class DokkaDescriptorVisitor( extra = PropertyContainer.withAll( descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations(), - ImplementedInterfaces(info.interfaces) + ImplementedInterfaces(info.interfaces.toSourceSetDependent()) ) ) } @@ -356,7 +356,7 @@ private class DokkaDescriptorVisitor( type = descriptor.returnType!!.toBound(), sourceSets = setOf(sourceSet), extra = PropertyContainer.withAll( - InheritedFunction(inheritedFrom), + InheritedFunction(inheritedFrom.toSourceSetDependent()), descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), descriptor.getAnnotations().toSourceSetDependent().toAnnotations() ) diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 8b397859..30204d01 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -154,7 +154,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator { val visibility = getVisibility().toSourceSetDependent() val ancestors = ancestorsSet.toList().map { it.dri }.toSourceSetDependent() val modifiers = getModifier().toSourceSetDependent() - val implementedInterfacesExtra = ImplementedInterfaces(ancestorsSet.filter { it.isInterface }.map { it.dri }.toList()) + val implementedInterfacesExtra = ImplementedInterfaces(ancestorsSet.filter { it.isInterface }.map { it.dri }.toList().toSourceSetDependent()) return when { isAnnotationType -> DAnnotation( @@ -276,7 +276,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator { setOf(sourceSetData), psi.additionalExtras().let { PropertyContainer.withAll( - InheritedFunction(inheritedFrom), + InheritedFunction(inheritedFrom.toSourceSetDependent()), it.toSourceSetDependent().toAdditionalModifiers(), (psi.annotations.toList().toListOfAnnotations() + it.toListOfAnnotations()).toSourceSetDependent() .toAnnotations() diff --git a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt index f0835270..22b0225b 100644 --- a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt +++ b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt @@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking +import org.jetbrains.dokka.Platform import org.jetbrains.dokka.base.renderers.OutputWriter import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.sureClassNames @@ -273,7 +274,8 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon ) + renderJavadocContentNode(node.content) private fun renderImplementedInterfaces(node: JavadocClasslikePageNode) = - node.extras[ImplementedInterfaces]?.interfaces?.map { it.displayable() }.orEmpty() + node.extras[ImplementedInterfaces]?.interfaces?.entries?.firstOrNull { it.key.platform == Platform.jvm }?.value?.map { it.displayable() } // TODO: REMOVE HARDCODED JVM DEPENDENCY + .orEmpty() private fun renderClasslikeMethods(nodes: List): TemplateMap { val (inherited, own) = nodes.partition { it.extras[InheritedFunction]?.isInherited ?: false } @@ -292,7 +294,8 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon private fun renderInheritedMethod(node: JavadocFunctionNode): TemplateMap { val inheritedFrom = node.extras[InheritedFunction]?.inheritedFrom return mapOf( - "inheritedFrom" to inheritedFrom?.displayable().orEmpty(), + "inheritedFrom" to inheritedFrom?.entries?.firstOrNull { it.key.platform == Platform.jvm }?.value?.displayable() // TODO: REMOVE HARDCODED JVM DEPENDENCY + .orEmpty(), "name" to node.name ) } -- cgit