aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers/local
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-09-01 15:35:32 +0200
committerAndrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com>2020-09-08 12:52:59 +0200
commit1c0be46a1d40c8c706486b5488e5897f1e7ab610 (patch)
treed5625277837dfec3032092488b84e69251ffc57f /plugins/base/src/main/kotlin/resolvers/local
parent46c56dc71ed2c6d73a70ed4fd8255eeda2420ff4 (diff)
downloaddokka-1c0be46a1d40c8c706486b5488e5897f1e7ab610.tar.gz
dokka-1c0be46a1d40c8c706486b5488e5897f1e7ab610.tar.bz2
dokka-1c0be46a1d40c8c706486b5488e5897f1e7ab610.zip
Fix multimodule DRI location provider mapping
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/local')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
index 0269d7a6..14111a3b 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt
@@ -27,11 +27,11 @@ open class DokkaLocationProvider(
pageGraphRoot.children.forEach { registerPath(it, emptyList()) }
}
- protected val pagesIndex: Map<Pair<DRI, DisplaySourceSet>, ContentPage> =
+ protected val pagesIndex: Map<Pair<DRI, DisplaySourceSet?>, ContentPage> =
pageGraphRoot.withDescendants().filterIsInstance<ContentPage>()
.flatMap { page ->
page.dri.flatMap { dri ->
- page.sourceSets().map { sourceSet -> (dri to sourceSet) to page }
+ page.sourceSets().ifEmpty { setOf(null) }.map { sourceSet -> (dri to sourceSet) to page }
}
}
.groupingBy { it.first }
@@ -39,7 +39,7 @@ open class DokkaLocationProvider(
if (first) page else throw AssertionError("Multiple pages associated with key: ${key.first}/${key.second}")
}
- protected val anchorsIndex: Map<Pair<DRI, DisplaySourceSet>, ContentPage> =
+ protected val anchorsIndex: Map<Pair<DRI, DisplaySourceSet?>, ContentPage> =
pageGraphRoot.withDescendants().filterIsInstance<ContentPage>()
.flatMap { page ->
page.content.withDescendants()
@@ -47,7 +47,7 @@ open class DokkaLocationProvider(
.mapNotNull { it.dci.dri.singleOrNull() }
.distinct()
.flatMap { dri ->
- page.sourceSets().map { sourceSet ->
+ page.sourceSets().ifEmpty { setOf(null) }.map { sourceSet ->
(dri to sourceSet) to page
}
}
@@ -57,7 +57,7 @@ open class DokkaLocationProvider(
pathTo(node, context) + if (!skipExtension) extension else ""
override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?): String? =
- sourceSets.mapNotNull { sourceSet ->
+ sourceSets.ifEmpty { setOf(null) }.mapNotNull { sourceSet ->
val driWithSourceSet = Pair(dri, sourceSet)
getLocalLocation(driWithSourceSet, context)
?: getLocalLocation(driWithSourceSet.copy(first = dri.copy(target = PointingToDeclaration)), context)
@@ -66,7 +66,7 @@ open class DokkaLocationProvider(
?: getExternalLocation(dri.copy(target = PointingToDeclaration), sourceSets)
}.distinct().singleOrNull()
- private fun getLocalLocation(dri: Pair<DRI, DisplaySourceSet>, context: PageNode?): String? =
+ private fun getLocalLocation(dri: Pair<DRI, DisplaySourceSet?>, context: PageNode?): String? =
pagesIndex[dri]?.let { resolve(it, context) }
?: anchorsIndex[dri]?.let { resolve(it, context) + "#$dri" }