diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-04-14 14:14:31 +0200 |
---|---|---|
committer | Kamil Doległo <kamilok1965@interia.pl> | 2020-04-15 12:15:04 +0200 |
commit | 64e600b126ae8edcfbb3c2716febb01d221520b5 (patch) | |
tree | 63e1c32599e1525fed431cb26b10d4d3e7239c49 /plugins/base/src/main | |
parent | bc843d67b455e484cd05cdf28e5ce5dec68119d4 (diff) | |
download | dokka-64e600b126ae8edcfbb3c2716febb01d221520b5.tar.gz dokka-64e600b126ae8edcfbb3c2716febb01d221520b5.tar.bz2 dokka-64e600b126ae8edcfbb3c2716febb01d221520b5.zip |
Fix path clash with top-level declarations, catch link resolving exception, remove default values while merging, merge expect by targets
Diffstat (limited to 'plugins/base/src/main')
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( |