aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/descriptors
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-27 15:50:40 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-31 15:10:04 +0200
commit8cd28416817dfd7d28bb66b28e849d97cc09012b (patch)
tree962f9420f3ccdb47d6847c9e5a16d00018c9110c /plugins/base/src/main/kotlin/translators/descriptors
parent732d181e4908ed0ddc513e305addc71560c0e109 (diff)
downloaddokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.tar.gz
dokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.tar.bz2
dokka-8cd28416817dfd7d28bb66b28e849d97cc09012b.zip
Let module name be configurable withing `AbstractDokkaTask` and remove concept of `moduleDisplayName`
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/descriptors')
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt31
1 files changed, 25 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 18b05df4..8e5a1927 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -70,7 +70,15 @@ class DefaultDescriptorToDocumentableTranslator(
DRIWithPlatformInfo(DRI.topLevel, emptyMap())
)
}
- }.let { DModule(sourceSet.moduleDisplayName, it, emptyMap(), null, setOf(sourceSet)) }
+ }.let {
+ DModule(
+ name = context.configuration.moduleName,
+ packages = it,
+ documentation = emptyMap(),
+ expectPresentInSet = null,
+ sourceSets = setOf(sourceSet)
+ )
+ }
}
}
@@ -557,7 +565,9 @@ private class DokkaDescriptorVisitor(
private fun ClassDescriptor.resolveClassDescriptionData(): ClassInfo {
fun toTypeConstructor(kt: KotlinType) =
- TypeConstructor(DRI.from(kt.constructor.declarationDescriptor as DeclarationDescriptor), kt.arguments.map { it.toProjection() })
+ TypeConstructor(
+ DRI.from(kt.constructor.declarationDescriptor as DeclarationDescriptor),
+ kt.arguments.map { it.toProjection() })
tailrec fun buildAncestryInformation(
supertypes: Collection<KotlinType>,
@@ -753,13 +763,22 @@ private class DokkaDescriptorVisitor(
private fun ValueArgument.childrenAsText() = this.safeAs<KtValueArgument>()?.children?.map { it.text }.orEmpty()
- private data class AncestryLevel(val level: Int, val superclass: TypeConstructor?, val interfaces: List<TypeConstructor>)
+ private data class AncestryLevel(
+ val level: Int,
+ val superclass: TypeConstructor?,
+ val interfaces: List<TypeConstructor>
+ )
- private data class ClassInfo(val ancestry: List<AncestryLevel>, val docs: SourceSetDependent<DocumentationNode>){
+ private data class ClassInfo(val ancestry: List<AncestryLevel>, val docs: SourceSetDependent<DocumentationNode>) {
val supertypes: List<TypeConstructorWithKind>
get() = ancestry.firstOrNull { it.level == 0 }?.let {
- listOfNotNull(it.superclass?.let { TypeConstructorWithKind(it, KotlinClassKindTypes.CLASS) }) + it.interfaces.map { TypeConstructorWithKind(it, KotlinClassKindTypes.INTERFACE) }
- }.orEmpty()
+ listOfNotNull(it.superclass?.let {
+ TypeConstructorWithKind(
+ it,
+ KotlinClassKindTypes.CLASS
+ )
+ }) + it.interfaces.map { TypeConstructorWithKind(it, KotlinClassKindTypes.INTERFACE) }
+ }.orEmpty()
val allImplementedInterfaces: List<TypeConstructor>
get() = ancestry.flatMap { it.interfaces }.distinct()