diff options
Diffstat (limited to 'plugins/base/src')
10 files changed, 37 insertions, 47 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt index 5e22206b..18f52cce 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt @@ -1,17 +1,17 @@ package org.jetbrains.dokka.base.resolvers.external import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider.Companion.identifierToFilename -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.plugability.DokkaContext open class DefaultExternalLocationProvider( - val externalDocumentationInfo: ExternalDocumentationInfo, + val externalDocumentation: ExternalDocumentation, val extension: String, val dokkaContext: DokkaContext ) : ExternalLocationProvider { override fun resolve(dri: DRI): String? { // TODO: classes without packages? - val docURL = externalDocumentationInfo.documentationURL.toString().removeSuffix("/") + "/" + val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/" val classNamesChecked = dri.classNames ?: return "$docURL${dri.packageName ?: ""}/index$extension" val classLink = (listOfNotNull(dri.packageName) + classNamesChecked.split('.')) .joinToString("/", transform = ::identifierToFilename) diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt index a6e09bac..bb9fb563 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProviderFactory.kt @@ -1,20 +1,20 @@ package org.jetbrains.dokka.base.resolvers.external -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat import org.jetbrains.dokka.plugability.DokkaContext class DefaultExternalLocationProviderFactory(val context: DokkaContext) : ExternalLocationProviderFactory by ExternalLocationProviderFactoryWithCache( object : ExternalLocationProviderFactory { - override fun getExternalLocationProvider(docInfo: ExternalDocumentationInfo): ExternalLocationProvider? = - when (docInfo.packageList.linkFormat) { + override fun getExternalLocationProvider(doc: ExternalDocumentation): ExternalLocationProvider? = + when (doc.packageList.linkFormat) { RecognizedLinkFormat.KotlinWebsiteHtml, RecognizedLinkFormat.DokkaOldHtml, - RecognizedLinkFormat.DokkaHtml -> DefaultExternalLocationProvider(docInfo, ".html", context) + RecognizedLinkFormat.DokkaHtml -> DefaultExternalLocationProvider(doc, ".html", context) RecognizedLinkFormat.DokkaGFM, - RecognizedLinkFormat.DokkaJekyll -> DefaultExternalLocationProvider(docInfo, ".md", context) + RecognizedLinkFormat.DokkaJekyll -> DefaultExternalLocationProvider(doc, ".md", context) else -> null } } - )
\ No newline at end of file + ) diff --git a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt index 10d9fffa..c7328765 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.base.resolvers.external -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation interface ExternalLocationProviderFactory { - fun getExternalLocationProvider(docInfo: ExternalDocumentationInfo): ExternalLocationProvider? -}
\ No newline at end of file + fun getExternalLocationProvider(doc: ExternalDocumentation): ExternalLocationProvider? +} diff --git a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactoryWithCache.kt b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactoryWithCache.kt index 4fa1f391..e4d2641e 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactoryWithCache.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactoryWithCache.kt @@ -1,16 +1,15 @@ package org.jetbrains.dokka.base.resolvers.external -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo -import org.jetbrains.dokka.base.resolvers.shared.PackageList +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import java.util.concurrent.ConcurrentHashMap class ExternalLocationProviderFactoryWithCache(val ext: ExternalLocationProviderFactory) : ExternalLocationProviderFactory { - private val locationProviders = ConcurrentHashMap<ExternalDocumentationInfo, CacheWrapper>() + private val locationProviders = ConcurrentHashMap<ExternalDocumentation, CacheWrapper>() - override fun getExternalLocationProvider(docInfo: ExternalDocumentationInfo): ExternalLocationProvider? = - locationProviders.getOrPut(docInfo) { CacheWrapper(ext.getExternalLocationProvider(docInfo)) }.provider + override fun getExternalLocationProvider(doc: ExternalDocumentation): ExternalLocationProvider? = + locationProviders.getOrPut(doc) { CacheWrapper(ext.getExternalLocationProvider(doc)) }.provider private class CacheWrapper(val provider: ExternalLocationProvider?) } diff --git a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt index d42b5b5c..48cf554c 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt @@ -1,20 +1,20 @@ package org.jetbrains.dokka.base.resolvers.external.javadoc import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProvider -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.utilities.htmlEscape class JavadocExternalLocationProvider( - externalDocumentationInfo: ExternalDocumentationInfo, + externalDocumentation: ExternalDocumentation, val brackets: String, val separator: String, dokkaContext: DokkaContext -) : DefaultExternalLocationProvider(externalDocumentationInfo, ".html", dokkaContext) { +) : DefaultExternalLocationProvider(externalDocumentation, ".html", dokkaContext) { override fun resolve(dri: DRI): String? { - val docURL = externalDocumentationInfo.documentationURL.toString().removeSuffix("/") + "/" + val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/" val packageLink = dri.packageName?.replace(".", "/") if (dri.classNames == null) { return "$docURL$packageLink/package-summary$extension".htmlEscape() @@ -28,4 +28,4 @@ class JavadocExternalLocationProvider( callableChecked.params.joinToString(separator) + "${brackets.last()}").htmlEscape() } -}
\ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProviderFactory.kt index 1cfd73a8..6fe39d35 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProviderFactory.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProviderFactory.kt @@ -3,23 +3,23 @@ package org.jetbrains.dokka.base.resolvers.external.javadoc import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProviderFactory import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProviderFactoryWithCache -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat import org.jetbrains.dokka.plugability.DokkaContext class JavadocExternalLocationProviderFactory(val context: DokkaContext) : ExternalLocationProviderFactory by ExternalLocationProviderFactoryWithCache( object : ExternalLocationProviderFactory { - override fun getExternalLocationProvider(docInfo: ExternalDocumentationInfo): ExternalLocationProvider? = - when (docInfo.packageList.linkFormat) { + override fun getExternalLocationProvider(doc: ExternalDocumentation): ExternalLocationProvider? = + when (doc.packageList.linkFormat) { RecognizedLinkFormat.Javadoc1 -> - JavadocExternalLocationProvider(docInfo, "()", ", ", context) // Covers JDK 1 - 7 + JavadocExternalLocationProvider(doc, "()", ", ", context) // Covers JDK 1 - 7 RecognizedLinkFormat.Javadoc8, RecognizedLinkFormat.DokkaJavadoc -> - JavadocExternalLocationProvider(docInfo, "--", "-", context) // Covers JDK 8 - 9 + JavadocExternalLocationProvider(doc, "--", "-", context) // Covers JDK 8 - 9 RecognizedLinkFormat.Javadoc10 -> - JavadocExternalLocationProvider(docInfo, "()", ",", context) // Covers JDK 10 + JavadocExternalLocationProvider(doc, "()", ",", context) // Covers JDK 10 else -> null } } - )
\ No newline at end of file + ) diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt index 1e20dc7e..45b39eec 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt @@ -2,18 +2,15 @@ package org.jetbrains.dokka.base.resolvers.local import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.base.DokkaBase -import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo +import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation import org.jetbrains.dokka.base.resolvers.shared.PackageList import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.model.DisplaySourceSet -import org.jetbrains.dokka.model.withDescendants -import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.query -import java.util.* abstract class DefaultLocationProvider( protected val pageGraphRoot: RootPageNode, @@ -29,7 +26,7 @@ abstract class DefaultLocationProvider( .flatMap { sourceSet -> sourceSet.externalDocumentationLinks.map { PackageList.load(it.packageListUrl, sourceSet.jdkVersion, dokkaContext) - ?.let { packageList -> ExternalDocumentationInfo(it.url, packageList) } + ?.let { packageList -> ExternalDocumentation(it.url, packageList) } } } .filterNotNull() @@ -48,4 +45,4 @@ abstract class DefaultLocationProvider( protected open fun getExternalLocation(dri: DRI, sourceSets: Set<DokkaSourceSet>): String? = packagesIndex[dri.packageName]?.resolve(dri) -}
\ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index 88536558..d2e6d49b 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt @@ -1,17 +1,11 @@ package org.jetbrains.dokka.base.resolvers.local import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet -import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint -import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider -import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo -import org.jetbrains.dokka.base.resolvers.shared.PackageList import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.plugability.plugin -import org.jetbrains.dokka.plugability.query import java.util.* open class DokkaLocationProvider( diff --git a/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentation.kt b/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentation.kt new file mode 100644 index 00000000..0ee7d1eb --- /dev/null +++ b/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentation.kt @@ -0,0 +1,5 @@ +package org.jetbrains.dokka.base.resolvers.shared + +import java.net.URL + +data class ExternalDocumentation(val documentationURL: URL, val packageList: PackageList) diff --git a/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentationInfo.kt b/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentationInfo.kt deleted file mode 100644 index 473d46d1..00000000 --- a/plugins/base/src/main/kotlin/resolvers/shared/ExternalDocumentationInfo.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.jetbrains.dokka.base.resolvers.shared - -import java.net.URL - -data class ExternalDocumentationInfo(val documentationURL: URL, val packageList: PackageList)
\ No newline at end of file |