aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-12 14:54:54 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-06-15 18:32:56 +0200
commitbae2c8de63baf0c0b627a17ae179400fbc3c5be9 (patch)
tree42e7cd2a646eb67bb55e60e74a810bef13a834a6 /plugins/base/src/main/kotlin/transformers
parent4c9952dbfa2d9b304b10d6d3e43e2424e69fdfe8 (diff)
downloaddokka-bae2c8de63baf0c0b627a17ae179400fbc3c5be9.tar.gz
dokka-bae2c8de63baf0c0b627a17ae179400fbc3c5be9.tar.bz2
dokka-bae2c8de63baf0c0b627a17ae179400fbc3c5be9.zip
Fix sourceSet matching inside ReportUndocumentedTransformer
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt16
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index d33b41bf..31d1d241 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -90,17 +90,21 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
private fun isUndocumented(documentable: Documentable, sourceSet: SourceSetData): Boolean {
fun resolveDependentSourceSets(sourceSet: SourceSetData): List<SourceSetData> {
- return sourceSet.dependentSourceSets.map { sourceSetName ->
- documentable.sourceSets.single { it.sourceSetID == sourceSetName }
+ return sourceSet.dependentSourceSets.mapNotNull { sourceSetID ->
+ documentable.sourceSets.singleOrNull { it.sourceSetID == sourceSetID }
}
}
- fun flatDependentSourceSetsTree(sourceSet: SourceSetData): List<SourceSetData> {
- return listOf(sourceSet) + resolveDependentSourceSets(sourceSet)
- .flatMap { resolveDependentSourceSets -> flatDependentSourceSetsTree(resolveDependentSourceSets) }
+ fun withAllDependentSourceSets(sourceSet: SourceSetData): Sequence<SourceSetData> {
+ return sequence {
+ yield(sourceSet)
+ for (dependentSourceSet in resolveDependentSourceSets(sourceSet)) {
+ yieldAll(withAllDependentSourceSets(dependentSourceSet))
+ }
+ }
}
- return flatDependentSourceSetsTree(sourceSet).all { sourceSetOrDependentSourceSet ->
+ return withAllDependentSourceSets(sourceSet).all { sourceSetOrDependentSourceSet ->
documentable.documentation[sourceSetOrDependentSourceSet]?.children?.isEmpty() ?: true
}
}