aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc')
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt35
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt19
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt10
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt22
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt2
5 files changed, 45 insertions, 43 deletions
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
index a92320dd..f8ecf868 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocLocationProvider.kt
@@ -1,11 +1,11 @@
package javadoc
import javadoc.pages.*
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
@@ -22,8 +22,8 @@ class JavadocLocationProvider(pageRoot: RootPageNode, private val context: Dokka
externalLocationProviderFactories.asSequence().map { it.getExternalLocationProvider("javadoc10") }
.filterNotNull().take(1).firstOrNull()
private val externalDocumentationLinks by lazy {
- context.configuration.passesConfigurations
- .filter { passConfig -> passConfig.analysisPlatform == Platform.jvm }
+ context.configuration.sourceSets
+ .filter { sourceSet -> sourceSet.analysisPlatform == Platform.jvm }
.flatMap { it.externalDocumentationLinks }
.distinct()
}
@@ -65,7 +65,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, private val context: Dokka
private operator fun IdentityHashMap<PageNode, List<String>>.get(dri: DRI) = this[nodeIndex[dri]]
- override fun resolve(dri: DRI, sourceSets: List<SourceSetData>, context: PageNode?): String =
+ override fun resolve(dri: DRI, sourceSets: List<DokkaSourceSet>, context: PageNode?): String =
context?.let { resolve(it, skipExtension = false) } ?: nodeIndex[dri]?.let {
resolve(it, skipExtension = true)
} ?: with(externalLocationProvider!!) {
@@ -79,19 +79,20 @@ class JavadocLocationProvider(pageRoot: RootPageNode, private val context: Dokka
throw IllegalStateException("Path for ${node::class.java.canonicalName}:${node.name} not found")
}
- fun resolve(link: LinkJavadocListEntry, dir: String = "", skipExtension: Boolean = true) = pathIndex[link.dri.first()]?.let {
- when (link.kind) {
- JavadocContentKind.Class -> it
- JavadocContentKind.OverviewSummary -> it.dropLast(1) + "index"
- JavadocContentKind.PackageSummary -> it.dropLast(1) + "package-summary"
- JavadocContentKind.AllClasses -> it.dropLast(1) + "allclasses"
- JavadocContentKind.OverviewTree -> it.dropLast(1) + "overview-tree"
- JavadocContentKind.PackageTree -> it.dropLast(1) + "package-tree"
- else -> it
- }
- }?.joinToString("/")?.let {if (skipExtension) "$it.html" else it}?.let {
- Paths.get(dir).relativize(Paths.get(it)).toString()
- } ?: run {""} //TODO just a glue to compile it on HMPP
+ fun resolve(link: LinkJavadocListEntry, dir: String = "", skipExtension: Boolean = true) =
+ pathIndex[link.dri.first()]?.let {
+ when (link.kind) {
+ JavadocContentKind.Class -> it
+ JavadocContentKind.OverviewSummary -> it.dropLast(1) + "index"
+ JavadocContentKind.PackageSummary -> it.dropLast(1) + "package-summary"
+ JavadocContentKind.AllClasses -> it.dropLast(1) + "allclasses"
+ JavadocContentKind.OverviewTree -> it.dropLast(1) + "overview-tree"
+ JavadocContentKind.PackageTree -> it.dropLast(1) + "package-tree"
+ else -> it
+ }
+ }?.joinToString("/")?.let { if (skipExtension) "$it.html" else it }?.let {
+ Paths.get(dir).relativize(Paths.get(it)).toString()
+ } ?: run { "" } //TODO just a glue to compile it on HMPP
override fun resolveRoot(node: PageNode): String {
TODO("Not yet implemented")
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
index 53292225..6cf34ed1 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPageCreator.kt
@@ -1,6 +1,7 @@
package javadoc
import javadoc.pages.*
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.signatures.function
@@ -40,7 +41,7 @@ open class JavadocPageCreator(
)
fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? =
- c.sourceSets.firstOrNull { it.platform == Platform.jvm }?.let { jvm ->
+ c.sourceSets.firstOrNull { it.analysisPlatform == Platform.jvm }?.let { jvm ->
JavadocClasslikePageNode(
name = c.name.orEmpty(),
content = contentForClasslike(c),
@@ -72,11 +73,11 @@ open class JavadocPageCreator(
JavadocContentGroup(
setOf(m.dri),
JavadocContentKind.OverviewSummary,
- m.sourceSets.filter { it.platform == Platform.jvm }.toSet()
+ m.sourceSets.filter { it.analysisPlatform == Platform.jvm }.toSet()
) {
title(m.name, "0.0.1", dri = setOf(m.dri), kind = ContentKind.Main)
list("Packages", "Package", setOf(m.dri), ContentKind.Packages, m.packages.sortedBy { it.name }.map { p ->
- val description = p.documentation.entries.find { (k, _) -> k.platform == Platform.jvm }?.value?.let {
+ val description = p.documentation.entries.find { (k, _) -> k.analysisPlatform == Platform.jvm }?.value?.let {
it.children.firstIsInstanceOrNull<Description>()?.let { description ->
DocTagToContentConverter.buildContent(
description.root,
@@ -96,7 +97,7 @@ open class JavadocPageCreator(
JavadocContentGroup(
setOf(p.dri),
JavadocContentKind.PackageSummary,
- p.sourceSets.filter { it.platform == Platform.jvm }.toSet()
+ p.sourceSets.filter { it.analysisPlatform == Platform.jvm }.toSet()
) {
title(p.name, "0.0.1", dri = setOf(p.dri), kind = ContentKind.Packages)
list("Packages", "Package", setOf(p.dri), ContentKind.Packages, p.classlikes.sortedBy { it.name }.map { c ->
@@ -111,7 +112,7 @@ open class JavadocPageCreator(
JavadocContentGroup(
setOf(c.dri),
JavadocContentKind.Class,
- c.sourceSets.filter { it.platform == Platform.jvm }.toSet()
+ c.sourceSets.filter { it.analysisPlatform == Platform.jvm }.toSet()
) {
title(
c.name.orEmpty(),
@@ -146,7 +147,7 @@ open class JavadocPageCreator(
is UnresolvedBound -> p.name
}
- private fun DFunction.toJavadocFunction(sourceSetData: SourceSetData) = JavadocFunctionNode(
+ private fun DFunction.toJavadocFunction(sourceSetData: DokkaSourceSet) = JavadocFunctionNode(
name = name,
signature = signatureProvider.signature(this).jvmSignature(),
brief = TextNode(description(sourceSetData), setOf(sourceSetData)),
@@ -161,12 +162,12 @@ open class JavadocPageCreator(
)
fun List<ContentNode>.jvmSignature(): ContentNode =
- first { it.sourceSets.any { it.platform == Platform.jvm } }
+ first { it.sourceSets.any { it.analysisPlatform == Platform.jvm } }
- private fun Documentable.description(sourceSetData: SourceSetData): String =
+ private fun Documentable.description(sourceSetData: DokkaSourceSet): String =
findNodeInDocumentation<Description>(sourceSetData)
- private inline fun <reified T : TagWrapper> Documentable.findNodeInDocumentation(sourceSetData: SourceSetData): String =
+ private inline fun <reified T : TagWrapper> Documentable.findNodeInDocumentation(sourceSetData: DokkaSourceSet): String =
documentation[sourceSetData]?.children?.firstIsInstanceOrNull<T>()?.root?.children?.firstIsInstanceOrNull<Text>()?.body.orEmpty()
}
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
index 370ee68b..23a7c9ed 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/KorteJavadocRenderer.kt
@@ -12,7 +12,7 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.ImplementedInterfaces
import org.jetbrains.dokka.model.InheritedFunction
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.renderers.Renderer
@@ -269,13 +269,13 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
) + renderJavadocContentNode(node.content)
private fun renderImplementedInterfaces(node: JavadocClasslikePageNode) =
- node.extras[ImplementedInterfaces]?.interfaces?.entries?.firstOrNull { it.key.platform == Platform.jvm }?.value?.map { it.displayable() } // TODO: REMOVE HARDCODED JVM DEPENDENCY
+ node.extras[ImplementedInterfaces]?.interfaces?.entries?.firstOrNull { it.key.analysisPlatform == Platform.jvm }?.value?.map { it.displayable() } // TODO: REMOVE HARDCODED JVM DEPENDENCY
.orEmpty()
private fun renderClasslikeMethods(nodes: List<JavadocFunctionNode>): TemplateMap {
val (inherited, own) = nodes.partition {
val extra = it.extras[InheritedFunction]
- extra?.inheritedFrom?.keys?.first { it.platform == Platform.jvm }?.let { jvm ->
+ extra?.inheritedFrom?.keys?.first { it.analysisPlatform == Platform.jvm }?.let { jvm ->
extra.isInherited(jvm)
} ?: false
}
@@ -294,7 +294,7 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
private fun renderInheritedMethod(node: JavadocFunctionNode): TemplateMap {
val inheritedFrom = node.extras[InheritedFunction]?.inheritedFrom
return mapOf(
- "inheritedFrom" to inheritedFrom?.entries?.firstOrNull { it.key.platform == Platform.jvm }?.value?.displayable() // TODO: REMOVE HARDCODED JVM DEPENDENCY
+ "inheritedFrom" to inheritedFrom?.entries?.firstOrNull { it.key.analysisPlatform == Platform.jvm }?.value?.displayable() // TODO: REMOVE HARDCODED JVM DEPENDENCY
.orEmpty(),
"name" to node.name
)
@@ -370,7 +370,7 @@ class KorteJavadocRenderer(val outputWriter: OutputWriter, val context: DokkaCon
)
}
- private fun resolveLink(address: DRI, sourceSets: Set<SourceSetData>) =
+ private fun resolveLink(address: DRI, sourceSets: Set<DokkaSourceSet>) =
locationProvider.resolve(address, sourceSets.toList()).let {
val afterFormattingToHtml = formatToEndWithHtml(it)
if (currentLocation != null) afterFormattingToHtml.relativizePath(currentLocation)
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
index 6587e290..286223fa 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocContentNodes.kt
@@ -1,7 +1,7 @@
package javadoc.pages
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
@@ -12,7 +12,7 @@ enum class JavadocContentKind : Kind {
abstract class JavadocContentNode(
dri: Set<DRI>,
kind: Kind,
- override val sourceSets: Set<SourceSetData>
+ override val sourceSets: Set<DokkaSourceSet>
) : ContentNode {
override val dci: DCI = DCI(dri, kind)
override val style: Set<Style> = emptySet()
@@ -27,7 +27,7 @@ interface JavadocListEntry {
class EmptyNode(
dri: DRI,
kind: Kind,
- override val sourceSets: Set<SourceSetData>,
+ override val sourceSets: Set<DokkaSourceSet>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentNode {
override val dci: DCI = DCI(setOf(dri), kind)
@@ -42,7 +42,7 @@ class EmptyNode(
class JavadocContentGroup(
val dri: Set<DRI>,
val kind: Kind,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
val children: List<JavadocContentNode>
) : JavadocContentNode(dri, kind, sourceSets) {
@@ -50,7 +50,7 @@ class JavadocContentGroup(
operator fun invoke(
dri: Set<DRI>,
kind: Kind,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
block: JavaContentGroupBuilder.() -> Unit
): JavadocContentGroup =
JavadocContentGroup(dri, kind, sourceSets, JavaContentGroupBuilder(sourceSets).apply(block).list)
@@ -59,7 +59,7 @@ class JavadocContentGroup(
override fun hasAnyContent(): Boolean = children.isNotEmpty()
}
-class JavaContentGroupBuilder(val sourceSets: Set<SourceSetData>) {
+class JavaContentGroupBuilder(val sourceSets: Set<DokkaSourceSet>) {
val list = mutableListOf<JavadocContentNode>()
}
@@ -69,7 +69,7 @@ class TitleNode(
val parent: String?,
val dri: Set<DRI>,
val kind: Kind,
- sourceSets: Set<SourceSetData>
+ sourceSets: Set<DokkaSourceSet>
) : JavadocContentNode(dri, kind, sourceSets) {
override fun hasAnyContent(): Boolean = !title.isBlank() || !version.isBlank()
}
@@ -86,7 +86,7 @@ fun JavaContentGroupBuilder.title(
data class TextNode(
val text: String,
- override val sourceSets: Set<SourceSetData>
+ override val sourceSets: Set<DokkaSourceSet>
) : JavadocContentNode(emptySet(), ContentKind.Main, sourceSets) {
override fun hasAnyContent(): Boolean = !text.isBlank()
}
@@ -97,7 +97,7 @@ class ListNode(
val children: List<JavadocListEntry>,
val dri: Set<DRI>,
val kind: Kind,
- sourceSets: Set<SourceSetData>
+ sourceSets: Set<DokkaSourceSet>
) : JavadocContentNode(dri, kind, sourceSets) {
override fun hasAnyContent(): Boolean = children.isNotEmpty()
}
@@ -117,7 +117,7 @@ class LinkJavadocListEntry(
val name: String,
val dri: Set<DRI>,
val kind: Kind = ContentKind.Symbol,
- val sourceSets: Set<SourceSetData>
+ val sourceSets: Set<DokkaSourceSet>
) :
JavadocListEntry {
override val stringTag: String
@@ -127,7 +127,7 @@ class LinkJavadocListEntry(
private var builtString: String? = null
- fun build(body: (String, Set<DRI>, Kind, List<SourceSetData>) -> String) {
+ fun build(body: (String, Set<DRI>, Kind, List<DokkaSourceSet>) -> String) {
builtString = body(name, dri, kind, sourceSets.toList())
}
}
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
index becacd26..8cd16dba 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/pages/JavadocPageNodes.kt
@@ -418,7 +418,7 @@ class TreeViewPage(
(this as? WithExpectActual).descriptorForPlatform(platform)
private fun WithExpectActual?.descriptorForPlatform(platform: Platform = Platform.jvm) = this?.let {
- it.sources.entries.find { it.key.platform == platform }?.value?.let { it as? DescriptorDocumentableSource }?.descriptor as? ClassDescriptor
+ it.sources.entries.find { it.key.analysisPlatform == platform }?.value?.let { it as? DescriptorDocumentableSource }?.descriptor as? ClassDescriptor
}
data class InheritanceNode(