diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Generation/DocumentationMerger.kt | 9 | ||||
-rw-r--r-- | core/src/main/kotlin/Generation/DokkaGenerator.kt | 10 |
2 files changed, 16 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Generation/DocumentationMerger.kt b/core/src/main/kotlin/Generation/DocumentationMerger.kt index 3be6be83..f6280fb9 100644 --- a/core/src/main/kotlin/Generation/DocumentationMerger.kt +++ b/core/src/main/kotlin/Generation/DocumentationMerger.kt @@ -120,11 +120,20 @@ class DocumentationMerger( signature: String, nodes: List<DocumentationNode> ): DocumentationNode { + require(nodes.isNotEmpty()) + val singleNode = nodes.singleOrNull() if (singleNode != null) { singleNode.dropReferences { it.kind == RefKind.Owner } return singleNode } + val nodeWithMaxPlatforms = nodes.maxBy { it.platforms.size }!! + val maxPlatforms = nodeWithMaxPlatforms.platforms.toSet() + val notContained = nodes.filterNot { maxPlatforms.containsAll(it.platforms) } + val reducedDuplicates = notContained + nodeWithMaxPlatforms + if (!reducedDuplicates.containsAll(nodes)) { + return mergeMembersWithEqualSignature(signature, reducedDuplicates) + } val groupNode = DocumentationNode(nodes.first().name, Content.Empty, NodeKind.GroupNode) groupNode.appendTextNode(signature, NodeKind.Signature, RefKind.Detail) diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt index 9d718971..9173dfbb 100644 --- a/core/src/main/kotlin/Generation/DokkaGenerator.kt +++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.descriptors.MemberDescriptor import org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer import org.jetbrains.kotlin.resolve.TopDownAnalysisMode import org.jetbrains.kotlin.utils.PathUtil @@ -73,9 +74,12 @@ class DokkaGenerator(val dokkaConfiguration: DokkaConfiguration, val defaultPlatformAsList = passConfiguration.targets val defaultPlatformsProvider = object : DefaultPlatformsProvider { override fun getDefaultPlatforms(descriptor: DeclarationDescriptor): List<String> { - val containingFilePath = descriptor.sourcePsi()?.containingFile?.virtualFile?.canonicalPath - ?.let { File(it).absolutePath } - val sourceRoot = containingFilePath?.let { path -> sourceRoots.find { path.startsWith(it.path) } } +// val containingFilePath = descriptor.sourcePsi()?.containingFile?.virtualFile?.canonicalPath +// ?.let { File(it).absolutePath } +// val sourceRoot = containingFilePath?.let { path -> sourceRoots.find { path.startsWith(it.path) } } + if (descriptor is MemberDescriptor && descriptor.isExpect) { + return defaultPlatformAsList.take(1) + } return /*sourceRoot?.platforms ?: */defaultPlatformAsList } } |