aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-30 23:06:03 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-06 17:59:15 +0200
commitb0e8622f374f6499058b0f083367b4a54512b702 (patch)
tree0fa641dc26bf1e7ed6497ee2340999e8ecc505ad /plugins/base/src/main/kotlin
parentb0b418334535adc60ee80c3df1b2293dfcaad071 (diff)
downloaddokka-b0e8622f374f6499058b0f083367b4a54512b702.tar.gz
dokka-b0e8622f374f6499058b0f083367b4a54512b702.tar.bz2
dokka-b0e8622f374f6499058b0f083367b4a54512b702.zip
Enforce workspace unique SourceSetID
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt22
-rw-r--r--plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt3
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt12
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt6
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt4
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt2
8 files changed, 25 insertions, 32 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index de892bb1..f8fa3b2e 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -94,7 +94,7 @@ open class HtmlRenderer(
group.sourceSets.forEach {
button(classes = "platform-tag platform-selector") {
attributes["data-active"] = ""
- attributes["data-filter"] = it.sourceSetID
+ attributes["data-filter"] = it.sourceSetID.toString()
when (it.analysisPlatform.key) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
@@ -168,10 +168,10 @@ open class HtmlRenderer(
attributes["data-toggle-list"] = "data-toggle-list"
contents.forEachIndexed { index, pair ->
button(classes = "platform-bookmark") {
- attributes["data-filterable-current"] = pair.first.sourceSetID
- attributes["data-filterable-set"] = pair.first.sourceSetID
+ attributes["data-filterable-current"] = pair.first.sourceSetID.toString()
+ attributes["data-filterable-set"] = pair.first.sourceSetID.toString()
if (index == 0) attributes["data-active"] = ""
- attributes["data-toggle"] = pair.first.sourceSetID
+ attributes["data-toggle"] = pair.first.sourceSetID.toString()
when (
pair.first.analysisPlatform.key
) {
@@ -180,7 +180,7 @@ open class HtmlRenderer(
"jvm" -> classes = classes + "jvm-like"
"js" -> classes = classes + "js-like"
}
- attributes["data-toggle"] = pair.first.sourceSetID
+ attributes["data-toggle"] = pair.first.sourceSetID.toString()
text(pair.first.displayName)
}
}
@@ -212,7 +212,7 @@ open class HtmlRenderer(
}.map {
it to createHTML(prettyPrint = false).div(classes = "content sourceset-depenent-content") {
if (counter++ == 0) attributes["data-active"] = ""
- attributes["data-togglable"] = it.sourceSetID
+ attributes["data-togglable"] = it.sourceSetID.toString()
unsafe {
+html
}
@@ -249,10 +249,10 @@ open class HtmlRenderer(
consumer.onTagContentUnsafe {
+createHTML().div("divergent-group") {
attributes["data-filterable-current"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetID
+ it.sourceSetID.toString()
}
attributes["data-filterable-set"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetID
+ it.sourceSetID.toString()
}
val divergentForPlatformDependent = groupedDivergent.map { (sourceSet, elements) ->
@@ -353,10 +353,10 @@ open class HtmlRenderer(
div(classes = "table-row") {
if (!style.contains(MultimoduleTable)) {
attributes["data-filterable-current"] = node.sourceSets.joinToString(" ") {
- it.sourceSetID
+ it.sourceSetID.toString()
}
attributes["data-filterable-set"] = node.sourceSets.joinToString(" ") {
- it.sourceSetID
+ it.sourceSetID.toString()
}
}
@@ -728,4 +728,4 @@ private fun String.stripDiv() = drop(5).dropLast(6) // TODO: Find a way to do it
private val PageNode.isNavigable: Boolean
get() = this !is RendererSpecificPage || strategy != RenderingStrategy.DoNothing
-fun PropertyContainer<ContentNode>.extraHtmlAttributes() = allOfType<SimpleAttr>() \ No newline at end of file
+fun PropertyContainer<ContentNode>.extraHtmlAttributes() = allOfType<SimpleAttr>()
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
index f042eae3..2a242948 100644
--- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
+++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt
@@ -1,6 +1,5 @@
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.*
@@ -142,4 +141,4 @@ interface JvmSignatureUtils {
sealed class AtStrategy
object All : AtStrategy()
object OnlyOnce : AtStrategy()
-object Never : AtStrategy() \ No newline at end of file
+object Never : AtStrategy()
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
index c3cc4d38..ff05beed 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt
@@ -9,11 +9,9 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer {
override fun invoke(modules: List<DModule>) = modules.map { original ->
- val passOptions = original.sourceSets.single()
- val packageOptions = passOptions.perPackageOptions
- original.let {
- DocumentableVisibilityFilter(packageOptions, passOptions).processModule(it)
- }
+ val sourceSet = original.sourceSets.single()
+ val packageOptions = sourceSet.perPackageOptions
+ DocumentableVisibilityFilter(packageOptions, sourceSet).processModule(original)
}
private class DocumentableVisibilityFilter(
@@ -45,7 +43,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
private fun filterPackages(packages: List<DPackage>): Pair<Boolean, List<DPackage>> {
var packagesListChanged = false
- val filteredPackages = packages.mapNotNull {
+ val filteredPackages = packages.map {
var modified = false
val functions = filterFunctions(it.functions).let { (listModified, list) ->
modified = modified || listModified
@@ -326,4 +324,4 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe
return Pair(classlikesListChanged, filteredClasslikes)
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
index 3fd0081a..61abfbd7 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/EmptyPackagesFilterTransformer.kt
@@ -14,9 +14,9 @@ class EmptyPackagesFilterTransformer(val context: DokkaContext) : PreMergeDocume
}
private class EmptyPackagesFilter(
- val passOptions: DokkaConfiguration.DokkaSourceSet
+ val sourceSet: DokkaConfiguration.DokkaSourceSet
) {
- fun DPackage.shouldBeSkipped() = passOptions.skipEmptyPackages &&
+ fun DPackage.shouldBeSkipped() = sourceSet.skipEmptyPackages &&
functions.isEmpty() &&
properties.isEmpty() &&
classlikes.isEmpty()
@@ -25,4 +25,4 @@ class EmptyPackagesFilterTransformer(val context: DokkaContext) : PreMergeDocume
packages = module.packages.filter { !it.shouldBeSkipped() }
)
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index 1f718a7c..a0800da8 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -1,12 +1,10 @@
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.doc.DocumentationNode
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
import org.jetbrains.dokka.transformers.documentation.PreMergeDocumentableTransformer
import org.jetbrains.kotlin.name.FqName
@@ -24,7 +22,7 @@ internal class ModuleAndPackageDocumentationTransformer(
val modulesAndPackagesDocumentation =
context.configuration.sourceSets
.map {
- Pair(it.moduleName, it) to
+ Pair(it.moduleDisplayName, it) to
it.includes.map { Paths.get(it) }
.also {
it.forEach {
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 b39715a7..41dea1a2 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt
@@ -67,7 +67,7 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
analysis: Map<DokkaSourceSet, EnvironmentAndFacade>
): ContentNode {
val facade = analysis[platform]?.facade
- ?: return this.also { context.logger.warn("Cannot resolve facade for platform ${platform.moduleName}") }
+ ?: return this.also { context.logger.warn("Cannot resolve facade for platform ${platform.moduleDisplayName}") }
val psiElement = fqNameToPsiElement(facade, fqName)
?: return this.also { context.logger.warn("Cannot find PsiElement corresponding to $fqName") }
val imports =
@@ -147,4 +147,4 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer {
style = styles + ContentStyle.RunnableSample + TextStyle.Monospace,
extra = extra
)
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 9cdd251c..b0374014 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotated
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
import org.jetbrains.kotlin.idea.kdoc.findKDoc
-import org.jetbrains.kotlin.idea.kdoc.isBoringBuiltinClass
import org.jetbrains.kotlin.load.kotlin.toSourceElement
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.*
@@ -36,7 +35,6 @@ import org.jetbrains.kotlin.resolve.constants.KClassValue.Value.NormalClass
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperclassesWithoutAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
-import org.jetbrains.kotlin.resolve.jvm.isInlineClassThatRequiresMangling
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
@@ -71,7 +69,7 @@ class DefaultDescriptorToDocumentableTranslator(
DRIWithPlatformInfo(DRI.topLevel, emptyMap())
)
}
- }.let { DModule(sourceSet.moduleName, it, emptyMap(), null, setOf(sourceSet)) }
+ }.let { DModule(sourceSet.moduleDisplayName, it, emptyMap(), null, setOf(sourceSet)) }
}
}
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 76f8319d..5a55e3ec 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -68,7 +68,7 @@ class DefaultPsiToDocumentableTranslator(
context.logger
)
return DModule(
- sourceSet.moduleName,
+ sourceSet.moduleDisplayName,
psiFiles.mapNotNull { it.safeAs<PsiJavaFile>() }.groupBy { it.packageName }.map { (packageName, psiFiles) ->
val dri = DRI(packageName = packageName)
DPackage(