aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt6
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/EmptyModulesFilterTransformer.kt10
2 files changed, 12 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index 4c931230..94e27424 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -12,9 +12,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
internal class DefaultDocumentableMerger(val context: DokkaContext) : DocumentableMerger {
private val dependencyInfo = context.getDependencyInfo()
- override fun invoke(modules: Collection<DModule>): DModule {
-
- return modules.reduce { left, right ->
+ override fun invoke(modules: Collection<DModule>): DModule? =
+ modules.reduceOrNull { left, right ->
val list = listOf(left, right)
DModule(
name = modules.map { it.name }.distinct().joinToString("|"),
@@ -26,7 +25,6 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab
sourceSets = list.flatMap { it.sourceSets }.toSet()
).mergeExtras(left, right)
}
- }
private fun DokkaContext.getDependencyInfo()
: Map<DokkaConfiguration.DokkaSourceSet, List<DokkaConfiguration.DokkaSourceSet>> {
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/EmptyModulesFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/EmptyModulesFilterTransformer.kt
new file mode 100644
index 00000000..fa31c5c3
--- /dev/null
+++ b/plugins/base/src/main/kotlin/transformers/documentables/EmptyModulesFilterTransformer.kt
@@ -0,0 +1,10 @@
+package org.jetbrains.dokka.base.transformers.documentables
+
+import org.jetbrains.dokka.model.DModule
+import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer
+
+class EmptyModulesFilterTransformer : PreMergeDocumentableTransformer {
+ override fun invoke(modules: List<DModule>): List<DModule> {
+ return modules.filter { it.children.isNotEmpty() }
+ }
+} \ No newline at end of file