From e1f3417a22942d168ace994734add42cc01d3694 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Wed, 15 Jul 2020 15:46:08 +0200 Subject: Show sourcesets from extension points as a part of page's sourceset --- .../translators/documentables/DefaultPageCreator.kt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'plugins/base/src/main/kotlin') diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index f8dbde60..5180d4fc 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -182,7 +182,13 @@ open class DefaultPageCreator( } protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) { - group(kind = ContentKind.Cover) { + @Suppress("UNCHECKED_CAST") + val extensions = (c as WithExtraProperties) + .extra[CallableExtensions]?.extensions + ?.filterIsInstance().orEmpty() + // Extensions are added to sourceSets since they can be placed outside the sourceSets from classlike + // Example would be an Interface in common and extension function in jvm + group(kind = ContentKind.Cover, sourceSets = mainSourcesetData + extensions.sourceSets) { cover(c.name.orEmpty()) sourceSetDependentHint(c.dri, c.sourceSets) { +contentForDescription(c) @@ -190,7 +196,7 @@ open class DefaultPageCreator( } } - group(styles = setOf(ContentStyle.TabbedContent)) { + group(styles = setOf(ContentStyle.TabbedContent), sourceSets = mainSourcesetData + extensions.sourceSets) { +contentForComments(c) if (c is WithConstructors) { block( @@ -233,12 +239,7 @@ open class DefaultPageCreator( } +contentForScope(c, c.dri, c.sourceSets) - @Suppress("UNCHECKED_CAST") - val extensions = (c as WithExtraProperties) - .extra[CallableExtensions]?.extensions - ?.filterIsInstance() - - divergentBlock("Extensions", extensions.orEmpty(), ContentKind.Extensions, extra = mainExtra + SimpleAttr.header("Extensions")) + divergentBlock("Extensions", extensions, ContentKind.Extensions, extra = mainExtra + SimpleAttr.header("Extensions")) } } @@ -518,4 +519,7 @@ open class DefaultPageCreator( protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() + + private val List.sourceSets: Set + get() = flatMap { it.sourceSets }.toSet() } -- cgit