From 33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Tue, 1 Sep 2020 14:20:03 +0200 Subject: Fix a bug in the DefaultLocationProvider which skipped lookup of some relocated DRIs --- .../external/DefaultExternalLocationProvider.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt') diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt index b92b5330..2600884d 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt @@ -10,15 +10,23 @@ open class DefaultExternalLocationProvider( val extension: String, val dokkaContext: DokkaContext ) : ExternalLocationProvider { + val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/" + override fun resolve(dri: DRI): String? { - val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/" externalDocumentation.packageList.locations[dri.toString()]?.let { path -> return "$docURL$path" } - val classNamesChecked = dri.classNames ?: return "$docURL${dri.packageName ?: ""}/index$extension" - val classLink = (listOfNotNull(dri.packageName) + classNamesChecked.split('.')) + if (dri.packageName !in externalDocumentation.packageList.packages) + return null + + return dri.constructPath() + } + + protected open fun DRI.constructPath(): String { + val classNamesChecked = classNames ?: return "$docURL${packageName ?: ""}/index$extension" + val classLink = (listOfNotNull(packageName) + classNamesChecked.split('.')) .joinToString("/", transform = ::identifierToFilename) - val callableChecked = dri.callable ?: return "$docURL$classLink/index$extension" + val callableChecked = callable ?: return "$docURL$classLink/index$extension" return "$docURL$classLink/" + identifierToFilename(callableChecked.name) + extension } } -- cgit