diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-11-20 13:07:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-20 13:07:16 +0100 |
commit | 9ce37affaa2c1199807c08e13485740ea993994e (patch) | |
tree | 4d71da873cc7ab7a0633ca39d5c494c20c34342f /dokka-subprojects/analysis-kotlin-api | |
parent | f333e425440701e50361f61acc2f9cb2d10fac1a (diff) | |
download | dokka-9ce37affaa2c1199807c08e13485740ea993994e.tar.gz dokka-9ce37affaa2c1199807c08e13485740ea993994e.tar.bz2 dokka-9ce37affaa2c1199807c08e13485740ea993994e.zip |
Run `analysis-kotlin-api` tests with K2 analysis (#3358)
Diffstat (limited to 'dokka-subprojects/analysis-kotlin-api')
7 files changed, 22 insertions, 5 deletions
diff --git a/dokka-subprojects/analysis-kotlin-api/build.gradle.kts b/dokka-subprojects/analysis-kotlin-api/build.gradle.kts index 7e834e1c..96299814 100644 --- a/dokka-subprojects/analysis-kotlin-api/build.gradle.kts +++ b/dokka-subprojects/analysis-kotlin-api/build.gradle.kts @@ -7,6 +7,7 @@ import dokkabuild.overridePublicationArtifactId plugins { id("dokkabuild.kotlin-jvm") id("dokkabuild.publish-jvm") + id("dokkabuild.test-k2") `java-test-fixtures` } @@ -18,7 +19,9 @@ dependencies { testFixturesApi(projects.dokkaSubprojects.dokkaCore) testImplementation(kotlin("test")) - testImplementation(projects.dokkaSubprojects.analysisKotlinDescriptors) + + symbolsTestConfiguration(project(path = ":dokka-subprojects:analysis-kotlin-symbols", configuration = "shadow")) + descriptorsTestConfiguration(project(path = ":dokka-subprojects:analysis-kotlin-descriptors", configuration = "shadow")) } disableTestFixturesPublishing() diff --git a/dokka-subprojects/analysis-kotlin-api/src/test/kotlin/org/jetbrains/dokka/analysis/test/jvm/mixed/SampleMixedJvmAnalysisTest.kt b/dokka-subprojects/analysis-kotlin-api/src/test/kotlin/org/jetbrains/dokka/analysis/test/jvm/mixed/SampleMixedJvmAnalysisTest.kt index fec2ceb8..98588a2f 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/test/kotlin/org/jetbrains/dokka/analysis/test/jvm/mixed/SampleMixedJvmAnalysisTest.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/test/kotlin/org/jetbrains/dokka/analysis/test/jvm/mixed/SampleMixedJvmAnalysisTest.kt @@ -72,10 +72,12 @@ class SampleMixedJvmAnalysisTest { val secondClasslike = pckg.classlikes[1] assertEquals("MyJavaFileInJava", secondClasslike.name) - val firstFunction = pckg.functions[0] + // TODO #3250 address unstable order + val functions = pckg.functions.sortedBy { it.name } + val firstFunction = functions[0] assertEquals("bar", firstFunction.name) - val secondFunction = pckg.functions[1] + val secondFunction = functions[1] assertEquals("foo", secondFunction.name) } } diff --git a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfiguration.kt b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfiguration.kt index 5c5a0daf..7d7108e4 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfiguration.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfiguration.kt @@ -70,6 +70,13 @@ data class TestDokkaSourceSet ( val analysisPlatform: Platform, /** + * Display name of the source set, used both internally and externally + * + * @see DokkaConfiguration.DokkaSourceSet.displayName + */ + val displayName: String, + + /** * A unique identifier of this source set in the scope of the project. * * It must be unique even if two source sets have the same name, diff --git a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfigurationMapper.kt b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfigurationMapper.kt index f6356ab2..806d744a 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfigurationMapper.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/configuration/TestDokkaConfigurationMapper.kt @@ -88,6 +88,7 @@ fun TestDokkaConfiguration.toDokkaConfiguration(projectDir: File): DokkaConfigur private fun TestDokkaSourceSet.toDokkaSourceSet(relativeToDir: File): DokkaConfiguration.DokkaSourceSet { val analysisPlatform = this.analysisPlatform + val displayName = this.displayName val sourceSetID = this.sourceSetID val dependentSourceSets = this.dependentSourceSets val sourceRoots = this.sourceRoots.mapToSet { it.relativeTo(relativeToDir) } @@ -109,6 +110,9 @@ private fun TestDokkaSourceSet.toDokkaSourceSet(relativeToDir: File): DokkaConfi override val analysisPlatform: Platform get() = analysisPlatform + override val displayName: String + get() = displayName + override val sourceSetID: DokkaSourceSetID get() = sourceSetID @@ -142,8 +146,6 @@ private fun TestDokkaSourceSet.toDokkaSourceSet(relativeToDir: File): DokkaConfi * analysis (i.e starts throwing an exception), a corresponding * test property should be added along with the mapping. */ - override val displayName: String - get() = throw NotImplementedError("Not expected to be used by analysis modules") @Suppress("OVERRIDE_DEPRECATION") override val includeNonPublic: Boolean get() = throw NotImplementedError("Not expected to be used by analysis modules") diff --git a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/java/JavaConfigurationBuilder.kt b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/java/JavaConfigurationBuilder.kt index 6775fa21..156fc4e4 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/java/JavaConfigurationBuilder.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/java/JavaConfigurationBuilder.kt @@ -48,6 +48,7 @@ class JavaTestSourceSetBuilder : BaseTestDokkaSourceSetBuilder() { override fun build(): TestDokkaSourceSet { return TestDokkaSourceSet( analysisPlatform = Platform.jvm, + displayName = "JavaJvmSourceSet", sourceSetID = DokkaSourceSetID(scopeId = "project", sourceSetName = "java"), dependentSourceSets = setOf(), sourceRoots = additionalSourceRoots + setOf(JavaTestProject.DEFAULT_SOURCE_ROOT), diff --git a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/kotlin/KotlinJvmConfigurationBuilder.kt b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/kotlin/KotlinJvmConfigurationBuilder.kt index a0255611..e5424ead 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/kotlin/KotlinJvmConfigurationBuilder.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/kotlin/KotlinJvmConfigurationBuilder.kt @@ -43,6 +43,7 @@ class KotlinJvmTestSourceSetBuilder : BaseTestDokkaSourceSetBuilder() { override fun build(): TestDokkaSourceSet { return TestDokkaSourceSet( analysisPlatform = Platform.jvm, + displayName = "KotlinJvmSourceSet", sourceSetID = DokkaSourceSetID(scopeId = "project", sourceSetName = "kotlin"), dependentSourceSets = setOf(), sourceRoots = additionalSourceRoots + setOf(KotlinJvmTestProject.DEFAULT_SOURCE_ROOT), diff --git a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/mixed/MixedJvmConfigurationBuilder.kt b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/mixed/MixedJvmConfigurationBuilder.kt index 16af6e7d..ff8d5073 100644 --- a/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/mixed/MixedJvmConfigurationBuilder.kt +++ b/dokka-subprojects/analysis-kotlin-api/src/testFixtures/kotlin/org/jetbrains/dokka/analysis/test/api/jvm/mixed/MixedJvmConfigurationBuilder.kt @@ -53,6 +53,7 @@ class MixedJvmTestSourceSetBuilder : BaseTestDokkaSourceSetBuilder() { override fun build(): TestDokkaSourceSet { return TestDokkaSourceSet( analysisPlatform = Platform.jvm, + displayName = "MixedJvmSourceSet", sourceSetID = DokkaSourceSetID(scopeId = "project", sourceSetName = "jvm"), dependentSourceSets = setOf(), sourceRoots = additionalSourceRoots + setOf( |