diff options
author | Szymon Świstun <sswistun@virtuslab.com> | 2019-12-17 17:13:25 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-01-08 10:45:08 +0100 |
commit | a0a5fc5e362c38ee0592ce5332bbec02131ebbd2 (patch) | |
tree | b4f5ab63d6f32ae318d2badbe9249a93104b2e79 | |
parent | fc1baea0b6c44ebc84a33918c3dfa13244ebf46f (diff) | |
download | dokka-a0a5fc5e362c38ee0592ce5332bbec02131ebbd2.tar.gz dokka-a0a5fc5e362c38ee0592ce5332bbec02131ebbd2.tar.bz2 dokka-a0a5fc5e362c38ee0592ce5332bbec02131ebbd2.zip |
module name fix
4 files changed, 14 insertions, 8 deletions
diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index 0bce22eb..0aeba264 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -94,10 +94,11 @@ data class TypeReference(val classNames: String, val typeBounds: List<TypeRefere TypeReference("", tp.upperBounds.map { from(it) }) private fun from(t: KotlinType): TypeReference = - when (val d = t.constructor.declarationDescriptor) { - is TypeParameterDescriptor -> TypeReference("todo:${d.name}") - else -> TypeReference(t.constructorName.orEmpty(), t.arguments.map { from(it) }) - } + TypeReference(t.constructorName.orEmpty(), t.arguments.map { from(it) }) +// when (val d = t.constructor.declarationDescriptor) { +// is TypeParameterDescriptor -> TypeReference("todo:${d.name}") +// else -> TypeReference(t.constructorName.orEmpty(), t.arguments.map { from(it) }) +// } private fun from(t: TypeProjection): TypeReference = if (t.isStarProjection) { diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index 9c40f73e..b32e4f4f 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -9,7 +9,7 @@ class DefaultPageBuilder( ) : PageBuilder { override fun pageForModule(m: Module): ModulePageNode = - ModulePageNode(m.name ?: "root", contentForModule(m), m, m.packages.map { pageForPackage(it) }) + ModulePageNode(m.name.ifEmpty { "root" }, contentForModule(m), m, m.packages.map { pageForPackage(it) }) override fun pageForPackage(p: Package) = PackagePageNode(p.name, contentForPackage(p), p.dri, p, diff --git a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt index 0020b18d..7442f449 100644 --- a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt +++ b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt @@ -50,7 +50,7 @@ open class DefaultLocationProvider( fun getPath(pathNode: PageNode?, path: List<String> = mutableListOf()): List<String> = when (pathNode) { null -> path - else -> getPath(pathNode.parent(), path + pathNode.pathName()) + else -> getPath(pathNode.parent(), path + pathNode.pathName().ifEmpty { "root" }) } val contextNode = if (context?.children?.isEmpty() == true) context.parent() else context diff --git a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt index fe689c01..626038f5 100644 --- a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt +++ b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationNodeMerger.kt @@ -1,18 +1,23 @@ package org.jetbrains.dokka.transformers.documentation +import com.intellij.openapi.diagnostic.logger import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.utilities.DokkaConsoleLogger internal object DefaultDocumentationNodeMerger : DocumentationNodeMerger { - override fun invoke(modules: Collection<Module>, context: DokkaContext): Module = - Module( + override fun invoke(modules: Collection<Module>, context: DokkaContext): Module { + if (!modules.drop(1).all { it.name == modules.first().name }) + DokkaConsoleLogger.error("All module names need to be the same") + return Module( modules.first().name, merge( modules.flatMap { it.packages }, Package::mergeWith ) ) + } } private fun <T: Documentable> merge(elements: List<T>, reducer: (T, T) -> T): List<T> = |