diff options
Diffstat (limited to 'core/src/main/kotlin/resolvers')
-rw-r--r-- | core/src/main/kotlin/resolvers/DefaultLocationProvider.kt | 4 | ||||
-rw-r--r-- | core/src/main/kotlin/resolvers/ExternalLocationProvider.kt | 19 |
2 files changed, 12 insertions, 11 deletions
diff --git a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt index f8faa45b..669b720e 100644 --- a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt +++ b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt @@ -13,8 +13,8 @@ open class DefaultLocationProvider(private val pageGraphRoot: PageNode, val conf // Not found in PageGraph, that means it's an external link ExternalLocationProvider.getLocation(dri, configuration.passesConfigurations - .filter { passConfig -> passConfig.targets.toSet() == platforms.toSet() } // TODO: change targets to something better? - .flatMap { it.externalDocumentationLinks }.map { it.packageListUrl }.distinct() + .filter { passConfig -> passConfig.targets.map { PlatformData(it, passConfig.analysisPlatform)}.toSet() == platforms.toSet() } // TODO: change targets to something better? + .flatMap { it.externalDocumentationLinks }.distinct() ) override fun resolveRoot(node: PageNode): String = "../${pathTo(pageGraphRoot, node).removeSuffix( diff --git a/core/src/main/kotlin/resolvers/ExternalLocationProvider.kt b/core/src/main/kotlin/resolvers/ExternalLocationProvider.kt index e9181148..d3d8fa0d 100644 --- a/core/src/main/kotlin/resolvers/ExternalLocationProvider.kt +++ b/core/src/main/kotlin/resolvers/ExternalLocationProvider.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.resolvers +import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink import org.jetbrains.dokka.links.DRI import java.net.HttpURLConnection import java.net.URL @@ -10,22 +11,22 @@ object ExternalLocationProvider { // TODO: Refactor this!!! private val cache: MutableMap<URL, LocationInfo> = mutableMapOf() - fun getLocation(dri: DRI, packageLocations: List<URL>): String { - val toResolve: MutableList<URL> = mutableListOf() - for(url in packageLocations){ - val info = cache[url] + fun getLocation(dri: DRI, externalDocumentationLinks: List<ExternalDocumentationLink>): String { + val toResolve: MutableList<ExternalDocumentationLink> = mutableListOf() + for(link in externalDocumentationLinks){ + val info = cache[link.packageListUrl] if(info == null) { - toResolve.add(url) + toResolve.add(link) } else if(info.packages.contains(dri.packageName)) { - return getLink(dri, info) + return link.url.toExternalForm() + getLink(dri, info) } } // Not in cache, resolve packageLists while (toResolve.isNotEmpty()){ - val loc = toResolve.first().also { toResolve.remove(it) } - val locationInfo = loadPackageList(loc) + val link = toResolve.first().also { toResolve.remove(it) } + val locationInfo = loadPackageList(link.packageListUrl) if(locationInfo.packages.contains(dri.packageName)) { - return getLink(dri, locationInfo) + return link.url.toExternalForm() + getLink(dri, locationInfo) } } return "" |