From 7ec03e673880fdf09fdc5b781db5c6b30f92df6b Mon Sep 17 00:00:00 2001 From: vmishenev Date: Fri, 18 Aug 2023 23:08:43 +0300 Subject: [PATCH] Fix review comments --- .../filter/KotlinArrayDocumentableReplacerTest.kt | 2 +- .../superFields/DescriptorSuperPropertiesTest.kt | 2 +- ...usAndInheritedFunctionsDocumentableFilterTest.kt | 2 +- .../base/src/test/kotlin/utils/TagsAnnotations.kt | 2 ++ .../java/DefaultPsiToDocumentableTranslator.kt | 3 ++- subprojects/analysis-kotlin-symbols/ide/api/ide.api | 4 ---- .../analysis-kotlin-symbols/ide/build.gradle.kts | 13 ------------- .../kotlin/symbols/ide/IdeSymbolsAnalysisPlugin.kt | 11 ----------- .../org.jetbrains.dokka.plugability.DokkaPlugin | 1 - .../kotlin/symbols/plugin/SymbolsAnalysisPlugin.kt | 5 +++++ .../services/KotlinAnalysisSourceRootsExtractor.kt | 12 ++++++++++++ 11 files changed, 24 insertions(+), 33 deletions(-) delete mode 100644 subprojects/analysis-kotlin-symbols/ide/api/ide.api delete mode 100644 subprojects/analysis-kotlin-symbols/ide/build.gradle.kts delete mode 100644 subprojects/analysis-kotlin-symbols/ide/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/ide/IdeSymbolsAnalysisPlugin.kt delete mode 100644 subprojects/analysis-kotlin-symbols/ide/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin create mode 100644 subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/services/KotlinAnalysisSourceRootsExtractor.kt diff --git a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt index b94f35e2ffd..af77d61cd65 100644 --- a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt +++ b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt @@ -170,7 +170,7 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() { } sourceSet { sourceRoots = listOf("src/main/kotlin/basic/TestJS.kt") - analysisPlatform = "jvm" + analysisPlatform = "js" } } } diff --git a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt index 43a9a5ea458..14c2752a64f 100644 --- a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt +++ b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt @@ -175,7 +175,7 @@ class DescriptorSuperPropertiesTest : BaseAbstractTest() { } } - // protected is publicAPI + // incorrect test https://github.com/Kotlin/dokka/issues/3128 @Test fun `kotlin inheriting java should not append anything since field is public api`() { val configuration = dokkaConfiguration { diff --git a/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt b/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt index 8e4553210db..ffb5c9c852f 100644 --- a/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt +++ b/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt @@ -195,9 +195,9 @@ class ObviousAndInheritedFunctionsDocumentableFilterTest : BaseAbstractTest() { } } - @JavaCode @ParameterizedTest @MethodSource(value = ["nonSuppressingObviousConfiguration", "nonSuppressingInheritedConfiguration"]) + @JavaCode fun `should not suppress toString, equals and hashcode if custom config is provided in Java`(nonSuppressingConfiguration: DokkaConfigurationImpl) { testInline( """ diff --git a/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt index c083e0ace1c..f28e66a9755 100644 --- a/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt +++ b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt @@ -40,6 +40,7 @@ annotation class OnlyDescriptorsMPP(val reason: String = "") /** * For test containing .java code + * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114 */ @Target( AnnotationTarget.CLASS, @@ -55,6 +56,7 @@ annotation class JavaCode /** * For test using JDK + * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114 */ @Target( AnnotationTarget.CLASS, diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/DefaultPsiToDocumentableTranslator.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/DefaultPsiToDocumentableTranslator.kt index 61c1af98eed..72cf45d9f6d 100644 --- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/DefaultPsiToDocumentableTranslator.kt +++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/DefaultPsiToDocumentableTranslator.kt @@ -27,7 +27,8 @@ internal class DefaultPsiToDocumentableTranslator : AsyncSourceToDocumentableTra val projectProvider = context.plugin().querySingle { projectProvider } val project = projectProvider.getProject(sourceSet, context) - val sourceRoots = sourceSet.sourceRoots.filter { directory -> directory.isDirectory || directory.extension == "java" } + val sourceRootsExtractor = context.plugin().querySingle { sourceRootsExtractor } + val sourceRoots = sourceRootsExtractor.extract(sourceSet, context) val localFileSystem = VirtualFileManager.getInstance().getFileSystem("file") diff --git a/subprojects/analysis-kotlin-symbols/ide/api/ide.api b/subprojects/analysis-kotlin-symbols/ide/api/ide.api deleted file mode 100644 index 9be46c0b5f6..00000000000 --- a/subprojects/analysis-kotlin-symbols/ide/api/ide.api +++ /dev/null @@ -1,4 +0,0 @@ -public final class org/jetbrains/dokka/analysis/kotlin/symbols/ide/IdeSymbolsAnalysisPlugin : org/jetbrains/dokka/plugability/DokkaPlugin { - public fun ()V -} - diff --git a/subprojects/analysis-kotlin-symbols/ide/build.gradle.kts b/subprojects/analysis-kotlin-symbols/ide/build.gradle.kts deleted file mode 100644 index 876d87ca7b0..00000000000 --- a/subprojects/analysis-kotlin-symbols/ide/build.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -plugins { - id("org.jetbrains.conventions.kotlin-jvm") -} - -dependencies { - compileOnly(projects.core) - compileOnly(projects.subprojects.analysisKotlinApi) - - // TODO - - // TODO [beresnev] get rid of it - compileOnly(libs.kotlinx.coroutines.core) -} diff --git a/subprojects/analysis-kotlin-symbols/ide/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/ide/IdeSymbolsAnalysisPlugin.kt b/subprojects/analysis-kotlin-symbols/ide/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/ide/IdeSymbolsAnalysisPlugin.kt deleted file mode 100644 index 33f555cb07f..00000000000 --- a/subprojects/analysis-kotlin-symbols/ide/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/ide/IdeSymbolsAnalysisPlugin.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.jetbrains.dokka.analysis.kotlin.symbols.ide - -import org.jetbrains.dokka.plugability.DokkaPlugin -import org.jetbrains.dokka.plugability.DokkaPluginApiPreview -import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement - -class IdeSymbolsAnalysisPlugin : DokkaPlugin() { - - @OptIn(DokkaPluginApiPreview::class) - override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement = PluginApiPreviewAcknowledgement -} diff --git a/subprojects/analysis-kotlin-symbols/ide/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin b/subprojects/analysis-kotlin-symbols/ide/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin deleted file mode 100644 index 592455784a5..00000000000 --- a/subprojects/analysis-kotlin-symbols/ide/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.dokka.analysis.kotlin.symbols.ide.IdeSymbolsAnalysisPlugin diff --git a/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/plugin/SymbolsAnalysisPlugin.kt b/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/plugin/SymbolsAnalysisPlugin.kt index 37b8cf13cd4..262e9f9e49e 100644 --- a/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/plugin/SymbolsAnalysisPlugin.kt +++ b/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/plugin/SymbolsAnalysisPlugin.kt @@ -10,6 +10,7 @@ import org.jetbrains.dokka.analysis.kotlin.symbols.kdoc.java.KotlinInheritDocTag import org.jetbrains.dokka.analysis.kotlin.symbols.kdoc.java.DescriptorKotlinDocCommentCreator import org.jetbrains.dokka.analysis.kotlin.symbols.kdoc.java.KotlinDocCommentParser import org.jetbrains.dokka.analysis.kotlin.symbols.kdoc.moduledocs.ModuleAndPackageDocumentationReader +import org.jetbrains.dokka.analysis.kotlin.symbols.services.KotlinAnalysisSourceRootsExtractor import org.jetbrains.dokka.analysis.kotlin.symbols.services.* import org.jetbrains.dokka.analysis.kotlin.symbols.services.KotlinDocumentableSourceLanguageParser import org.jetbrains.dokka.analysis.kotlin.symbols.services.SymbolExternalDocumentablesProvider @@ -116,6 +117,10 @@ class SymbolsAnalysisPlugin : DokkaPlugin() { plugin().sampleProviderFactory providing ::KotlinSampleProviderFactory } + internal val sourceRootsExtractor by extending { + javaAnalysisPlugin.sourceRootsExtractor providing { KotlinAnalysisSourceRootsExtractor() } + } + @OptIn(DokkaPluginApiPreview::class) override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement = PluginApiPreviewAcknowledgement } diff --git a/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/services/KotlinAnalysisSourceRootsExtractor.kt b/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/services/KotlinAnalysisSourceRootsExtractor.kt new file mode 100644 index 00000000000..a568f754d9e --- /dev/null +++ b/subprojects/analysis-kotlin-symbols/plugin/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/services/KotlinAnalysisSourceRootsExtractor.kt @@ -0,0 +1,12 @@ +package org.jetbrains.dokka.analysis.kotlin.symbols.services + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.analysis.java.SourceRootsExtractor +import org.jetbrains.dokka.plugability.DokkaContext +import java.io.File + +class KotlinAnalysisSourceRootsExtractor : SourceRootsExtractor { + override fun extract(sourceSet: DokkaConfiguration.DokkaSourceSet, context: DokkaContext): List { + return sourceSet.sourceRoots.filter { directory -> directory.isDirectory || directory.extension == "java" } + } +}