[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 jsCommonDir = "${projectDir}/../js"
|
||||||
val jsCommonSrcDir = "${jsCommonDir}/src"
|
val jsCommonSrcDir = "${jsCommonDir}/src"
|
||||||
|
val jsCommonTestSrcDir = "${jsCommonDir}/test"
|
||||||
val jsV1Dir = "${projectDir}/../js-v1"
|
val jsV1Dir = "${projectDir}/../js-v1"
|
||||||
val jsSrcDir = "$jsV1Dir/src"
|
val jsSrcDir = "$jsV1Dir/src"
|
||||||
val jsSrcJsDir = "${jsSrcDir}/js"
|
val jsSrcJsDir = "${jsSrcDir}/js"
|
||||||
@@ -48,6 +49,7 @@ val jsSrcJsDir = "${jsSrcDir}/js"
|
|||||||
// for js-ir
|
// for js-ir
|
||||||
val jsIrDir = "${projectDir}/../js-ir"
|
val jsIrDir = "${projectDir}/../js-ir"
|
||||||
val jsIrMainSources = "${buildDir}/src/jsMainSources"
|
val jsIrMainSources = "${buildDir}/src/jsMainSources"
|
||||||
|
val jsIrTestSources = "${buildDir}/src/jsTestSources"
|
||||||
lateinit var jsIrTarget: KotlinJsTargetDsl
|
lateinit var jsIrTarget: KotlinJsTargetDsl
|
||||||
|
|
||||||
kotlin {
|
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) {
|
js(LEGACY) {
|
||||||
browser {
|
browser {
|
||||||
}
|
}
|
||||||
nodejs {
|
nodejs {
|
||||||
|
testTask {
|
||||||
|
useMocha {
|
||||||
|
timeout = "10s"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
compilations {
|
compilations {
|
||||||
all {
|
all {
|
||||||
@@ -108,9 +128,15 @@ kotlin {
|
|||||||
sourceMap = true
|
sourceMap = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val test by getting; test.apply {
|
||||||
|
kotlinOptions {
|
||||||
|
moduleKind = "umd"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsIrTarget = js("jsIr", IR) {
|
jsIrTarget = js("jsIr", IR) {
|
||||||
|
browser {}
|
||||||
nodejs {
|
nodejs {
|
||||||
testTask {
|
testTask {
|
||||||
useMocha {
|
useMocha {
|
||||||
@@ -145,6 +171,16 @@ kotlin {
|
|||||||
srcDir("../unsigned/src")
|
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 {
|
val jvmMain by getting {
|
||||||
project.configurations.getByName("jvmMainCompileOnly").extendsFrom(configurationBuiltins)
|
project.configurations.getByName("jvmMainCompileOnly").extendsFrom(configurationBuiltins)
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -159,6 +195,20 @@ kotlin {
|
|||||||
project.sourceSets["main"].java.srcDirs(*jvmSrcDirs)
|
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 {
|
val jsRuntime by getting {
|
||||||
kotlin.apply {
|
kotlin.apply {
|
||||||
srcDir(builtinsRuntimeSrcDir)
|
srcDir(builtinsRuntimeSrcDir)
|
||||||
@@ -216,6 +266,15 @@ kotlin {
|
|||||||
dependsOn(prepareBuiltinsSources)
|
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 {
|
val jsIrMain by getting {
|
||||||
kotlin.apply {
|
kotlin.apply {
|
||||||
@@ -278,6 +337,19 @@ kotlin {
|
|||||||
dependsOn(prepareJsIrMainSources)
|
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 {
|
all {
|
||||||
languageSettings {
|
languageSettings {
|
||||||
@@ -287,6 +359,10 @@ kotlin {
|
|||||||
optIn("kotlin.ExperimentalMultiplatform")
|
optIn("kotlin.ExperimentalMultiplatform")
|
||||||
optIn("kotlin.contracts.ExperimentalContracts")
|
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)
|
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()
|
configureDefaultPublishing()
|
||||||
Reference in New Issue
Block a user