diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-06-12 14:54:54 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-06-15 18:32:56 +0200 |
commit | bae2c8de63baf0c0b627a17ae179400fbc3c5be9 (patch) | |
tree | 42e7cd2a646eb67bb55e60e74a810bef13a834a6 /plugins/base/src/main/kotlin/transformers | |
parent | 4c9952dbfa2d9b304b10d6d3e43e2424e69fdfe8 (diff) | |
download | dokka-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.kt | 16 |
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 } } |