aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-10-25 14:44:09 +0300
committerGitHub <noreply@github.com>2023-10-25 14:44:09 +0300
commit3be4dd94e3af2e749969ba352482eae6957cac5a (patch)
treef2ff7d93d63ce661025a9a1f6254c0dee1775588 /plugins/base/src/test
parentc745f96781522f4b126e64cb6c2bc1b249694d0d (diff)
downloaddokka-3be4dd94e3af2e749969ba352482eae6957cac5a.tar.gz
dokka-3be4dd94e3af2e749969ba352482eae6957cac5a.tar.bz2
dokka-3be4dd94e3af2e749969ba352482eae6957cac5a.zip
[K2] Reorganize project model for MPP (#3236)
* Reorganize project model for MPP We map Dokka's source set directly to a source module of Analysis API inside one Analysis Standalone session. Analysis API session is created in src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/symbols/plugin/KotlinAnalysis.kt (see fun createAnalysisSession) Before the PR, one Dokka's source set corresponded to one Standalone API session with one source module that has source roots from dependent source sets. * Add 'caffeine' dependency from Analysis API * Fix sample provider * Fix tests * Enable tests and update the version of Analysis API. The PR allows the enabling of some tests annotated with OnlyDescriptorsMPP. Also, tests with OnlyDescriptorsMPP that have unresolved common symbols are fixed by the new version of Analysis API.
Diffstat (limited to 'plugins/base/src/test')
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt95
-rw-r--r--plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt1
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt1
-rw-r--r--plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt9
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt11
-rw-r--r--plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt2
9 files changed, 93 insertions, 34 deletions
diff --git a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt
index 4cb25704..6ee95bbd 100644
--- a/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/SinceKotlinTest.kt
@@ -14,10 +14,7 @@ import org.jetbrains.dokka.model.doc.CustomTagWrapper
import org.jetbrains.dokka.model.doc.Text
import org.jetbrains.dokka.pages.ContentPage
import signatures.AbstractRenderingTest
-import utils.ParamAttributes
-import utils.TestOutputWriterPlugin
-import utils.assertNotNull
-import utils.bareSignature
+import utils.*
import kotlin.test.*
@@ -125,30 +122,58 @@ class SinceKotlinTest : AbstractRenderingTest() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/jvm/")
analysisPlatform = "jvm"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/native/")
analysisPlatform = "native"
+ name = "native"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/common/")
analysisPlatform = "common"
+ name = "common"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/js/")
analysisPlatform = "js"
+ name = "js"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/wasm/")
analysisPlatform = "wasm"
+ name = "wasm"
}
}
}
testInline(
"""
- |/src/main/kotlin/test/source.kt
+ |/src/jvm/kotlin/test/source.kt
+ |package test
+ |
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/native/kotlin/test/source.kt
+ |package test
+ |
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/common/kotlin/test/source.kt
+ |package test
+ |
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/js/kotlin/test/source.kt
+ |package test
+ |
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/wasm/kotlin/test/source.kt
|package test
|
|fun ring(abc: String): String {
@@ -185,33 +210,69 @@ class SinceKotlinTest : AbstractRenderingTest() {
val configuration = dokkaConfiguration {
sourceSets {
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/jvm/")
classpath = listOfNotNull(jvmStdlibPath)
analysisPlatform = "jvm"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/native/")
analysisPlatform = "native"
+ name = "native"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/common/")
classpath = listOfNotNull(commonStdlibPath)
analysisPlatform = "common"
+ name = "common"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/js/")
classpath = listOfNotNull(jsStdlibPath)
analysisPlatform = "js"
+ name = "js"
}
sourceSet {
- sourceRoots = listOf("src/")
+ sourceRoots = listOf("src/wasm/")
analysisPlatform = "wasm"
+ name = "wasm"
}
}
}
testInline(
"""
- |/src/main/kotlin/test/source.kt
+ |/src/jvm/kotlin/test/source.kt
+ |package test
+ |
+ |/** dssdd */
+ |@SinceKotlin("1.3")
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/native/kotlin/test/source.kt
+ |package test
+ |
+ |/** dssdd */
+ |@SinceKotlin("1.3")
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/common/kotlin/test/source.kt
+ |package test
+ |
+ |/** dssdd */
+ |@SinceKotlin("1.3")
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/js/kotlin/test/source.kt
+ |package test
+ |
+ |/** dssdd */
+ |@SinceKotlin("1.3")
+ |fun ring(abc: String): String {
+ | return "My precious " + abc
+ |}
+ |/src/wasm/kotlin/test/source.kt
|package test
|
|/** dssdd */
@@ -238,7 +299,7 @@ class SinceKotlinTest : AbstractRenderingTest() {
find { it.sourceSets.first().analysisPlatform == i.key }?.documentation?.values?.first()
?.dfs { it is CustomTagWrapper && it.name == "Since Kotlin" }
.assertNotNull("SinceKotlin[${i.key}]")
- assertEquals((tag.children.first() as Text).body, i.value.toString())
+ assertEquals(i.value.toString(), (tag.children.first() as Text).body , "Platform ${i.key}")
}
}
}
diff --git a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
index 9a9fd8b4..22becb93 100644
--- a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
+++ b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
@@ -339,7 +339,6 @@ class ContentForExceptions : BaseAbstractTest() {
}
}
- @OnlyDescriptorsMPP("Return type for native `function` should be null rather than kotlin/Unit")
@Test
fun `throws in merged functions`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index 2790d8b6..fb72178b 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -759,7 +759,6 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
}
- @OnlyDescriptorsMPP
@Test
fun `multiplatform class with seealso in few platforms`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
index 504a1ebe..1b73ffee 100644
--- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
+++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
@@ -20,12 +20,11 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
-import utils.OnlyDescriptors
import utils.OnlyDescriptorsMPP
class LinkableContentTest : BaseAbstractTest() {
- @OnlyDescriptorsMPP
+ @OnlyDescriptorsMPP("#3238")
@Test
fun `Include module and package documentation`() {
@@ -151,7 +150,7 @@ class LinkableContentTest : BaseAbstractTest() {
}
}
- @OnlyDescriptorsMPP
+ @OnlyDescriptorsMPP("#3238")
@Test
fun `Samples multiplatform documentation`() {
@@ -286,7 +285,7 @@ class LinkableContentTest : BaseAbstractTest() {
sourceSets {
sourceSet {
analysisPlatform = "js"
- sourceRoots = listOf("jsMain", "commonMain", "jvmAndJsSecondCommonMain").map {
+ sourceRoots = listOf("jsMain").map {
Paths.get("$testDataDir/$it/kotlin").toString()
}
name = "js"
@@ -294,7 +293,7 @@ class LinkableContentTest : BaseAbstractTest() {
}
sourceSet {
analysisPlatform = "jvm"
- sourceRoots = listOf("jvmMain", "commonMain", "jvmAndJsSecondCommonMain").map {
+ sourceRoots = listOf("jvmMain").map {
Paths.get("$testDataDir/$it/kotlin").toString()
}
name = "jvm"
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
index 5c8e7c74..459dd9ac 100644
--- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
@@ -60,15 +60,22 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
fun multiplatform() {
val configuration = dokkaConfiguration {
sourceSets {
+ val commonSourceSet = sourceSet {
+ name = "common"
+ sourceRoots = listOf("common/src/")
+ analysisPlatform = "common"
+ }
sourceSet {
name = "jvm"
- sourceRoots = listOf("common/src/", "jvm/src/")
+ sourceRoots = listOf("jvm/src/")
analysisPlatform = "jvm"
+ dependentSourceSets = setOf(commonSourceSet.value.sourceSetID)
}
sourceSet {
name = "js"
- sourceRoots = listOf("common/src/", "js/src/")
+ sourceRoots = listOf("js/src/")
analysisPlatform = "js"
+ dependentSourceSets = setOf(commonSourceSet.value.sourceSetID)
}
}
}
diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
index 45a5523f..509dd6e7 100644
--- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
@@ -7,10 +7,8 @@ package signatures
import utils.TestOutputWriterPlugin
import kotlin.test.Test
import kotlin.test.assertEquals
-import utils.OnlyDescriptors
-import utils.OnlyDescriptorsMPP
-@OnlyDescriptorsMPP
+
class DivergentSignatureTest : AbstractRenderingTest() {
@Test
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index 37efd6df..80a043fe 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -555,7 +555,6 @@ class SignatureTest : BaseAbstractTest() {
}
}
}
- @OnlyDescriptorsMPP
@Test
fun `actual typealias should have generic parameters and fully qualified name of the expansion type`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -590,7 +589,6 @@ class SignatureTest : BaseAbstractTest() {
}
}
- @OnlyDescriptorsMPP
@Test
fun `type with an actual typealias`() {
val writerPlugin = TestOutputWriterPlugin()
diff --git a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
index 85ba5ba4..54f0120a 100644
--- a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
@@ -15,7 +15,7 @@ import kotlin.test.assertEquals
class ModuleAndPackageDocumentationTransformerFunctionalTest : BaseAbstractTest() {
- @OnlyDescriptorsMPP
+ @OnlyDescriptorsMPP("#3238")
@Test
fun `multiplatform project`(@TempDir tempDir: Path) {
val include = tempDir.resolve("include.md").toFile()
diff --git a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
index c23a0885..87424120 100644
--- a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
@@ -9,7 +9,6 @@ import org.jetbrains.dokka.SourceLinkDefinitionImpl
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jsoup.nodes.Element
import signatures.renderedContent
-import utils.OnlyDescriptorsMPP
import utils.TestOutputWriterPlugin
import java.net.URL
import kotlin.test.Test
@@ -71,7 +70,6 @@ class SourceLinkTransformerTest : BaseAbstractTest() {
}
}
- @OnlyDescriptorsMPP
@Test
fun `source link should be for actual typealias`() {
val mppConfiguration = dokkaConfiguration {