From d7be30c841cb925fd0d6322ccdd9877169730b92 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Thu, 28 May 2020 16:04:20 +0200 Subject: Add platform dependent annotations --- .../base/src/main/kotlin/signatures/JvmSignatureUtils.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt') diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index 0ae72109..0cf085b8 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -15,8 +15,8 @@ interface JvmSignatureUtils { fun Set.toSignatureString(): String = joinToString("") { it.name.toLowerCase() + " " } - fun WithExtraProperties.annotations(): List = - extra[Annotations]?.content ?: emptyList() + fun WithExtraProperties.annotations(): SourceSetDependent> = + extra[Annotations]?.content ?: emptyMap() private fun Annotations.Annotation.toSignatureString(): String = "@" + this.dri.classNames + "(" + this.params.entries.joinToString { it.key + "=" + it.value } + ")" @@ -24,7 +24,7 @@ interface JvmSignatureUtils { private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, ignored: Set, - operation: (Annotations.Annotation) -> Unit + operation: PageContentBuilder.DocumentableContentBuilder.(Annotations.Annotation) -> Unit ): Unit = when (d) { is DFunction -> d.annotations() is DProperty -> d.annotations() @@ -39,8 +39,12 @@ interface JvmSignatureUtils { is DParameter -> d.annotations() else -> null }?.let { - it.filter { it !in ignored }.forEach { - operation(it) + it.entries.forEach { + group(sourceSets = setOf(it.key)) { + it.value.filter { it !in ignored }.forEach { + operation(it) + } + } } } ?: Unit @@ -50,6 +54,7 @@ interface JvmSignatureUtils { listBrackets: Pair, classExtension: String ) { + when (renderAtStrategy) { is All, is OnlyOnce -> text("@") is Never -> Unit -- cgit