aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-06-19 14:08:49 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-06-25 20:23:58 +0200
commit8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f (patch)
treefe4e24d9f352199e551bd34ba330c0d2c0acf7af /plugins/base
parent08f40e2a13006882e8f8425f111b8527e7bbcb0f (diff)
downloaddokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.gz
dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.bz2
dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.zip
Remove SourceSetDataCache, rename PassConfiguration to DokkaSourceSet and use it instead of SourceSetData
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt10
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt28
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt60
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt8
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt2
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt16
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt6
-rw-r--r--plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt12
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt16
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt10
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt36
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt8
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt7
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt9
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt38
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt4
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt4
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt13
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt18
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt19
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt147
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt76
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt9
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt14
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt9
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt32
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt26
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt30
30 files changed, 397 insertions, 280 deletions
diff --git a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
index cdaa0274..e3da9ecc 100644
--- a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
+++ b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt
@@ -1,11 +1,11 @@
package org.jetbrains.dokka.base.allModulePage
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER
import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.P
import org.jetbrains.dokka.pages.*
@@ -30,9 +30,13 @@ class MultimodulePageCreator(
if (commentsConverter == null || signatureProvider == null)
throw IllegalStateException("Both comments converter and signature provider must not be null")
- val sourceSetData = emptySet<SourceSetData>()
+ val sourceSetData = emptySet<DokkaSourceSet>()
val builder = PageContentBuilder(commentsConverter, signatureProvider, context.logger)
- val contentNode = builder.contentFor(dri = DRI(MULTIMODULE_PACKAGE_PLACEHOLDER), kind = ContentKind.Cover, sourceSets = sourceSetData) {
+ val contentNode = builder.contentFor(
+ dri = DRI(MULTIMODULE_PACKAGE_PLACEHOLDER),
+ kind = ContentKind.Cover,
+ sourceSets = sourceSetData
+ ) {
header(2, "All modules:")
table(styles = setOf(MultimoduleTable)) {
modules.mapNotNull { module ->
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
index 141a18e6..f4d547e3 100644
--- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -1,10 +1,12 @@
package org.jetbrains.dokka.base.renderers
-import kotlinx.coroutines.*
-import kotlinx.html.FlowContent
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.runBlocking
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.local.LocationProvider
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
@@ -28,7 +30,7 @@ abstract class DefaultRenderer<T>(
abstract fun T.buildList(
node: ContentList,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
)
abstract fun T.buildNewLine()
@@ -36,7 +38,7 @@ abstract class DefaultRenderer<T>(
abstract fun T.buildTable(
node: ContentTable,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
)
abstract fun T.buildText(textNode: ContentText)
@@ -48,18 +50,18 @@ abstract class DefaultRenderer<T>(
open fun T.buildPlatformDependent(
content: PlatformHintedContent,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?
+ sourceSetRestriction: Set<DokkaSourceSet>?
) = buildContentNode(content.inner, pageContext)
open fun T.buildGroup(
node: ContentGroup,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) =
wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } }
open fun T.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) =
- node.children.forEach { it.build(this, pageContext) }
+ node.children.forEach { it.build(this, pageContext) }
open fun T.wrapGroup(node: ContentGroup, pageContext: ContentPage, childrenCallback: T.() -> Unit) =
childrenCallback()
@@ -67,7 +69,7 @@ abstract class DefaultRenderer<T>(
open fun T.buildLinkText(
nodes: List<ContentNode>,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) {
nodes.forEach { it.build(this, pageContext, sourceSetRestriction) }
}
@@ -79,7 +81,7 @@ abstract class DefaultRenderer<T>(
open fun T.buildHeader(
node: ContentHeader,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) {
buildHeader(node.level, node) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } }
}
@@ -87,16 +89,16 @@ abstract class DefaultRenderer<T>(
open fun ContentNode.build(
builder: T,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) =
builder.buildContentNode(this, pageContext, sourceSetRestriction)
open fun T.buildContentNode(
node: ContentNode,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) {
- if (sourceSetRestriction == null || node.sourceSets.any { it in sourceSetRestriction } ) {
+ if (sourceSetRestriction == null || node.sourceSets.any { it in sourceSetRestriction }) {
when (node) {
is ContentText -> buildText(node)
is ContentHeader -> buildHeader(node, pageContext, sourceSetRestriction)
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 43722888..ee6f1e1f 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -1,13 +1,15 @@
package org.jetbrains.dokka.base.renderers.html
-import kotlinx.coroutines.*
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.runBlocking
import kotlinx.html.*
import kotlinx.html.stream.createHTML
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.DefaultRenderer
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -20,11 +22,10 @@ open class HtmlRenderer(
context: DokkaContext
) : DefaultRenderer<FlowContent>(context) {
- private val sourceSetDependencyMap = with(context.sourceSetCache) {
- allSourceSets.map { sourceSet ->
- sourceSet to allSourceSets.filter { sourceSet.dependentSourceSets.contains(it.sourceSetID) }
- }.toMap()
- }
+ private val sourceSetDependencyMap = context.configuration.sourceSets.map { sourceSet ->
+ sourceSet to context.configuration.sourceSets.filter { sourceSet.dependentSourceSets.contains(it.sourceSetID) }
+ }.toMap()
+
private val pageList = mutableMapOf<String, Pair<String, String>>()
@@ -94,7 +95,7 @@ open class HtmlRenderer(
button(classes = "platform-tag platform-selector") {
attributes["data-active"] = ""
attributes["data-filter"] = it.sourceSetID
- when (it.platform.key) {
+ when (it.analysisPlatform.key) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
"jvm" -> classes = classes + "jvm-like"
@@ -138,7 +139,7 @@ open class HtmlRenderer(
override fun FlowContent.buildPlatformDependent(
content: PlatformHintedContent,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?
+ sourceSetRestriction: Set<DokkaSourceSet>?
) =
buildPlatformDependent(
content.sourceSets.filter {
@@ -150,7 +151,7 @@ open class HtmlRenderer(
)
private fun FlowContent.buildPlatformDependent(
- nodes: Map<SourceSetData, Collection<ContentNode>>,
+ nodes: Map<DokkaSourceSet, Collection<ContentNode>>,
pageContext: ContentPage,
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
styles: Set<Style> = emptySet()
@@ -172,7 +173,7 @@ open class HtmlRenderer(
if (index == 0) attributes["data-active"] = ""
attributes["data-toggle"] = pair.first.sourceSetID
when (
- pair.first.platform.key
+ pair.first.analysisPlatform.key
) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
@@ -192,9 +193,9 @@ open class HtmlRenderer(
}
private fun contentsForSourceSetDependent(
- nodes: Map<SourceSetData, Collection<ContentNode>>,
+ nodes: Map<DokkaSourceSet, Collection<ContentNode>>,
pageContext: ContentPage,
- ): List<Pair<SourceSetData, String>> {
+ ): List<Pair<DokkaSourceSet, String>> {
var counter = 0
return nodes.toList().map { (sourceSet, elements) ->
sourceSet to createHTML(prettyPrint = false).div {
@@ -203,8 +204,8 @@ open class HtmlRenderer(
}
}.stripDiv()
}.groupBy(
- Pair<SourceSetData, String>::second,
- Pair<SourceSetData, String>::first
+ Pair<DokkaSourceSet, String>::second,
+ Pair<DokkaSourceSet, String>::first
).entries.flatMap { (html, sourceSets) ->
sourceSets.filterNot {
sourceSetDependencyMap[it].orEmpty().any { dependency -> sourceSets.contains(dependency) }
@@ -238,8 +239,8 @@ open class HtmlRenderer(
)
}
}.groupBy(
- Pair<Pair<ContentDivergentInstance, SourceSetData>, Pair<String, String>>::second,
- Pair<Pair<ContentDivergentInstance, SourceSetData>, Pair<String, String>>::first
+ Pair<Pair<ContentDivergentInstance, DokkaSourceSet>, Pair<String, String>>::second,
+ Pair<Pair<ContentDivergentInstance, DokkaSourceSet>, Pair<String, String>>::first
)
distinct.forEach {
@@ -293,14 +294,14 @@ open class HtmlRenderer(
override fun FlowContent.buildList(
node: ContentList,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?
+ sourceSetRestriction: Set<DokkaSourceSet>?
) = if (node.ordered) ol { buildListItems(node.children, pageContext, sourceSetRestriction) }
else ul { buildListItems(node.children, pageContext, sourceSetRestriction) }
open fun OL.buildListItems(
items: List<ContentNode>,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) {
items.forEach {
if (it is ContentList)
@@ -313,7 +314,7 @@ open class HtmlRenderer(
open fun UL.buildListItems(
items: List<ContentNode>,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>? = null
+ sourceSetRestriction: Set<DokkaSourceSet>? = null
) {
items.forEach {
if (it is ContentList)
@@ -340,7 +341,7 @@ open class HtmlRenderer(
private fun FlowContent.buildRow(
node: ContentGroup,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?,
+ sourceSetRestriction: Set<DokkaSourceSet>?,
style: Set<Style>
) {
node.children
@@ -393,11 +394,11 @@ open class HtmlRenderer(
}
}
- private fun FlowContent.createPlatformTagBubbles(sourceSets: List<SourceSetData>) {
+ private fun FlowContent.createPlatformTagBubbles(sourceSets: List<DokkaSourceSet>) {
div("platform-tags") {
sourceSets.forEach {
div("platform-tag") {
- when (it.platform.key) {
+ when (it.analysisPlatform.key) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
"jvm" -> classes = classes + "jvm-like"
@@ -409,7 +410,7 @@ open class HtmlRenderer(
}
}
- private fun FlowContent.createPlatformTags(node: ContentNode, sourceSetRestriction: Set<SourceSetData>? = null) {
+ private fun FlowContent.createPlatformTags(node: ContentNode, sourceSetRestriction: Set<DokkaSourceSet>? = null) {
node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let {
createPlatformTagBubbles(node.sourceSets.filter {
sourceSetRestriction == null || it in sourceSetRestriction
@@ -420,7 +421,7 @@ open class HtmlRenderer(
override fun FlowContent.buildTable(
node: ContentTable,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?
+ sourceSetRestriction: Set<DokkaSourceSet>?
) {
when (node.dci.kind) {
ContentKind.Comment -> buildDefaultTable(node, pageContext, sourceSetRestriction)
@@ -437,7 +438,7 @@ open class HtmlRenderer(
fun FlowContent.buildDefaultTable(
node: ContentTable,
pageContext: ContentPage,
- sourceSetRestriction: Set<SourceSetData>?
+ sourceSetRestriction: Set<DokkaSourceSet>?
) {
table {
thead {
@@ -522,7 +523,7 @@ open class HtmlRenderer(
fun FlowContent.buildLink(
to: DRI,
- platforms: List<SourceSetData>,
+ platforms: List<DokkaSourceSet>,
from: PageNode? = null,
block: FlowContent.() -> Unit
) = buildLink(locationProvider.resolve(to, platforms, from), block)
@@ -562,7 +563,7 @@ open class HtmlRenderer(
private fun getSymbolSignature(page: ContentPage) = page.content.dfs { it.dci.kind == ContentKind.Symbol }
private fun flattenToText(node: ContentNode): String {
- fun getContentTextNodes(node: ContentNode, sourceSetRestriction: SourceSetData): List<ContentText> =
+ fun getContentTextNodes(node: ContentNode, sourceSetRestriction: DokkaSourceSet): List<ContentText> =
when (node) {
is ContentText -> listOf(node)
is ContentComposite -> node.children
@@ -573,7 +574,8 @@ open class HtmlRenderer(
else -> emptyList()
}
- val sourceSetRestriction = node.sourceSets.find { it.platform == Platform.common } ?: node.sourceSets.first()
+ val sourceSetRestriction =
+ node.sourceSets.find { it.analysisPlatform == Platform.common } ?: node.sourceSets.first()
return getContentTextNodes(node, sourceSetRestriction).joinToString("") { it.text }
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
index 4048c11e..eb563dbd 100644
--- a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt
@@ -3,7 +3,7 @@ package org.jetbrains.dokka.base.renderers.html
import kotlinx.html.*
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RendererSpecificPage
import org.jetbrains.dokka.pages.RenderingStrategy
@@ -25,7 +25,7 @@ class NavigationPage(val root: NavigationNode) : RendererSpecificPage {
id = navId
attributes["pageId"] = node.dri.toString()
div("overview") {
- buildLink(node.dri, node.platforms) { +node.name }
+ buildLink(node.dri, node.sourceSets) { +node.name }
if (node.children.isNotEmpty()) {
span("navButton") {
onClick = """document.getElementById("$navId").classList.toggle("hidden");"""
@@ -41,11 +41,11 @@ class NavigationPage(val root: NavigationNode) : RendererSpecificPage {
class NavigationNode(
val name: String,
val dri: DRI,
- val platforms: List<SourceSetData>,
+ val sourceSets: List<DokkaSourceSet>,
val children: List<NavigationNode>
)
fun NavigationPage.transform(block: (NavigationNode) -> NavigationNode) = NavigationPage(root.transform(block))
fun NavigationNode.transform(block: (NavigationNode) -> NavigationNode) =
- run(block).let { NavigationNode(it.name, it.dri, it.platforms, it.children.map(block)) }
+ run(block).let { NavigationNode(it.name, it.dri, it.sourceSets, it.children.map(block)) }
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index cdb30555..af0525d7 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -86,7 +86,7 @@ object StyleAndScriptsAppender : PageTransformer {
class SourcesetDependencyAppender(val context: DokkaContext) : PageTransformer{
override fun invoke(input: RootPageNode): RootPageNode {
- val dependenciesMap = context.configuration.passesConfigurations.map {
+ val dependenciesMap = context.configuration.sourceSets.map {
it.sourceSetID to it.dependentSourceSets
}.toMap()
fun createDependenciesJson() : String = "sourceset_dependencies = '{${
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
index a9e58f17..eada2e3b 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
@@ -1,16 +1,14 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
-import org.jetbrains.dokka.model.sourceSet
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.lang.IllegalStateException
import java.net.HttpURLConnection
import java.net.URL
import java.net.URLConnection
@@ -48,14 +46,12 @@ open class DefaultLocationProvider(
override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String =
pathTo(node, context) + if (!skipExtension) extension else ""
- override fun resolve(dri: DRI, sourceSets: List<SourceSetData>, context: PageNode?): String =
+ override fun resolve(dri: DRI, sourceSets: List<DokkaSourceSet>, context: PageNode?): String =
pagesIndex[dri]?.let { resolve(it, context) } ?:
// Not found in PageGraph, that means it's an external link
- getLocation(dri,
- this.dokkaContext.configuration.passesConfigurations
- .filter { passConfig ->
- sourceSets.toSet().contains(dokkaContext.sourceSet(passConfig))
- }
+ getLocation(
+ dri,
+ sourceSets
.groupBy({ it.jdkVersion }, { it.externalDocumentationLinks })
.map { it.key to it.value.flatten().distinct() }.toMap()
)
@@ -105,7 +101,7 @@ open class DefaultLocationProvider(
// Not in cache, resolve packageLists
for ((jdk, links) in toResolve) {
for (link in links) {
- if(dokkaContext.configuration.offlineMode && link.packageListUrl.protocol.toLowerCase() != "file")
+ if (dokkaContext.configuration.offlineMode && link.packageListUrl.protocol.toLowerCase() != "file")
continue
val locationInfo =
loadPackageList(jdk, link.packageListUrl)
diff --git a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
index c6c48d63..d6d616f3 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt
@@ -1,12 +1,12 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
interface LocationProvider {
- fun resolve(dri: DRI, sourceSets: List<SourceSetData>, context: PageNode? = null): String
+ fun resolve(dri: DRI, sourceSets: List<DokkaSourceSet>, context: PageNode? = null): String
fun resolve(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String
fun resolveRoot(node: PageNode): String
fun ancestors(node: PageNode): List<PageNode>
diff --git a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
index 21692bf9..39b005a1 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.base.resolvers.local
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
@@ -14,10 +14,10 @@ class MultimoduleLocationProvider(private val root: RootPageNode, context: Dokka
it.name to it.path
}.toMap()
- override fun resolve(dri: DRI, platforms: List<SourceSetData>, context: PageNode?): String =
+ override fun resolve(dri: DRI, sourceSets: List<DokkaSourceSet>, context: PageNode?): String =
dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let {
"$it/${dri.classNames}/index.html"
- } ?: defaultLocationProvider.resolve(dri, platforms, context)
+ } ?: defaultLocationProvider.resolve(dri, sourceSets, context)
override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String =
defaultLocationProvider.resolve(node, context, skipExtension)
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
index 8dbe7b12..f042eae3 100644
--- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
+++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
@@ -1,10 +1,12 @@
package org.jetbrains.dokka.base.signatures
+import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
interface JvmSignatureUtils {
@@ -73,7 +75,7 @@ interface JvmSignatureUtils {
is All -> All
is Never, is OnlyOnce -> Never
}.let { strategy ->
- valueToSignature(it.value, strategy, listBrackets, classExtension)
+ valueToSignature(it.value, strategy, listBrackets, classExtension)
}
if (i != a.params.entries.size - 1) text(", ")
}
@@ -130,11 +132,11 @@ interface JvmSignatureUtils {
}
}
- fun <T : Documentable> WithExtraProperties<T>.stylesIfDeprecated(sourceSetData: SourceSetData): Set<TextStyle> =
+ fun <T : Documentable> WithExtraProperties<T>.stylesIfDeprecated(sourceSetData: DokkaSourceSet): Set<TextStyle> =
if (extra[Annotations]?.content?.get(sourceSetData)?.any {
- it.dri == DRI("kotlin", "Deprecated")
- || it.dri == DRI("java.lang", "Deprecated")
- } == true) setOf(TextStyle.Strikethrough) else emptySet()
+ it.dri == DRI("kotlin", "Deprecated")
+ || it.dri == DRI("java.lang", "Deprecated")
+ } == true) setOf(TextStyle.Strikethrough) else emptySet()
}
sealed class AtStrategy
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 3e92b902..28c26dea 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.base.signatures
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
@@ -24,7 +25,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
ExtraModifiers.KotlinOnlyModifiers.TailRec,
ExtraModifiers.KotlinOnlyModifiers.External
)
- private val platformSpecificModifiers : Map<ExtraModifiers, Set<Platform>> = mapOf(
+ private val platformSpecificModifiers: Map<ExtraModifiers, Set<Platform>> = mapOf(
ExtraModifiers.KotlinOnlyModifiers.External to setOf(Platform.js)
)
@@ -40,13 +41,14 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
)
}
- private fun <T> PageContentBuilder.DocumentableContentBuilder.processExtraModifiers (t: T)
- where T: Documentable, T: WithExtraProperties<T> {
+ private fun <T> PageContentBuilder.DocumentableContentBuilder.processExtraModifiers(t: T)
+ where T : Documentable, T : WithExtraProperties<T> {
sourceSetDependentText(
t.modifiers()
.mapValues { entry ->
entry.value.filter {
- it !in ignoredExtraModifiers || entry.key.platform in (platformSpecificModifiers[it] ?: emptySet())
+ it !in ignoredExtraModifiers || entry.key.analysisPlatform in (platformSpecificModifiers[it]
+ ?: emptySet())
}
}
) {
@@ -73,7 +75,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun actualTypealiasedSignature(c: DClasslike, sourceSet: SourceSetData, aliasedType: Bound) =
+ private fun actualTypealiasedSignature(c: DClasslike, sourceSet: DokkaSourceSet, aliasedType: Bound) =
contentBuilder.contentFor(
c,
ContentKind.Symbol,
@@ -97,7 +99,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
- private fun regularSignature(c: DClasslike, sourceSet: SourceSetData) =
+ private fun regularSignature(c: DClasslike, sourceSet: DokkaSourceSet) =
contentBuilder.contentFor(
c,
ContentKind.Symbol,
@@ -315,7 +317,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
is UnresolvedBound -> text(p.name)
}
- private fun funType(dri: DRI, sourceSets: Set<SourceSetData>, type: TypeConstructor) =
+ private fun funType(dri: DRI, sourceSets: Set<DokkaSourceSet>, type: TypeConstructor) =
contentBuilder.contentFor(dri, sourceSets, ContentKind.Main) {
if (type.extension) {
signatureForProjection(type.projections.first())
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
index 27557107..109aa640 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DeprecatedDocumentableFilterTransformer.kt
@@ -8,18 +8,16 @@ import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransf
class DeprecatedDocumentableFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer {
override fun invoke(modules: List<DModule>) = modules.map { original ->
- val passOptions = context.configuration.passesConfigurations.first {
- original.sourceSets.contains(context.sourceSet(it))
- }
+ val sourceSet = original.sourceSets.single()
val packageOptions =
- passOptions.perPackageOptions
+ sourceSet.perPackageOptions
original.let {
- DeprecatedDocumentableFilter(passOptions, packageOptions).processModule(it)
+ DeprecatedDocumentableFilter(sourceSet, packageOptions).processModule(it)
}
}
private class DeprecatedDocumentableFilter(
- val globalOptions: DokkaConfiguration.PassConfiguration,
+ val globalOptions: DokkaConfiguration.DokkaSourceSet,
val packageOptions: List<DokkaConfiguration.PackageOptions>
) {
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
index 0a01680f..c3cc4d38 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
@@ -4,15 +4,13 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer {
override fun invoke(modules: List<DModule>) = modules.map { original ->
- val passOptions = context.configuration.passesConfigurations.first {
- original.sourceSets.contains(context.sourceSet(it))
- }
- val packageOptions =
- passOptions.perPackageOptions
+ val passOptions = original.sourceSets.single()
+ val packageOptions = passOptions.perPackageOptions
original.let {
DocumentableVisibilityFilter(packageOptions, passOptions).processModule(it)
}
@@ -20,7 +18,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
private class DocumentableVisibilityFilter(
val packageOptions: List<DokkaConfiguration.PackageOptions>,
- val globalOptions: DokkaConfiguration.PassConfiguration
+ val globalOptions: DokkaSourceSet
) {
fun Visibility.isAllowedInPackage(packageName: String?) = when (this) {
is JavaVisibility.Public,
@@ -82,14 +80,14 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
return Pair(packagesListChanged, filteredPackages)
}
- private fun <T : WithVisibility> alwaysTrue(a: T, p: SourceSetData) = true
- private fun <T : WithVisibility> alwaysFalse(a: T, p: SourceSetData) = false
+ private fun <T : WithVisibility> alwaysTrue(a: T, p: DokkaSourceSet) = true
+ private fun <T : WithVisibility> alwaysFalse(a: T, p: DokkaSourceSet) = false
- private fun WithVisibility.visibilityForPlatform(data: SourceSetData): Visibility? = visibility[data]
+ private fun WithVisibility.visibilityForPlatform(data: DokkaSourceSet): Visibility? = visibility[data]
private fun <T> T.filterPlatforms(
- additionalCondition: (T, SourceSetData) -> Boolean = ::alwaysTrue,
- alternativeCondition: (T, SourceSetData) -> Boolean = ::alwaysFalse
+ additionalCondition: (T, DokkaSourceSet) -> Boolean = ::alwaysTrue,
+ alternativeCondition: (T, DokkaSourceSet) -> Boolean = ::alwaysFalse
) where T : Documentable, T : WithVisibility =
sourceSets.filter { d ->
visibilityForPlatform(d)?.isAllowedInPackage(dri.packageName) == true &&
@@ -98,9 +96,9 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
}.toSet()
private fun <T> List<T>.transform(
- additionalCondition: (T, SourceSetData) -> Boolean = ::alwaysTrue,
- alternativeCondition: (T, SourceSetData) -> Boolean = ::alwaysFalse,
- recreate: (T, Set<SourceSetData>) -> T
+ additionalCondition: (T, DokkaSourceSet) -> Boolean = ::alwaysTrue,
+ alternativeCondition: (T, DokkaSourceSet) -> Boolean = ::alwaysFalse,
+ recreate: (T, Set<DokkaSourceSet>) -> T
): Pair<Boolean, List<T>> where T : Documentable, T : WithVisibility {
var changed = false
val values = mapNotNull { t ->
@@ -122,7 +120,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
private fun filterFunctions(
functions: List<DFunction>,
- additionalCondition: (DFunction, SourceSetData) -> Boolean = ::alwaysTrue
+ additionalCondition: (DFunction, DokkaSourceSet) -> Boolean = ::alwaysTrue
) =
functions.transform(additionalCondition) { original, filteredPlatforms ->
with(original) {
@@ -145,13 +143,13 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
}
}
- private fun hasVisibleAccessorsForPlatform(property: DProperty, data: SourceSetData) =
+ private fun hasVisibleAccessorsForPlatform(property: DProperty, data: DokkaSourceSet) =
property.getter?.visibilityForPlatform(data)?.isAllowedInPackage(property.dri.packageName) == true ||
property.setter?.visibilityForPlatform(data)?.isAllowedInPackage(property.dri.packageName) == true
private fun filterProperties(
properties: List<DProperty>,
- additionalCondition: (DProperty, SourceSetData) -> Boolean = ::alwaysTrue
+ additionalCondition: (DProperty, DokkaSourceSet) -> Boolean = ::alwaysTrue
): Pair<Boolean, List<DProperty>> =
properties.transform(additionalCondition, ::hasVisibleAccessorsForPlatform) { original, filteredPlatforms ->
with(original) {
@@ -174,7 +172,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
}
}
- private fun filterEnumEntries(entries: List<DEnumEntry>, filteredPlatforms: Set<SourceSetData>) =
+ private fun filterEnumEntries(entries: List<DEnumEntry>, filteredPlatforms: Set<DokkaSourceSet>) =
entries.mapNotNull { entry ->
if (filteredPlatforms.containsAll(entry.sourceSets)) entry
else {
@@ -196,7 +194,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
private fun filterClasslikes(
classlikeList: List<DClasslike>,
- additionalCondition: (DClasslike, SourceSetData) -> Boolean = ::alwaysTrue
+ additionalCondition: (DClasslike, DokkaSourceSet) -> Boolean = ::alwaysTrue
): Pair<Boolean, List<DClasslike>> {
var classlikesListChanged = false
val filteredClasslikes: List<DClasslike> = classlikeList.mapNotNull {
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
index 6b29531c..3fd0081a 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
@@ -3,22 +3,18 @@ package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.DPackage
-import org.jetbrains.dokka.model.sourceSet
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer
class EmptyPackagesFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer {
override fun invoke(modules: List<DModule>): List<DModule> = modules.map { original ->
- val passOptions = context.configuration.passesConfigurations.first {
- original.sourceSets.contains(context.sourceSet(it))
- }
original.let {
- EmptyPackagesFilter(passOptions).processModule(it)
+ EmptyPackagesFilter(original.sourceSets.single()).processModule(it)
}
}
private class EmptyPackagesFilter(
- val passOptions: DokkaConfiguration.PassConfiguration
+ val passOptions: DokkaConfiguration.DokkaSourceSet
) {
fun DPackage.shouldBeSkipped() = passOptions.skipEmptyPackages &&
functions.isEmpty() &&
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt
index 15ffc08a..f1bccd66 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/InheritorsExtractorTransformer.kt
@@ -5,13 +5,14 @@ import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.properties.ExtraProperty
import org.jetbrains.dokka.model.properties.MergeStrategy
import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
class InheritorsExtractorTransformer : DocumentableTransformer {
override fun invoke(original: DModule, context: DokkaContext): DModule =
original.generateInheritanceMap().let { inheritanceMap -> original.appendInheritors(inheritanceMap) as DModule }
- private fun <T : Documentable> T.appendInheritors(inheritanceMap: Map<SourceSetData, Map<DRI, List<DRI>>>): Documentable =
+ private fun <T : Documentable> T.appendInheritors(inheritanceMap: Map<DokkaSourceSet, Map<DRI, List<DRI>>>): Documentable =
InheritorsInfo(inheritanceMap.getForDRI(dri)).let { info ->
when (this) {
is DModule -> copy(packages = packages.map { it.appendInheritors(inheritanceMap) as DPackage })
@@ -45,7 +46,7 @@ class InheritorsExtractorTransformer : DocumentableTransformer {
private fun InheritorsInfo.isNotEmpty() = this.value.values.fold(0) { acc, list -> acc + list.size } > 0
- private fun Map<SourceSetData, Map<DRI, List<DRI>>>.getForDRI(dri: DRI) =
+ private fun Map<DokkaSourceSet, Map<DRI, List<DRI>>>.getForDRI(dri: DRI) =
map { (v, k) ->
v to k[dri]
}.map { (k, v) -> k to v.orEmpty() }.toMap()
@@ -57,7 +58,7 @@ class InheritorsExtractorTransformer : DocumentableTransformer {
.groupBy({ it.first }) { it.second }.map { (k2, v2) -> k2 to v2.flatten() }.toMap()
}.filter { it.second.values.isNotEmpty() }.toMap()
- private fun <T : Documentable> T.getInheritanceEntriesRec(): List<Pair<SourceSetData, List<Pair<DRI, DRI>>>> =
+ private fun <T : Documentable> T.getInheritanceEntriesRec(): List<Pair<DokkaSourceSet, List<Pair<DRI, DRI>>>> =
this.toInheritanceEntries() + children.flatMap { it.getInheritanceEntriesRec() }
private fun <T : Documentable> T.toInheritanceEntries() =
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index 63232793..1f718a7c 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -3,9 +3,8 @@ package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.analysis.EnvironmentAndFacade
import org.jetbrains.dokka.analysis.KotlinAnalysis
import org.jetbrains.dokka.model.DModule
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.model.doc.DocumentationNode
-import org.jetbrains.dokka.model.sourceSet
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.parsers.MarkdownParser
import org.jetbrains.dokka.model.SourceSetDependent
import org.jetbrains.dokka.plugability.DokkaContext
@@ -23,9 +22,9 @@ internal class ModuleAndPackageDocumentationTransformer(
override fun invoke(modules: List<DModule>): List<DModule> {
val modulesAndPackagesDocumentation =
- context.configuration.passesConfigurations
+ context.configuration.sourceSets
.map {
- Pair(it.moduleName, context.sourceSet(it)) to
+ Pair(it.moduleName, it) to
it.includes.map { Paths.get(it) }
.also {
it.forEach {
@@ -101,7 +100,7 @@ internal class ModuleAndPackageDocumentationTransformer(
}
}
- private fun mergeDocumentation(origin: Map<SourceSetData, DocumentationNode>, new: Map<SourceSetData, DocumentationNode>) =
+ private fun mergeDocumentation(origin: Map<DokkaSourceSet, DocumentationNode>, new: Map<DokkaSourceSet, DocumentationNode>) =
(origin.asSequence() + new.asSequence())
.distinct()
.groupBy({ it.key }, { it.value })
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index 0b47345d..2ebd4c62 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.DokkaConfiguration.PassConfiguration
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -26,12 +26,11 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
}
private fun shouldBeReportedIfNotDocumented(
- documentable: Documentable, sourceSet: SourceSetData, context: DokkaContext
+ documentable: Documentable, sourceSet: DokkaSourceSet, context: DokkaContext
): Boolean {
- val passConfiguration = passConfiguration(context, sourceSet)
- val packageOptionsOrNull = packageOptionsOrNull(passConfiguration, documentable)
+ val packageOptionsOrNull = packageOptionsOrNull(sourceSet, documentable)
- if (!(packageOptionsOrNull?.reportUndocumented ?: passConfiguration.reportUndocumented)) {
+ if (!(packageOptionsOrNull?.reportUndocumented ?: sourceSet.reportUndocumented)) {
return false
}
@@ -61,7 +60,7 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
private fun reportIfUndocumented(
context: DokkaContext,
documentable: Documentable,
- sourceSet: SourceSetData
+ sourceSet: DokkaSourceSet
) {
if (isUndocumented(documentable, sourceSet)) {
val documentableDescription = with(documentable) {
@@ -94,14 +93,14 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
}
}
- private fun isUndocumented(documentable: Documentable, sourceSet: SourceSetData): Boolean {
- fun resolveDependentSourceSets(sourceSet: SourceSetData): List<SourceSetData> {
+ private fun isUndocumented(documentable: Documentable, sourceSet: DokkaSourceSet): Boolean {
+ fun resolveDependentSourceSets(sourceSet: DokkaSourceSet): List<DokkaSourceSet> {
return sourceSet.dependentSourceSets.mapNotNull { sourceSetID ->
documentable.sourceSets.singleOrNull { it.sourceSetID == sourceSetID }
}
}
- fun withAllDependentSourceSets(sourceSet: SourceSetData): Sequence<SourceSetData> {
+ fun withAllDependentSourceSets(sourceSet: DokkaSourceSet): Sequence<DokkaSourceSet> {
return sequence {
yield(sourceSet)
for (dependentSourceSet in resolveDependentSourceSets(sourceSet)) {
@@ -120,25 +119,16 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
return documentable.isConstructor
}
- private fun passConfiguration(context: DokkaContext, sourceSet: SourceSetData): PassConfiguration {
- val passes = context.configuration.passesConfigurations.filter { configuration ->
- configuration.sourceSetID == sourceSet.sourceSetID
- }
- if (passes.size > 1)
- context.logger.error("Expected one passConfiguration with ID: ${sourceSet.sourceSetID} found: ${passes.size} in [${passes.joinToString { it.moduleName }}]")
- return passes.first()
- }
-
- private fun isFakeOverride(documentable: Documentable, sourceSet: SourceSetData): Boolean {
+ private fun isFakeOverride(documentable: Documentable, sourceSet: DokkaSourceSet): Boolean {
return callableMemberDescriptorOrNull(documentable, sourceSet)?.kind == FAKE_OVERRIDE
}
- private fun isSynthesized(documentable: Documentable, sourceSet: SourceSetData): Boolean {
+ private fun isSynthesized(documentable: Documentable, sourceSet: DokkaSourceSet): Boolean {
return callableMemberDescriptorOrNull(documentable, sourceSet)?.kind == SYNTHESIZED
}
private fun callableMemberDescriptorOrNull(
- documentable: Documentable, sourceSet: SourceSetData
+ documentable: Documentable, sourceSet: DokkaSourceSet
): CallableMemberDescriptor? {
if (documentable is WithExpectActual) {
return documentable.sources[sourceSet]
@@ -149,7 +139,7 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
return null
}
- private fun isPrivateOrInternalApi(documentable: Documentable, sourceSet: SourceSetData): Boolean {
+ private fun isPrivateOrInternalApi(documentable: Documentable, sourceSet: DokkaSourceSet): Boolean {
return when (documentable.safeAs<WithVisibility>()?.visibility?.get(sourceSet)) {
KotlinVisibility.Public -> false
KotlinVisibility.Private -> true
@@ -164,11 +154,11 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
}
private fun packageOptionsOrNull(
- passConfiguration: PassConfiguration,
+ dokkaSourceSet: DokkaSourceSet,
documentable: Documentable
): DokkaConfiguration.PackageOptions? {
val packageName = documentable.dri.packageName ?: return null
- return passConfiguration.perPackageOptions
+ return dokkaSourceSet.perPackageOptions
.filter { packageOptions -> packageName.startsWith(packageOptions.prefix) }
.maxBy { packageOptions -> packageOptions.prefix.length }
}
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
index cb74441e..fa9ce37e 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/CommentsToContentConverter.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.base.transformers.pages.comments
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.doc.DocTag
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
@@ -9,7 +9,7 @@ interface CommentsToContentConverter {
fun buildContent(
docTag: DocTag,
dci: DCI,
- platforms: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
styles: Set<Style> = emptySet(),
extras: PropertyContainer<ContentNode> = PropertyContainer.empty()
): List<ContentNode>
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index be1217db..14f3a996 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.base.transformers.pages.comments
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
@@ -9,7 +9,7 @@ object DocTagToContentConverter : CommentsToContentConverter {
override fun buildContent(
docTag: DocTag,
dci: DCI,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
styles: Set<Style>,
extra: PropertyContainer<ContentNode>
): List<ContentNode> {
diff --git a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
index 0d133a65..a40f2f53 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
@@ -8,10 +8,9 @@ import org.jetbrains.dokka.analysis.DokkaResolutionFacade
import org.jetbrains.dokka.analysis.EnvironmentAndFacade
import org.jetbrains.dokka.base.renderers.platforms
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.doc.Sample
import org.jetbrains.dokka.model.properties.PropertyContainer
-import org.jetbrains.dokka.model.sourceSet
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.pages.PageTransformer
@@ -40,8 +39,8 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
}
}
- private fun setUpAnalysis(context: DokkaContext) = context.configuration.passesConfigurations.map {
- context.sourceSet(it) to AnalysisEnvironment(DokkaMessageCollector(context.logger), it.analysisPlatform).run {
+ private fun setUpAnalysis(context: DokkaContext) = context.configuration.sourceSets.map {
+ it to AnalysisEnvironment(DokkaMessageCollector(context.logger), it.analysisPlatform).run {
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
}
@@ -59,9 +58,9 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
private fun ContentNode.addSample(
contentPage: ContentPage,
- platform: SourceSetData,
+ platform: DokkaSourceSet,
fqName: String,
- analysis: Map<SourceSetData, EnvironmentAndFacade>
+ analysis: Map<DokkaSourceSet, EnvironmentAndFacade>
): ContentNode {
val facade = analysis[platform]?.facade
?: return this.also { context.logger.warn("Cannot resolve facade for platform ${platform.moduleName}") }
@@ -110,7 +109,7 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
return DescriptorToSourceUtils.descriptorToDeclaration(symbol)
}
- private fun contentCode(sourceSets: List<SourceSetData>, dri: Set<DRI>, content: String, language: String) =
+ private fun contentCode(sourceSets: List<DokkaSourceSet>, dri: Set<DRI>, content: String, language: String) =
ContentCode(
children = listOf(
ContentText(
diff --git a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
index 7603c80b..42422934 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt
@@ -3,11 +3,11 @@ package org.jetbrains.dokka.base.transformers.pages.sourcelinks
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiDocumentManager
import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
-import org.jetbrains.dokka.analysis.PsiDocumentableSource
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.model.DocumentableSource
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
+import org.jetbrains.dokka.analysis.PsiDocumentableSource
import org.jetbrains.dokka.model.WithExpectActual
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -29,8 +29,8 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent
}
}
- private fun getSourceLinks() = context.configuration.passesConfigurations
- .flatMap { it.sourceLinks.map { sl -> SourceLink(sl, context.sourceSetCache.getSourceSet(it)) } }
+ private fun getSourceLinks() = context.configuration.sourceSets
+ .flatMap { it.sourceLinks.map { sl -> SourceLink(sl, it) } }
private fun resolveSources(documentable: WithExpectActual) = documentable.sources
.mapNotNull { entry ->
@@ -42,7 +42,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent
}
}
- private fun ContentPage.addSourcesContent(sources: List<Pair<SourceSetData, String>>) = builder
+ private fun ContentPage.addSourcesContent(sources: List<Pair<DokkaSourceSet, String>>) = builder
.buildSourcesContent(this, sources)
.let {
this.modified(
@@ -52,7 +52,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent
private fun PageContentBuilder.buildSourcesContent(
node: ContentPage,
- sources: List<Pair<SourceSetData, String>>
+ sources: List<Pair<DokkaSourceSet, String>>
) = contentFor(
node.dri.first(),
node.documentable!!.sourceSets.toSet()
@@ -121,8 +121,8 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent
}
}
-data class SourceLink(val path: String, val url: String, val lineSuffix: String?, val sourceSetData: SourceSetData) {
- constructor(sourceLinkDefinition: DokkaConfiguration.SourceLinkDefinition, sourceSetData: SourceSetData) : this(
+data class SourceLink(val path: String, val url: String, val lineSuffix: String?, val sourceSetData: DokkaSourceSet) {
+ constructor(sourceLinkDefinition: DokkaConfiguration.SourceLinkDefinition, sourceSetData: DokkaSourceSet) : this(
sourceLinkDefinition.path, sourceLinkDefinition.url, sourceLinkDefinition.lineSuffix, sourceSetData
)
}
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index cefea4ec..9cdd251c 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.base.translators.descriptors
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.analysis.*
import org.jetbrains.dokka.links.*
import org.jetbrains.dokka.links.Callable
@@ -50,13 +51,12 @@ import org.jetbrains.kotlin.resolve.constants.AnnotationValue as ConstantsAnnota
import org.jetbrains.kotlin.resolve.constants.ArrayValue as ConstantsArrayValue
import org.jetbrains.kotlin.resolve.constants.EnumValue as ConstantsEnumValue
import org.jetbrains.kotlin.resolve.constants.KClassValue as ConstantsKtClassValue
-import kotlin.IllegalArgumentException
class DefaultDescriptorToDocumentableTranslator(
private val kotlinAnalysis: KotlinAnalysis
) : SourceToDocumentableTranslator {
- override fun invoke(sourceSet: SourceSetData, context: DokkaContext): DModule {
+ override fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule {
val (environment, facade) = kotlinAnalysis[sourceSet]
val packageFragments = environment.getSourceFiles().asSequence()
.map { it.packageFqName }
@@ -83,7 +83,7 @@ data class DRIWithPlatformInfo(
fun DRI.withEmptyInfo() = DRIWithPlatformInfo(this, emptyMap())
private class DokkaDescriptorVisitor(
- private val sourceSet: SourceSetData,
+ private val sourceSet: DokkaSourceSet,
private val resolutionFacade: DokkaResolutionFacade,
private val logger: DokkaLogger
) : DeclarationDescriptorVisitorEmptyBodies<Documentable, DRIWithPlatformInfo>() {
@@ -729,11 +729,11 @@ private class DokkaDescriptorVisitor(
private fun KtInitializerList.initializersAsText() =
initializers.firstIsInstanceOrNull<KtCallElement>()
- ?.getValueArgumentsInParentheses()
- ?.flatMap { it.childrenAsText() }
- .orEmpty()
+ ?.getValueArgumentsInParentheses()
+ ?.flatMap { it.childrenAsText() }
+ .orEmpty()
- private fun ValueArgument.childrenAsText() = this.safeAs<KtValueArgument>()?.children?.map {it.text }.orEmpty()
+ private fun ValueArgument.childrenAsText() = this.safeAs<KtValueArgument>()?.children?.map { it.text }.orEmpty()
private data class ClassInfo(val superclasses: List<DRI>, val interfaces: List<DRI>, val docs: SourceSetDependent<DocumentationNode>){
val supertypes: List<DRI>
@@ -751,11 +751,12 @@ private class DokkaDescriptorVisitor(
private fun ConstantsEnumValue.fullEnumEntryName() =
"${this.enumClassId.relativeClassName.asString()}.${this.enumEntryName.identifier}"
- private fun fallbackPackageName(): String = "[${sourceSet.displayName} root]"// TODO: error-prone, find a better way to do it
+ private fun fallbackPackageName(): String =
+ "[${sourceSet.displayName} root]"// TODO: error-prone, find a better way to do it
}
private fun DRI.withPackageFallbackTo(fallbackPackage: String): DRI {
- return if(packageName.isNullOrBlank()){
+ return if (packageName.isNullOrBlank()) {
copy(packageName = fallbackPackage)
} else {
this
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 3fa950ed..c94b1814 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.base.translators.documentables
+import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.documentables.InheritorsInfo
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
@@ -14,8 +15,9 @@ import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import kotlin.reflect.KClass
import kotlin.reflect.full.isSubclassOf
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
-private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<SourceSetData?, TagWrapper>>>
+private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<DokkaSourceSet?, TagWrapper>>>
private val specialTags: Set<KClass<out TagWrapper>> =
setOf(Property::class, Description::class, Constructor::class, Receiver::class, Param::class, See::class)
@@ -71,8 +73,13 @@ open class DefaultPageCreator(
protected open fun contentForModule(m: DModule) = contentBuilder.contentFor(m) {
group(kind = ContentKind.Cover) {
cover(m.name)
- if(contentForDescription(m).isNotEmpty()){
- sourceSetDependentHint(m.dri, m.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint, styles = setOf(TextStyle.UnderCoverText)){
+ if (contentForDescription(m).isNotEmpty()) {
+ sourceSetDependentHint(
+ m.dri,
+ m.sourceSets.toSet(),
+ kind = ContentKind.SourceSetDependantHint,
+ styles = setOf(TextStyle.UnderCoverText)
+ ) {
+contentForDescription(m)
}
}
@@ -88,13 +95,18 @@ open class DefaultPageCreator(
protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) {
group(kind = ContentKind.Cover) {
cover("Package ${p.name}")
- if(contentForDescription(p).isNotEmpty()){
- sourceSetDependentHint(p.dri, p.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint, styles = setOf(TextStyle.UnderCoverText)){
+ if (contentForDescription(p).isNotEmpty()) {
+ sourceSetDependentHint(
+ p.dri,
+ p.sourceSets.toSet(),
+ kind = ContentKind.SourceSetDependantHint,
+ styles = setOf(TextStyle.UnderCoverText)
+ ) {
+contentForDescription(p)
}
}
}
- group(styles = setOf(ContentStyle.TabbedContent)){
+ group(styles = setOf(ContentStyle.TabbedContent)) {
+contentForComments(p)
+contentForScope(p, p.dri, p.sourceSets)
}
@@ -103,15 +115,27 @@ open class DefaultPageCreator(
protected open fun contentForScope(
s: WithScope,
dri: DRI,
- sourceSets: Set<SourceSetData>
+ sourceSets: Set<DokkaSourceSet>
) = contentBuilder.contentFor(s as Documentable) {
val types = listOf(
s.classlikes,
(s as? DPackage)?.typealiases ?: emptyList()
).flatten()
divergentBlock("Types", types, ContentKind.Classlikes, extra = mainExtra + SimpleAttr.header("Types"))
- divergentBlock("Functions", s.functions, ContentKind.Functions, extra = mainExtra + SimpleAttr.header( "Functions"))
- block("Properties", 2, ContentKind.Properties, s.properties, sourceSets.toSet(), extra = mainExtra + SimpleAttr.header( "Properties")) {
+ divergentBlock(
+ "Functions",
+ s.functions,
+ ContentKind.Functions,
+ extra = mainExtra + SimpleAttr.header("Functions")
+ )
+ block(
+ "Properties",
+ 2,
+ ContentKind.Properties,
+ s.properties,
+ sourceSets.toSet(),
+ extra = mainExtra + SimpleAttr.header("Properties")
+ ) {
link(it.name, it.dri, kind = ContentKind.Main)
sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
contentForBrief(it)
@@ -136,7 +160,7 @@ open class DefaultPageCreator(
DCI(setOf(dri), ContentKind.Inheritors),
sourceSets.toSet(),
style = emptySet(),
- extra = mainExtra + SimpleAttr.header( "Inheritors")
+ extra = mainExtra + SimpleAttr.header("Inheritors")
)
}
}
@@ -150,7 +174,7 @@ open class DefaultPageCreator(
+buildSignature(e)
}
}
- group(styles = setOf(ContentStyle.TabbedContent)){
+ group(styles = setOf(ContentStyle.TabbedContent)) {
+contentForComments(e)
+contentForScope(e, e.dri, e.sourceSets)
}
@@ -177,14 +201,28 @@ open class DefaultPageCreator(
extra = PropertyContainer.empty<ContentNode>() + SimpleAttr.header("Constructors")
) {
link(it.name, it.dri, kind = ContentKind.Main)
- sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint, styles = emptySet()) {
+ sourceSetDependentHint(
+ it.dri,
+ it.sourceSets.toSet(),
+ kind = ContentKind.SourceSetDependantHint,
+ styles = emptySet()
+ ) {
contentForBrief(it)
+buildSignature(it)
}
}
}
if (c is DEnum) {
- block("Entries", 2, ContentKind.Classlikes, c.entries, c.sourceSets.toSet(), needsSorting = false, extra = mainExtra + SimpleAttr.header("Entries"), styles = emptySet()) {
+ block(
+ "Entries",
+ 2,
+ ContentKind.Classlikes,
+ c.entries,
+ c.sourceSets.toSet(),
+ needsSorting = false,
+ extra = mainExtra + SimpleAttr.header("Entries"),
+ styles = emptySet()
+ ) {
link(it.name, it.dri)
sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
contentForBrief(it)
@@ -198,11 +236,11 @@ open class DefaultPageCreator(
@Suppress("UNCHECKED_CAST")
private inline fun <reified T : TagWrapper> GroupedTags.withTypeUnnamed(): SourceSetDependent<T> =
- (this[T::class] as List<Pair<SourceSetData, T>>?)?.toMap().orEmpty()
+ (this[T::class] as List<Pair<DokkaSourceSet, T>>?)?.toMap().orEmpty()
@Suppress("UNCHECKED_CAST")
private inline fun <reified T : NamedTagWrapper> GroupedTags.withTypeNamed(): Map<String, SourceSetDependent<T>> =
- (this[T::class] as List<Pair<SourceSetData, T>>?)
+ (this[T::class] as List<Pair<DokkaSourceSet, T>>?)
?.groupBy { it.second.name }
?.mapValues { (_, v) -> v.toMap() }
?.toSortedMap(String.CASE_INSENSITIVE_ORDER)
@@ -234,8 +272,8 @@ open class DefaultPageCreator(
val unnamedTags: List<SourceSetDependent<TagWrapper>> =
tags.filterNot { (k, _) -> k.isSubclassOf(NamedTagWrapper::class) || k in specialTags }
- .map { (_, v) -> v.mapNotNull { (k,v) -> k?.let { it to v } }.toMap() }
- if(unnamedTags.isNotEmpty()){
+ .map { (_, v) -> v.mapNotNull { (k, v) -> k?.let { it to v } }.toMap() }
+ if (unnamedTags.isNotEmpty()) {
platforms.forEach { platform ->
unnamedTags.forEach { pdTag ->
pdTag[platform]?.also { tag ->
@@ -252,10 +290,10 @@ open class DefaultPageCreator(
}.children
}
- private fun Documentable.getPossibleFallbackSourcesets(sourceSet: SourceSetData) =
+ private fun Documentable.getPossibleFallbackSourcesets(sourceSet: DokkaSourceSet) =
this.sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
- private fun <V> Map<SourceSetData, V>.fallback(sourceSets: List<SourceSetData>) : V? =
+ private fun <V> Map<DokkaSourceSet, V>.fallback(sourceSets: List<DokkaSourceSet>): V? =
sourceSets.firstOrNull { it in this.keys }.let { this[it] }
protected open fun contentForComments(
@@ -270,7 +308,10 @@ open class DefaultPageCreator(
fun DocumentableContentBuilder.contentForParams() {
if (tags.isNotEmptyForTag<Param>()) {
header(2, "Parameters")
- group(extra = mainExtra + SimpleAttr.header("Parameters"), styles = setOf(ContentStyle.WithExtraAttributes)){
+ group(
+ extra = mainExtra + SimpleAttr.header("Parameters"),
+ styles = setOf(ContentStyle.WithExtraAttributes)
+ ) {
sourceSetDependentHint(sourceSets = platforms.toSet(), kind = ContentKind.SourceSetDependantHint) {
val receiver = tags.withTypeUnnamed<Receiver>()
val params = tags.withTypeNamed<Param>()
@@ -287,7 +328,11 @@ open class DefaultPageCreator(
val paramRows = params.mapNotNull { (_, param) ->
(param[platform] ?: param.fallback(possibleFallbacks))?.let {
buildGroup(sourceSets = setOf(platform), kind = ContentKind.Parameters) {
- text(it.name, kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.RowTitle)
+ text(
+ it.name,
+ kind = ContentKind.Parameters,
+ styles = mainStyles + ContentStyle.RowTitle
+ )
comment(it.root)
}
}
@@ -304,7 +349,10 @@ open class DefaultPageCreator(
fun DocumentableContentBuilder.contentForSeeAlso() {
if (tags.isNotEmptyForTag<See>()) {
header(2, "See also")
- group(extra = mainExtra + SimpleAttr.header("See also"), styles = setOf(ContentStyle.WithExtraAttributes)){
+ group(
+ extra = mainExtra + SimpleAttr.header("See also"),
+ styles = setOf(ContentStyle.WithExtraAttributes)
+ ) {
sourceSetDependentHint(sourceSets = platforms.toSet(), kind = ContentKind.SourceSetDependantHint) {
val seeAlsoTags = tags.withTypeNamed<See>()
table(kind = ContentKind.Sample) {
@@ -312,8 +360,16 @@ open class DefaultPageCreator(
val possibleFallbacks = d.getPossibleFallbackSourcesets(platform)
seeAlsoTags.mapNotNull { (_, see) ->
(see[platform] ?: see.fallback(possibleFallbacks))?.let {
- buildGroup(sourceSets = setOf(platform), kind = ContentKind.Comment, styles = mainStyles + ContentStyle.RowTitle) {
- if (it.address != null) link(it.name, it.address!!, kind = ContentKind.Comment)
+ buildGroup(
+ sourceSets = setOf(platform),
+ kind = ContentKind.Comment,
+ styles = mainStyles + ContentStyle.RowTitle
+ ) {
+ if (it.address != null) link(
+ it.name,
+ it.address!!,
+ kind = ContentKind.Comment
+ )
else text(it.name, kind = ContentKind.Comment)
comment(it.root)
}
@@ -330,11 +386,18 @@ open class DefaultPageCreator(
val samples = tags.withTypeNamed<Sample>()
if (samples.isNotEmpty()) {
header(2, "Samples")
- group(extra = mainExtra + SimpleAttr.header("Samples"), styles = setOf(ContentStyle.WithExtraAttributes)){
+ group(
+ extra = mainExtra + SimpleAttr.header("Samples"),
+ styles = setOf(ContentStyle.WithExtraAttributes)
+ ) {
sourceSetDependentHint(sourceSets = platforms.toSet(), kind = ContentKind.SourceSetDependantHint) {
platforms.map { platformData ->
val content = samples.filter { it.value.isEmpty() || platformData in it.value }
- group(sourceSets = setOf(platformData), kind = ContentKind.Sample, styles = setOf(TextStyle.Monospace)) {
+ group(
+ sourceSets = setOf(platformData),
+ kind = ContentKind.Sample,
+ styles = setOf(TextStyle.Monospace)
+ ) {
content.forEach {
text(it.key)
}
@@ -413,29 +476,33 @@ open class DefaultPageCreator(
.mapValues { if (it.value.any { it is DClasslike }) it.value.filter { it !is DTypeAlias } else it.value }
.toSortedMap(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)){it})
.map { (elementName, elements) -> // This groupBy should probably use LocationProvider
- buildGroup(elements.map { it.dri }.toSet(), elements.flatMap { it.sourceSets }.toSet(), kind = kind) {
- link(elementName.orEmpty(), elements.first().dri, kind = kind)
- divergentGroup(
- ContentDivergentGroup.GroupID(name),
+ buildGroup(
elements.map { it.dri }.toSet(),
+ elements.flatMap { it.sourceSets }.toSet(),
kind = kind
) {
- elements.map {
- instance(setOf(it.dri), it.sourceSets.toSet()) {
- before {
- contentForBrief(it)
- contentForSinceKotlin(it)
- }
- divergent {
- group {
- +buildSignature(it)
+ link(elementName.orEmpty(), elements.first().dri, kind = kind)
+ divergentGroup(
+ ContentDivergentGroup.GroupID(name),
+ elements.map { it.dri }.toSet(),
+ kind = kind
+ ) {
+ elements.map {
+ instance(setOf(it.dri), it.sourceSets.toSet()) {
+ before {
+ contentForBrief(it)
+ contentForSinceKotlin(it)
+ }
+ divergent {
+ group {
+ +buildSignature(it)
+ }
}
}
}
}
}
}
- }
}
}
}
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index 9d10620e..a58ef114 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -1,9 +1,11 @@
package org.jetbrains.dokka.base.translators.documentables
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.Documentable
+import org.jetbrains.dokka.model.SourceSetDependent
import org.jetbrains.dokka.model.doc.DocTag
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
@@ -19,7 +21,7 @@ open class PageContentBuilder(
) {
fun contentFor(
dri: DRI,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
@@ -31,7 +33,7 @@ open class PageContentBuilder(
fun contentFor(
dri: Set<DRI>,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
@@ -46,7 +48,7 @@ open class PageContentBuilder(
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
- sourceSets: Set<SourceSetData> = d.sourceSets.toSet(),
+ sourceSets: Set<DokkaSourceSet> = d.sourceSets.toSet(),
block: DocumentableContentBuilder.() -> Unit = {}
): ContentGroup =
DocumentableContentBuilder(setOf(d.dri), sourceSets, styles, extra)
@@ -56,14 +58,14 @@ open class PageContentBuilder(
@ContentBuilderMarker
open inner class DocumentableContentBuilder(
val mainDRI: Set<DRI>,
- val mainPlatformData: Set<SourceSetData>,
+ val mainPlatformData: Set<DokkaSourceSet>,
val mainStyles: Set<Style>,
val mainExtra: PropertyContainer<ContentNode>
) {
protected val contents = mutableListOf<ContentNode>()
fun build(
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
kind: Kind,
styles: Set<Style>,
extra: PropertyContainer<ContentNode>
@@ -87,7 +89,7 @@ open class PageContentBuilder(
level: Int,
text: String,
kind: Kind = ContentKind.Main,
- platformData: Set<SourceSetData> = mainPlatformData,
+ platformData: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit = {}
@@ -109,18 +111,18 @@ open class PageContentBuilder(
fun cover(
text: String,
- platformData: Set<SourceSetData> = mainPlatformData,
+ platformData: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles + TextStyle.Cover,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit = {}
- ) {
+ ) {
header(1, text, platformData = platformData, styles = styles, extra = extra, block = block)
}
fun text(
text: String,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -132,7 +134,7 @@ open class PageContentBuilder(
fun linkTable(
elements: List<DRI>,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -150,7 +152,7 @@ open class PageContentBuilder(
fun table(
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
operation: DocumentableContentBuilder.() -> List<ContentGroup>
@@ -168,7 +170,7 @@ open class PageContentBuilder(
level: Int,
kind: Kind = ContentKind.Main,
elements: Iterable<T>,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
renderWhenEmpty: Boolean = false,
@@ -180,16 +182,16 @@ open class PageContentBuilder(
contents += ContentTable(
emptyList(),
elements
- .let{
+ .let {
if (needsSorting)
- it.sortedWith(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)){ it.name })
+ it.sortedWith(compareBy(nullsLast(String.CASE_INSENSITIVE_ORDER)) { it.name })
else it
}
.map {
- buildGroup(setOf(it.dri), it.sourceSets.toSet(), kind, styles, extra) {
- operation(it)
- }
- },
+ buildGroup(setOf(it.dri), it.sourceSets.toSet(), kind, styles, extra) {
+ operation(it)
+ }
+ },
DCI(mainDRI, kind),
sourceSets, styles, extra
)
@@ -201,7 +203,7 @@ open class PageContentBuilder(
prefix: String = "",
suffix: String = "",
separator: String = ", ",
- sourceSets: Set<SourceSetData> = mainPlatformData, // TODO: children should be aware of this platform data
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData, // TODO: children should be aware of this platform data
operation: DocumentableContentBuilder.(T) -> Unit
) {
if (elements.isNotEmpty()) {
@@ -219,7 +221,7 @@ open class PageContentBuilder(
text: String,
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -230,7 +232,7 @@ open class PageContentBuilder(
text: String,
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) = ContentDRILink(
@@ -244,7 +246,7 @@ open class PageContentBuilder(
text: String,
address: String,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) =
@@ -260,7 +262,7 @@ open class PageContentBuilder(
fun link(
address: DRI,
kind: Kind = ContentKind.Main,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
@@ -276,7 +278,7 @@ open class PageContentBuilder(
fun comment(
docTag: DocTag,
kind: Kind = ContentKind.Comment,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
@@ -290,7 +292,7 @@ open class PageContentBuilder(
fun group(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -316,7 +318,7 @@ open class PageContentBuilder(
fun buildGroup(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -325,7 +327,7 @@ open class PageContentBuilder(
fun sourceSetDependentHint(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainPlatformData,
+ sourceSets: Set<DokkaSourceSet> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -339,7 +341,7 @@ open class PageContentBuilder(
fun sourceSetDependentHint(
dri: DRI,
- platformData: Set<SourceSetData> = mainPlatformData,
+ platformData: Set<DokkaSourceSet> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -354,7 +356,7 @@ open class PageContentBuilder(
protected fun createText(
text: String,
kind: Kind,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
styles: Set<Style>,
extra: PropertyContainer<ContentNode>
) =
@@ -362,7 +364,7 @@ open class PageContentBuilder(
fun <T> sourceSetDependentText(
value: SourceSetDependent<T>,
- sourceSets: Set<SourceSetData> = value.keys,
+ sourceSets: Set<DokkaSourceSet> = value.keys,
transform: (T) -> String
) = value.entries.filter { it.key in sourceSets }.mapNotNull { (p, v) ->
transform(v).takeIf { it.isNotBlank() }?.let { it to p }
@@ -381,7 +383,7 @@ open class PageContentBuilder(
private val instances: MutableList<ContentDivergentInstance> = mutableListOf()
fun instance(
dri: Set<DRI>,
- sourceSets: Set<SourceSetData>, // Having correct PlatformData is crucial here, that's why there's no default
+ sourceSets: Set<DokkaSourceSet>, // Having correct PlatformData is crucial here, that's why there's no default
kind: Kind = mainKind,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -411,7 +413,7 @@ open class PageContentBuilder(
@ContentBuilderMarker
open inner class DivergentInstanceBuilder(
private val mainDRI: Set<DRI>,
- private val mainSourceSets: Set<SourceSetData>,
+ private val mainSourceSets: Set<DokkaSourceSet>,
private val mainStyles: Set<Style>,
private val mainExtra: PropertyContainer<ContentNode>
) {
@@ -421,7 +423,7 @@ open class PageContentBuilder(
fun before(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainSourceSets,
+ sourceSets: Set<DokkaSourceSet> = mainSourceSets,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -434,7 +436,7 @@ open class PageContentBuilder(
fun divergent(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainSourceSets,
+ sourceSets: Set<DokkaSourceSet> = mainSourceSets,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -445,7 +447,7 @@ open class PageContentBuilder(
fun after(
dri: Set<DRI> = mainDRI,
- sourceSets: Set<SourceSetData> = mainSourceSets,
+ sourceSets: Set<DokkaSourceSet> = mainSourceSets,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
@@ -459,7 +461,7 @@ open class PageContentBuilder(
fun build(
kind: Kind,
- sourceSets: Set<SourceSetData> = mainSourceSets,
+ sourceSets: Set<DokkaSourceSet> = mainSourceSets,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) =
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index e71d936a..8588534b 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -7,10 +7,10 @@ import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.*
import com.intellij.psi.impl.source.PsiClassReferenceType
import com.intellij.psi.impl.source.PsiImmediateClassType
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.analysis.KotlinAnalysis
import org.jetbrains.dokka.analysis.PsiDocumentableSource
import org.jetbrains.dokka.analysis.from
-import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.nextTarget
import org.jetbrains.dokka.links.withClass
@@ -21,7 +21,6 @@ import org.jetbrains.dokka.model.doc.Param
import org.jetbrains.dokka.model.doc.Text
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator
import org.jetbrains.dokka.utilities.DokkaLogger
import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
@@ -42,7 +41,7 @@ class DefaultPsiToDocumentableTranslator(
private val kotlinAnalysis: KotlinAnalysis
) : SourceToDocumentableTranslator {
- override fun invoke(sourceSet: SourceSetData, context: DokkaContext): DModule {
+ override fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule {
fun isFileInSourceRoots(file: File): Boolean {
return sourceSet.sourceRoots.any { root -> file.path.startsWith(File(root.path).absolutePath) }
@@ -93,7 +92,7 @@ class DefaultPsiToDocumentableTranslator(
}
class DokkaPsiParser(
- private val sourceSetData: SourceSetData,
+ private val sourceSetData: DokkaSourceSet,
private val logger: DokkaLogger
) {
@@ -187,7 +186,7 @@ class DefaultPsiToDocumentableTranslator(
fields.filterIsInstance<PsiEnumConstant>().map { entry ->
DEnumEntry(
dri.withClass("$name.${entry.name}"),
- entry.name.orEmpty(),
+ entry.name,
javadocParser.parseDocumentation(entry).toSourceSetDependent(),
null,
emptyList(),
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index f66f88db..2e05d241 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -3,8 +3,6 @@ package content.params
import matchers.content.*
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.model.DFunction
-import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.Param
import org.jetbrains.dokka.model.doc.Text
@@ -570,7 +568,7 @@ class ContentForParamsTest : AbstractCoreTest() {
}
@Test
- fun javaDocCommentWithDocumentedParameters(){
+ fun javaDocCommentWithDocumentedParameters() {
testInline(
"""
|/src/main/java/test/Main.java
@@ -587,14 +585,14 @@ class ContentForParamsTest : AbstractCoreTest() {
| }
| }
""".trimIndent(), testConfiguration
- ){
- pagesTransformationStage = {
- module ->
+ ) {
+ pagesTransformationStage = { module ->
val sampleFunction = module.dfs {
- it is MemberPageNode && it.dri.first().toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/"
+ it is MemberPageNode && it.dri.first()
+ .toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/"
} as MemberPageNode
val forJvm = (sampleFunction.documentable as DFunction).parameters.mapNotNull {
- val jvm = it.documentation.keys.first { it.platform == Platform.jvm }
+ val jvm = it.documentation.keys.first { it.analysisPlatform == Platform.jvm }
it.documentation[jvm]
}
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
index 5daebb73..f5517abb 100644
--- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
@@ -31,7 +31,7 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
) {
with((this / "inheritors" / "A").cast<DInterface>()) {
val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value
- with(map.keys.also { it counts 1 }.find { it.platform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }
+ with(map.keys.also { it counts 1 }.find { it.analysisPlatform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }
) {
this counts 1
first().classNames equals "B"
@@ -77,11 +77,11 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
with((m / "inheritors" / "A").cast<DInterface>()) {
val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value
with(map.keys.also { it counts 2 }) {
- with(find { it.platform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }) {
+ with(find { it.analysisPlatform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }) {
this counts 1
first().classNames equals "B"
}
- with(find { it.platform == Platform.js }.assertNotNull("js key").let { map[it]!! }) {
+ with(find { it.analysisPlatform == Platform.js }.assertNotNull("js key").let { map[it]!! }) {
this counts 2
val classes = listOf("B", "C")
assertTrue(all { classes.contains(it.classNames) }, "One of subclasses missing in js" )
diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
index 452439e9..21a70802 100644
--- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
+++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt
@@ -1,21 +1,17 @@
package renderers
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.base.resolvers.external.DokkaExternalLocationProviderFactory
import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProviderFactory
import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProviderFactory
-import org.jetbrains.dokka.base.resolvers.local.LocationProvider
-import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory
import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
-import org.jetbrains.dokka.base.transformers.pages.samples.DefaultSamplesTransformer
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.model.SourceSetCache
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.model.doc.DocTag
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*
@@ -35,7 +31,6 @@ abstract class RenderingOnlyTestBase {
DokkaBase().htmlPreprocessors to { _ -> RootCreator },
DokkaBase().externalLocationProviderFactory to { ::JavadocExternalLocationProviderFactory },
DokkaBase().externalLocationProviderFactory to { ::DokkaExternalLocationProviderFactory },
- sourceSetCache = SourceSetCache(),
testConfiguration = DokkaConfigurationImpl(
"", "", null, false, emptyList(), emptyList(), emptyMap(), emptyList(), false
)
@@ -110,7 +105,7 @@ internal object EmptyCommentConverter : CommentsToContentConverter {
override fun buildContent(
docTag: DocTag,
dci: DCI,
- sourceSets: Set<SourceSetData>,
+ sourceSets: Set<DokkaSourceSet>,
styles: Set<Style>,
extras: PropertyContainer<ContentNode>
): List<ContentNode> = emptyList()
diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
index b10202bb..6ceb805b 100644
--- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
@@ -4,15 +4,33 @@ import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.SourceRootImpl
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
import renderers.*
class DivergentTest : RenderingOnlyTestBase() {
- private val js = SourceSetData("root", "js", "JS", Platform.js, listOf(SourceRootImpl("pl1")))
- private val jvm = SourceSetData("root", "jvm", "JVM", Platform.jvm, listOf(SourceRootImpl("pl1")))
- private val native = SourceSetData("root", "native", "NATIVE", Platform.native, listOf(SourceRootImpl("pl1")))
+ private val js = defaultSourceSet.copy(
+ "root",
+ "JS",
+ "js",
+ analysisPlatform = Platform.js,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
+ private val jvm = defaultSourceSet.copy(
+ "root",
+ "JVM",
+ "jvm",
+
+ analysisPlatform = Platform.jvm,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
+ private val native = defaultSourceSet.copy(
+ "root",
+ "NATIVE",
+ "native",
+ analysisPlatform = Platform.native,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
@Test
fun simpleWrappingCase() {
@@ -178,10 +196,10 @@ class DivergentTest : RenderingOnlyTestBase() {
HtmlRenderer(context).render(page)
renderedContent.match(
- Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("a"))),"a+"),
- Div(Div(Span(Div(Div("JS")))), Div(Div(Div("bd"))),"bd+"),
+ Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("a"))), "a+"),
+ Div(Div(Span(Div(Div("JS")))), Div(Div(Div("bd"))), "bd+"),
Div(Div(Span(Div(Div("JVM")))), Div(Div(Div("c")))),
- Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("e"))),"e+"),
+ Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("e"))), "e+"),
)
}
diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
index 878f442b..c868cfd5 100644
--- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt
@@ -3,7 +3,6 @@ package renderers.html
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.SourceRootImpl
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
-import org.jetbrains.dokka.model.SourceSetData
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
import renderers.Div
@@ -12,9 +11,28 @@ import renderers.TestPage
import renderers.match
class SourceSetDependentHintTest : RenderingOnlyTestBase() {
- private val pl1 = SourceSetData("root", "pl1", "pl3",Platform.js, listOf(SourceRootImpl("pl1")))
- private val pl2 = SourceSetData("root","pl2", "pl3", Platform.jvm, listOf(SourceRootImpl("pl1")))
- private val pl3 = SourceSetData("root","pl3", "pl3", Platform.native, listOf(SourceRootImpl("pl1")))
+
+ private val pl1 = defaultSourceSet.copy(
+ "root",
+ "pl1",
+ "pl1",
+ analysisPlatform = Platform.js,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
+ private val pl2 = defaultSourceSet.copy(
+ "root",
+ "pl2",
+ "pl2",
+ analysisPlatform = Platform.jvm,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
+ private val pl3 = defaultSourceSet.copy(
+ "root",
+ "pl3",
+ "pl3",
+ analysisPlatform = Platform.native,
+ sourceRoots = listOf(SourceRootImpl("pl1"))
+ )
@Test
fun platformIndependentCase() {
diff --git a/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt b/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt
new file mode 100644
index 00000000..771cabaa
--- /dev/null
+++ b/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt
@@ -0,0 +1,30 @@
+package renderers.html
+
+import org.jetbrains.dokka.DokkaSourceSetImpl
+import org.jetbrains.dokka.Platform
+
+internal val defaultSourceSet = DokkaSourceSetImpl(
+ moduleName = "DEFAULT",
+ displayName = "DEFAULT",
+ sourceSetID = "DEFAULT",
+ classpath = emptyList(),
+ sourceRoots = emptyList(),
+ dependentSourceSets = emptyList(),
+ samples = emptyList(),
+ includes = emptyList(),
+ includeNonPublic = false,
+ includeRootPackage = false,
+ reportUndocumented = false,
+ skipEmptyPackages = true,
+ skipDeprecated = false,
+ jdkVersion = 8,
+ sourceLinks = emptyList(),
+ perPackageOptions = emptyList(),
+ externalDocumentationLinks = emptyList(),
+ languageVersion = null,
+ apiVersion = null,
+ noStdlibLink = false,
+ noJdkLink = false,
+ suppressedFiles = emptyList(),
+ analysisPlatform = Platform.DEFAULT
+) \ No newline at end of file