diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-01 14:20:03 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-09-30 13:43:08 +0200 |
commit | 33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6 (patch) | |
tree | 651cc172784f0dcf2c19b0f9e1a995866b48ba1a /plugins/base/src/main/kotlin/resolvers/local | |
parent | 377a3dc5578a0d3242cd03ac15196aafa205601a (diff) | |
download | dokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.tar.gz dokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.tar.bz2 dokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.zip |
Fix a bug in the DefaultLocationProvider which skipped lookup of some relocated DRIs
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/local')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt index e085af1a..293ca2d4 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt @@ -20,7 +20,7 @@ abstract class DefaultLocationProvider( protected val externalLocationProviderFactories = dokkaContext.plugin<DokkaBase>().query { externalLocationProviderFactory } - protected val packagesIndex: Map<String, ExternalLocationProvider?> = dokkaContext + protected val externalLocationProviders: Map<ExternalDocumentation, ExternalLocationProvider?> = dokkaContext .configuration .sourceSets .flatMap { sourceSet -> @@ -30,18 +30,32 @@ abstract class DefaultLocationProvider( } } .filterNotNull() - .flatMap { extDocInfo -> - extDocInfo.packageList.packages.map { packageName -> - val externalLocationProvider = (externalLocationProviderFactories.asSequence() - .mapNotNull { it.getExternalLocationProvider(extDocInfo) }.firstOrNull() - ?: run { dokkaContext.logger.error("No ExternalLocationProvider for '${extDocInfo.packageList.url}' found"); null }) - packageName to externalLocationProvider - } + .map { extDocInfo -> + val externalLocationProvider = (externalLocationProviderFactories.asSequence() + .mapNotNull { it.getExternalLocationProvider(extDocInfo) }.firstOrNull() + ?: run { dokkaContext.logger.error("No ExternalLocationProvider for '${extDocInfo.packageList.url}' found"); null }) + extDocInfo to externalLocationProvider + } + .toMap() + + protected val packagesIndex: Map<String, ExternalLocationProvider?> = externalLocationProviders + .flatMap { (extDocInfo, externalLocationProvider) -> + extDocInfo.packageList.packages.map { packageName -> packageName to externalLocationProvider } + } + .toMap() + .filterKeys(String::isNotBlank) + + + protected val locationsIndex: Map<String, ExternalLocationProvider?> = externalLocationProviders + .flatMap { (extDocInfo, externalLocationProvider) -> + extDocInfo.packageList.locations.keys.map { relocatedDri -> relocatedDri to externalLocationProvider } } .toMap() .filterKeys(String::isNotBlank) protected open fun getExternalLocation(dri: DRI, sourceSets: Set<DisplaySourceSet>): String? = packagesIndex[dri.packageName]?.resolve(dri) + ?: locationsIndex[dri.toString()]?.resolve(dri) + ?: externalLocationProviders.values.mapNotNull { it?.resolve(dri) }.firstOrNull() } |