aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/content
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/kotlin/content
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/kotlin/content')
-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
3 files changed, 78 insertions, 19 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(