[stdlib-mpp] Setup JVM, JS-IR and JS-legacy unit tests
The latter do not work for now #KT-56106
This commit is contained in:
committed by
Space Team
parent
79d5c87f30
commit
46cee9d0a3
@@ -41,6 +41,7 @@ val builtinsRuntimeSrcDir = "${buildDir}/src/builtin-sources-for-runtime"
|
||||
|
||||
val jsCommonDir = "${projectDir}/../js"
|
||||
val jsCommonSrcDir = "${jsCommonDir}/src"
|
||||
val jsCommonTestSrcDir = "${jsCommonDir}/test"
|
||||
val jsV1Dir = "${projectDir}/../js-v1"
|
||||
val jsSrcDir = "$jsV1Dir/src"
|
||||
val jsSrcJsDir = "${jsSrcDir}/js"
|
||||
@@ -48,6 +49,7 @@ val jsSrcJsDir = "${jsSrcDir}/js"
|
||||
// for js-ir
|
||||
val jsIrDir = "${projectDir}/../js-ir"
|
||||
val jsIrMainSources = "${buildDir}/src/jsMainSources"
|
||||
val jsIrTestSources = "${buildDir}/src/jsTestSources"
|
||||
lateinit var jsIrTarget: KotlinJsTargetDsl
|
||||
|
||||
kotlin {
|
||||
@@ -76,12 +78,30 @@ kotlin {
|
||||
)
|
||||
}
|
||||
}
|
||||
val test by getting {
|
||||
kotlinOptions {
|
||||
// This is needed for JavaTypeTest; typeOf for non-reified type parameters doesn't work otherwise, for implementation reasons.
|
||||
freeCompilerArgs -= "-Xno-optimized-callable-references"
|
||||
}
|
||||
}
|
||||
val longRunningTest by creating {
|
||||
defaultSourceSet {
|
||||
dependencies {
|
||||
implementation(main.output.allOutputs)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
js(LEGACY) {
|
||||
browser {
|
||||
}
|
||||
nodejs {
|
||||
testTask {
|
||||
useMocha {
|
||||
timeout = "10s"
|
||||
}
|
||||
}
|
||||
}
|
||||
compilations {
|
||||
all {
|
||||
@@ -108,9 +128,15 @@ kotlin {
|
||||
sourceMap = true
|
||||
}
|
||||
}
|
||||
val test by getting; test.apply {
|
||||
kotlinOptions {
|
||||
moduleKind = "umd"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
jsIrTarget = js("jsIr", IR) {
|
||||
browser {}
|
||||
nodejs {
|
||||
testTask {
|
||||
useMocha {
|
||||
@@ -145,6 +171,16 @@ kotlin {
|
||||
srcDir("../unsigned/src")
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
dependencies {
|
||||
// compileOnly(project(":kotlin-test:kotlin-test-common"))
|
||||
// compileOnly(project(":kotlin-test:kotlin-test-annotations-common"))
|
||||
}
|
||||
kotlin.apply {
|
||||
srcDir("../common/test")
|
||||
srcDir("../test")
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
project.configurations.getByName("jvmMainCompileOnly").extendsFrom(configurationBuiltins)
|
||||
dependencies {
|
||||
@@ -159,6 +195,20 @@ kotlin {
|
||||
project.sourceSets["main"].java.srcDirs(*jvmSrcDirs)
|
||||
}
|
||||
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
api(project(":kotlin-test:kotlin-test-junit"))
|
||||
}
|
||||
kotlin.srcDir("../jvm/test")
|
||||
}
|
||||
|
||||
val jvmLongRunningTest by getting {
|
||||
dependencies {
|
||||
api(project(":kotlin-test:kotlin-test-junit"))
|
||||
}
|
||||
kotlin.srcDir("../jvm/testLongRunning")
|
||||
}
|
||||
|
||||
val jsRuntime by getting {
|
||||
kotlin.apply {
|
||||
srcDir(builtinsRuntimeSrcDir)
|
||||
@@ -216,6 +266,15 @@ kotlin {
|
||||
dependsOn(prepareBuiltinsSources)
|
||||
}
|
||||
}
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
api(project(":kotlin-test:kotlin-test-js-v1"))
|
||||
}
|
||||
kotlin.apply {
|
||||
srcDir(jsCommonTestSrcDir)
|
||||
srcDir("$jsV1Dir/test")
|
||||
}
|
||||
}
|
||||
|
||||
val jsIrMain by getting {
|
||||
kotlin.apply {
|
||||
@@ -278,6 +337,19 @@ kotlin {
|
||||
dependsOn(prepareJsIrMainSources)
|
||||
}
|
||||
}
|
||||
val jsIrTest by getting {
|
||||
kotlin.srcDir(jsIrTestSources)
|
||||
dependencies {
|
||||
api(project(":kotlin-test:kotlin-test-js-ir"))
|
||||
}
|
||||
val prepareJsIrTestSources by tasks.registering(Sync::class) {
|
||||
from(jsCommonTestSrcDir)
|
||||
into(jsIrTestSources)
|
||||
}
|
||||
jsIrTarget.compilations["test"].compileKotlinTaskProvider.configure {
|
||||
dependsOn(prepareJsIrTestSources)
|
||||
}
|
||||
}
|
||||
|
||||
all {
|
||||
languageSettings {
|
||||
@@ -287,6 +359,10 @@ kotlin {
|
||||
optIn("kotlin.ExperimentalMultiplatform")
|
||||
optIn("kotlin.contracts.ExperimentalContracts")
|
||||
}
|
||||
if (this@all.name.endsWith("Test")) {
|
||||
optIn("kotlin.ExperimentalUnsignedTypes")
|
||||
optIn("kotlin.ExperimentalStdlibApi")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,6 +502,17 @@ tasks {
|
||||
Files.copy(jsResultingJarFile.get().asFile.toPath(), archiveFile.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val jvmLongRunningTest by registering(Test::class) {
|
||||
val compilation = kotlin.jvm().compilations["longRunningTest"]
|
||||
classpath = compilation.compileDependencyFiles + compilation.runtimeDependencyFiles + compilation.output.allOutputs
|
||||
testClassesDirs = compilation.output.classesDirs
|
||||
}
|
||||
|
||||
if (project.hasProperty("kotlin.stdlib.test.long.running")) {
|
||||
check.configure { dependsOn(jvmLongRunningTest) }
|
||||
}
|
||||
}
|
||||
|
||||
configureDefaultPublishing()
|
||||
Reference in New Issue
Block a user