From b0e8622f374f6499058b0f083367b4a54512b702 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Tue, 30 Jun 2020 23:06:03 +0200 Subject: Enforce workspace unique SourceSetID --- .../documentables/DocumentableVisibilityFilterTransformer.kt | 12 +++++------- .../documentables/EmptyPackagesFilterTransformer.kt | 6 +++--- .../ModuleAndPackageDocumentationTransformer.kt | 4 +--- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'plugins/base/src/main/kotlin/transformers/documentables') diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt index c3cc4d38..ff05beed 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt @@ -9,11 +9,9 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer { override fun invoke(modules: List) = modules.map { original -> - val passOptions = original.sourceSets.single() - val packageOptions = passOptions.perPackageOptions - original.let { - DocumentableVisibilityFilter(packageOptions, passOptions).processModule(it) - } + val sourceSet = original.sourceSets.single() + val packageOptions = sourceSet.perPackageOptions + DocumentableVisibilityFilter(packageOptions, sourceSet).processModule(original) } private class DocumentableVisibilityFilter( @@ -45,7 +43,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe private fun filterPackages(packages: List): Pair> { var packagesListChanged = false - val filteredPackages = packages.mapNotNull { + val filteredPackages = packages.map { var modified = false val functions = filterFunctions(it.functions).let { (listModified, list) -> modified = modified || listModified @@ -326,4 +324,4 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe return Pair(classlikesListChanged, filteredClasslikes) } } -} \ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt index 3fd0081a..61abfbd7 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt @@ -14,9 +14,9 @@ class EmptyPackagesFilterTransformer(val context: DokkaContext) : PreMergeDocume } private class EmptyPackagesFilter( - val passOptions: DokkaConfiguration.DokkaSourceSet + val sourceSet: DokkaConfiguration.DokkaSourceSet ) { - fun DPackage.shouldBeSkipped() = passOptions.skipEmptyPackages && + fun DPackage.shouldBeSkipped() = sourceSet.skipEmptyPackages && functions.isEmpty() && properties.isEmpty() && classlikes.isEmpty() @@ -25,4 +25,4 @@ class EmptyPackagesFilterTransformer(val context: DokkaContext) : PreMergeDocume packages = module.packages.filter { !it.shouldBeSkipped() } ) } -} \ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt index 1f718a7c..a0800da8 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt @@ -1,12 +1,10 @@ package org.jetbrains.dokka.base.transformers.documentables -import org.jetbrains.dokka.analysis.EnvironmentAndFacade import org.jetbrains.dokka.analysis.KotlinAnalysis import org.jetbrains.dokka.model.DModule import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.base.parsers.MarkdownParser -import org.jetbrains.dokka.model.SourceSetDependent import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer import org.jetbrains.kotlin.name.FqName @@ -24,7 +22,7 @@ internal class ModuleAndPackageDocumentationTransformer( val modulesAndPackagesDocumentation = context.configuration.sourceSets .map { - Pair(it.moduleName, it) to + Pair(it.moduleDisplayName, it) to it.includes.map { Paths.get(it) } .also { it.forEach { -- cgit