aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt3
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt17
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt4
3 files changed, 16 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index 23a67804..4daa4a50 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -60,7 +60,8 @@ private fun <T> mergeExpectActual(
): List<T> where T : Documentable, T : WithExpectActual {
fun findExpect(actual: T, expects: List<T>): Expect<T> =
- expects.find { it.platformData.containsAll(actual.platformData) }.let { Expect.from(it) }
+ expects.find { it.platformData.flatMap { it.targets }.containsAll(actual.platformData.flatMap { it.targets }) }
+ .let { Expect.from(it) }
fun reduceExpectActual(entry: Map.Entry<Expect<T>, List<T>>): List<T> = when (val expect = entry.key) {
Expect.NotFound -> entry.value
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index 50246e5a..a5d6540e 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -52,12 +52,17 @@ internal object ModuleAndPackageDocumentationTransformer : PreMergeDocumentableT
val doc = modulesAndPackagesDocumentation[Pair(module.name, pd)]
val facade = context.platforms[pd]?.facade
?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.name}") }
- doc?.get("Module")?.get(module.name)?.run {
- pd to MarkdownParser(
- facade,
- facade.moduleDescriptor,
- context.logger
- ).parse(this)
+ try {
+ doc?.get("Module")?.get(module.name)?.run {
+ pd to MarkdownParser(
+ facade,
+ facade.moduleDescriptor,
+ context.logger
+ ).parse(this)
+ }
+ } catch (e: IllegalArgumentException) {
+ context.logger.error(e.message.orEmpty())
+ null
}
}.toMap()
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 0e24fc08..c2f190c2 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -72,7 +72,9 @@ private class DokkaDescriptorVisitor(
descriptor: PackageFragmentDescriptor,
parent: DRIWithPlatformInfo
): DPackage {
- val driWithPlatform = DRI(packageName = descriptor.fqName.asString()).withEmptyInfo()
+ val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?:
+ "<" + platformData.targets.joinToString(",") + " root>"// TODO: error-prone, find a better way to do it
+ val driWithPlatform = DRI(packageName = name).withEmptyInfo()
val scope = descriptor.getMemberScope()
return DPackage(