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.kt25
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt6
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt6
4 files changed, 15 insertions, 24 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index c8e4f565..17ead667 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -10,20 +10,15 @@ internal object DefaultDocumentableMerger : DocumentableMerger {
override fun invoke(modules: Collection<DModule>, context: DokkaContext): DModule {
- val projectName =
- modules.fold(modules.first().name) { acc, module -> acc.commonPrefixWith(module.name) }
- .takeIf { it.isNotEmpty() }
- ?: "project"
-
return modules.reduce { left, right ->
val list = listOf(left, right)
DModule(
- name = projectName,
+ name = modules.map { it.name }.distinct().joinToString("|"),
packages = merge(
list.flatMap { it.packages },
DPackage::mergeWith
),
- documentation = list.map { it.documentation }.flatMap { it.entries }.associate { (k,v) -> k to v },
+ documentation = list.map { it.documentation }.flatMap { it.entries }.associate { (k, v) -> k to v },
expectPresentInSet = list.firstNotNullResult { it.expectPresentInSet },
sourceSets = list.flatMap { it.sourceSets }.toSet()
).mergeExtras(left, right)
@@ -61,7 +56,7 @@ fun DFunction.mergeWith(other: DFunction): DFunction = copy(
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
modifier = modifier + other.modifier,
sourceSets = sourceSets + other.sourceSets,
@@ -72,7 +67,7 @@ fun DProperty.mergeWith(other: DProperty): DProperty = copy(
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
modifier = modifier + other.modifier,
sourceSets = sourceSets + other.sourceSets,
@@ -104,7 +99,7 @@ fun DClass.mergeWith(other: DClass): DClass = copy(
supertypes = supertypes + other.supertypes,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets
).mergeExtras(this, other)
@@ -122,7 +117,7 @@ fun DEnum.mergeWith(other: DEnum): DEnum = copy(
supertypes = supertypes + other.supertypes,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets
).mergeExtras(this, other)
@@ -143,7 +138,7 @@ fun DObject.mergeWith(other: DObject): DObject = copy(
supertypes = supertypes + other.supertypes,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets
).mergeExtras(this, other)
@@ -157,7 +152,7 @@ fun DInterface.mergeWith(other: DInterface): DInterface = copy(
supertypes = supertypes + other.supertypes,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets
).mergeExtras(this, other)
@@ -173,7 +168,7 @@ fun DAnnotation.mergeWith(other: DAnnotation): DAnnotation = copy(
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
documentation = documentation + other.documentation,
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
- sources = sources+ other.sources,
+ sources = sources + other.sources,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets,
generics = merge(generics + other.generics, DTypeParameter::mergeWith)
@@ -197,4 +192,4 @@ fun DTypeAlias.mergeWith(other: DTypeAlias): DTypeAlias = copy(
underlyingType = underlyingType + other.underlyingType,
visibility = visibility + other.visibility,
sourceSets = sourceSets + other.sourceSets
-).mergeExtras(this, other) \ No newline at end of file
+).mergeExtras(this, other)
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
index 66156832..6a6231c5 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
@@ -249,4 +249,4 @@ class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMe
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt
index e712d6e5..e126d05f 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationReader.kt
@@ -65,11 +65,7 @@ private class ContextModuleAndPackageDocumentationReader(
override fun get(module: DModule): SourceSetDependent<DocumentationNode> {
return findDocumentationNodes(module.sourceSets) { fragment ->
- fragment.classifier == Classifier.Module && (
- /* Match fragment name against module name or distinct module displayName */
- fragment.name == module.name ||
- fragment.name == module.sourceSets.map { it.moduleDisplayName }.distinct().singleOrNull()
- )
+ fragment.classifier == Classifier.Module && (fragment.name == module.name)
}
}
diff --git a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
index 2099cab5..ca239d83 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
@@ -62,12 +62,12 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
private fun ContentNode.addSample(
contentPage: ContentPage,
- platform: DokkaSourceSet,
+ sourceSet: DokkaSourceSet,
fqName: String,
analysis: Map<DokkaSourceSet, EnvironmentAndFacade>
): ContentNode {
- val facade = analysis[platform]?.facade
- ?: return this.also { context.logger.warn("Cannot resolve facade for platform ${platform.moduleDisplayName}") }
+ val facade = analysis[sourceSet]?.facade
+ ?: return this.also { context.logger.warn("Cannot resolve facade for platform ${sourceSet.sourceSetID}") }
val psiElement = fqNameToPsiElement(facade, fqName)
?: return this.also { context.logger.warn("Cannot find PsiElement corresponding to $fqName") }
val imports =