aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-13 09:59:39 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-17 11:52:28 +0200
commitf6ac2b0f0a0183171aa2f6806ec67d8d21692a36 (patch)
treea912d7ba4d7d368b9a3683a6cf290ca135ee231a /plugins/base/src/main/kotlin/resolvers
parent86fcfb73d2d5124ae7748a80db29bdbb68607be4 (diff)
downloaddokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.tar.gz
dokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.tar.bz2
dokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.zip
Implement `ContentSourceSet`
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt9
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt3
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt4
4 files changed, 9 insertions, 11 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt
index 4204006e..a9a5e498 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt
@@ -1,9 +1,10 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.pages.ContentSourceSet
+import org.jetbrains.dokka.pages.sourceSetIDs
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.query
@@ -23,12 +24,10 @@ abstract class BaseLocationProvider(protected val dokkaContext: DokkaContext) :
protected fun getExternalLocation(
dri: DRI,
- sourceSets: Set<DokkaSourceSet>
+ sourceSets: Set<ContentSourceSet>
): String {
val jdkToExternalDocumentationLinks = dokkaContext.configuration.sourceSets
- .filter { sourceSet ->
- sourceSets.contains(sourceSet)
- }
+ .filter { sourceSet -> sourceSet.sourceSetID in sourceSets.sourceSetIDs }
.groupBy({ it.jdkVersion }, { it.externalDocumentationLinks })
.map { it.key to it.value.flatten().distinct() }.toMap()
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
index 1df0a700..0021b7fb 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint
import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider
import org.jetbrains.dokka.links.DRI
@@ -51,7 +50,7 @@ open class DefaultLocationProvider(
override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String =
pathTo(node, context) + if (!skipExtension) extension else ""
- override fun resolve(dri: DRI, sourceSets: Set<DokkaSourceSet>, context: PageNode?): String =
+ override fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode?): String =
pagesIndex[dri]?.let { resolve(it, context) }
?: anchorsIndex[dri]?.let { resolve(it, context) + "#$dri" }
// Not found in PageGraph, that means it's an external link
diff --git a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
index 745636d0..bf5d9be4 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
@@ -1,12 +1,12 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.pages.ContentSourceSet
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
interface LocationProvider {
- fun resolve(dri: DRI, sourceSets: Set<DokkaSourceSet>, context: PageNode? = null): String
+ fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode? = null): String
fun resolve(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String
fun resolveRoot(node: PageNode): String
fun ancestors(node: PageNode): List<PageNode>
diff --git a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
index 54aded35..c5e16cc3 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.pages.ContentSourceSet
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
@@ -14,7 +14,7 @@ class MultimoduleLocationProvider(private val root: RootPageNode, context: Dokka
it.name to it.path
}.toMap()
- override fun resolve(dri: DRI, sourceSets: Set<DokkaSourceSet>, context: PageNode?): String =
+ override fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode?): String =
dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let {
"$it/${identifierToFilename(dri.classNames.orEmpty())}/index.html"
} ?: defaultLocationProvider.resolve(dri, sourceSets, context)