From ef753c8a1b9f02d9f6f026d555d628fbb207c574 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Mon, 27 Feb 2017 18:30:30 +0300 Subject: Package platforms detected based on it's members, refactored multiplatform tests layout --- core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt | 2 +- core/src/main/kotlin/Formats/StructuredFormatService.kt | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt index 6366ff61..0444a25a 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt @@ -148,7 +148,7 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, override fun appendIndexRow(platforms: Set, block: () -> Unit) { if (platforms.isNotEmpty()) - wrap("", "", block) + wrap("", "", block) else appendTableRow(block) } diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index b5a35356..79ebabe0 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -408,7 +408,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, return } - appendSection("Packages", node.members(NodeKind.Package)) + appendSection("Packages", node.members(NodeKind.Package), platformsBasedOnMembers = true) appendSection("Types", node.members.filter { it.kind in NodeKind.classLike && it.kind != NodeKind.TypeAlias && it.kind != NodeKind.AnnotationClass && it.kind != NodeKind.Exception }) appendSection("Annotations", node.members(NodeKind.AnnotationClass)) appendSection("Exceptions", node.members(NodeKind.Exception)) @@ -463,7 +463,8 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, private fun appendSection(caption: String, members: List, sortMembers: Boolean = true, - omitSamePlatforms: Boolean = false) { + omitSamePlatforms: Boolean = false, + platformsBasedOnMembers: Boolean = false) { if (members.isEmpty()) return appendHeader(3) { appendText(caption) } @@ -476,7 +477,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendTable("Name", "Summary") { appendTableBody { for ((memberLocation, members) in membersMap) { - val platforms = platformsOfItems(members, omitSamePlatforms) + val elementPlatforms = platformsOfItems(members, omitSamePlatforms) + val platforms = if (platformsBasedOnMembers) + members.flatMapTo(mutableSetOf()) { platformsOfItems(it.members) } + elementPlatforms + else + elementPlatforms appendIndexRow(platforms) { appendTableCell { appendLink(memberLocation) -- cgit