aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-31 20:16:01 +0200
committerGitHub <noreply@github.com>2023-08-31 20:16:01 +0200
commit02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch)
tree66f6d6f089a93b863bf1144666491eca6729ad05 /plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
parent6a181a7a2b03ec263788d137610e86937a57d434 (diff)
downloaddokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip
Enable explicit API mode (#3139)
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt29
1 files changed, 19 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
index cfabff7e..dbcd5c76 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
@@ -10,11 +10,11 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.pages.PageNode
-interface LocationProvider {
- fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode? = null): String?
- fun resolve(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String?
- fun pathToRoot(from: PageNode): String
- fun ancestors(node: PageNode): List<PageNode>
+public interface LocationProvider {
+ public fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode? = null): String?
+ public fun resolve(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String?
+ public fun pathToRoot(from: PageNode): String
+ public fun ancestors(node: PageNode): List<PageNode>
/**
* This method should return guessed filesystem location for a given [DRI]
@@ -22,17 +22,26 @@ interface LocationProvider {
* generated package-list so it is ok if the path differs from the one returned by [resolve]
* @return Path to a giver [DRI] or null if path should not be considered for relocations
*/
- fun expectedLocationForDri(dri: DRI): String =
+ public fun expectedLocationForDri(dri: DRI): String =
(listOf(dri.packageName) +
dri.classNames?.split(".")?.map { identifierToFilename(it) }.orEmpty() +
listOf(dri.callable?.let { identifierToFilename(it.name) } ?: "index")
).filterNotNull().joinToString("/")
}
-fun LocationProvider.resolveOrThrow(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode? = null): String =
- resolve(dri = dri, sourceSets = sourceSets, context = context)
+public fun LocationProvider.resolveOrThrow(
+ dri: DRI, sourceSets: Set<DisplaySourceSet>,
+ context: PageNode? = null
+): String {
+ return resolve(dri = dri, sourceSets = sourceSets, context = context)
?: throw DokkaException("Cannot resolve path for $dri")
+}
-fun LocationProvider.resolveOrThrow(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String =
- resolve(node = node, context = context, skipExtension = skipExtension)
+public fun LocationProvider.resolveOrThrow(
+ node: PageNode,
+ context: PageNode? = null,
+ skipExtension: Boolean = false
+): String {
+ return resolve(node = node, context = context, skipExtension = skipExtension)
?: throw DokkaException("Cannot resolve path for ${node.name}")
+}