aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers/documentables
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-24 09:14:37 +0200
committerPaweł Marks <pmarks@virtuslab.com>2020-06-25 19:50:22 +0200
commit08f40e2a13006882e8f8425f111b8527e7bbcb0f (patch)
tree1052c35c75fccaa044a73b33e5f0b5adae4c0f57 /plugins/base/src/main/kotlin/transformers/documentables
parentcf2e842da89f0effa6bdb5eb942b250c94360b5c (diff)
downloaddokka-08f40e2a13006882e8f8425f111b8527e7bbcb0f.tar.gz
dokka-08f40e2a13006882e8f8425f111b8527e7bbcb0f.tar.bz2
dokka-08f40e2a13006882e8f8425f111b8527e7bbcb0f.zip
Remove kotlin source analysis from :core to :kotlin-analysis (thanks to Afzal Najam)
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers/documentables')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt20
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt1
2 files changed, 13 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
index 2aab6018..63232793 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ModuleAndPackageDocumentationTransformer.kt
@@ -1,10 +1,13 @@
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.parsers.MarkdownParser
+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
@@ -12,9 +15,12 @@ import java.nio.file.Files
import java.nio.file.Paths
-internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContext) : PreMergeDocumentableTransformer {
+internal class ModuleAndPackageDocumentationTransformer(
+ private val context: DokkaContext,
+ private val kotlinAnalysis: KotlinAnalysis
+) : PreMergeDocumentableTransformer {
- override fun invoke(original: List<DModule>): List<DModule> {
+ override fun invoke(modules: List<DModule>): List<DModule> {
val modulesAndPackagesDocumentation =
context.configuration.passesConfigurations
@@ -47,13 +53,12 @@ internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContex
}
}.toMap()
- return original.map { module ->
+ return modules.map { module ->
val moduleDocumentation =
module.sourceSets.mapNotNull { pd ->
val doc = modulesAndPackagesDocumentation[Pair(module.name, pd)]
- val facade = context.platforms[pd]?.facade
- ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetID}") }
+ val facade = kotlinAnalysis[pd].facade
try {
doc?.get("Module")?.get(module.name)?.run {
pd to MarkdownParser(
@@ -71,8 +76,7 @@ internal class ModuleAndPackageDocumentationTransformer(val context: DokkaContex
val packagesDocumentation = module.packages.map {
it.name to it.sourceSets.mapNotNull { pd ->
val doc = modulesAndPackagesDocumentation[Pair(module.name, pd)]
- val facade = context.platforms[pd]?.facade
- ?: return@mapNotNull null.also { context.logger.warn("Could not find platform data for ${pd.moduleName}/${pd.sourceSetID}") }
+ val facade = kotlinAnalysis[pd].facade
val descriptor = facade.moduleDescriptor.getPackage(FqName(it.name.let { if(it == "[JS root]") "" else it }))
doc?.get("Package")?.get(it.name)?.run {
pd to MarkdownParser(
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index 7d475571..0b47345d 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaConfiguration.PassConfiguration
+import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer