[K/JS] Exclude kotlinx.serialization synthetic declarations from JsExport

^KT-57024 Fixed
This commit is contained in:
Artem Kobzar
2023-02-28 18:11:36 +00:00
committed by Space Team
parent 36ae6d1238
commit 50a462fed1
22 changed files with 359 additions and 49 deletions
@@ -1,3 +1,7 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsCompilerAttribute
import org.jetbrains.kotlin.gradle.targets.js.d8.D8RootPlugin
description = "Kotlin Serialization Compiler Plugin"
plugins {
@@ -5,6 +9,23 @@ plugins {
id("jps-compatible")
}
val d8Plugin = D8RootPlugin.apply(rootProject)
d8Plugin.version = v8Version
val jsonJsIrRuntimeForTests: Configuration by configurations.creating {
attributes {
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir)
}
}
val coreJsIrRuntimeForTests: Configuration by configurations.creating {
attributes {
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
attribute(KotlinJsCompilerAttribute.jsCompilerAttribute, KotlinJsCompilerAttribute.ir)
}
}
dependencies {
embedded(project(":kotlinx-serialization-compiler-plugin.common")) { isTransitive = false }
embedded(project(":kotlinx-serialization-compiler-plugin.k1")) { isTransitive = false }
@@ -22,6 +43,7 @@ dependencies {
testApi(projectTests(":compiler:tests-common-new"))
testApi(project(":compiler:fir:plugin-utils"))
testImplementation(projectTests(":generators:test-generator"))
testImplementation(projectTests(":js:js.tests"))
testApiJUnit5()
testImplementation(project(":kotlinx-serialization-compiler-plugin.common"))
@@ -33,6 +55,9 @@ dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
coreJsIrRuntimeForTests("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1") { isTransitive = false }
jsonJsIrRuntimeForTests("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") { isTransitive = false }
testRuntimeOnly(intellijCore())
testRuntimeOnly(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
testRuntimeOnly(project(":core:descriptors.runtime"))
@@ -59,6 +84,28 @@ testsJar()
projectTest(parallel = true, jUnitMode = JUnitMode.JUnit5) {
workingDir = rootDir
useJUnitPlatform()
setUpJsIrBoxTests()
}
val generateTests by generator("org.jetbrains.kotlinx.serialization.TestGeneratorKt")
fun Test.setUpJsIrBoxTests() {
dependsOn(d8Plugin.setupTaskProvider)
dependsOn(":kotlin-stdlib-js-ir:compileKotlinJs")
dependsOn(":kotlin-test:kotlin-test-js-ir:compileKotlinJs")
val localJsCoreRuntimeForTests: FileCollection = coreJsIrRuntimeForTests
val localJsJsonRuntimeForTests: FileCollection = jsonJsIrRuntimeForTests
val v8ExecutablePath = d8Plugin.requireConfigured().executablePath.absolutePath
doFirst {
systemProperty("javascript.engine.path.V8", v8ExecutablePath)
systemProperty("serialization.core.path", localJsCoreRuntimeForTests.asPath)
systemProperty("serialization.json.path", localJsJsonRuntimeForTests.asPath)
}
systemProperty("kotlin.js.test.root.out.dir", "$buildDir/")
systemProperty("kotlin.js.full.stdlib.path", "libraries/stdlib/js-ir/build/classes/kotlin/js/main")
systemProperty("kotlin.js.reduced.stdlib.path", "libraries/stdlib/js-ir-minimal-for-test/build/classes/kotlin/js/main")
systemProperty("kotlin.js.kotlin.test.path", "libraries/kotlin.test/js-ir/build/classes/kotlin/js/main")
}