Switch stdlib tests to KMP kotlin-test KT-61969
This commit is contained in:
committed by
Space Team
parent
7a4335b087
commit
f07bf70aa7
@@ -15,7 +15,7 @@ import plugins.publishing.*
|
|||||||
import kotlin.io.path.copyTo
|
import kotlin.io.path.copyTo
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("kotlin-multiplatform")
|
kotlin("multiplatform")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
}
|
}
|
||||||
@@ -299,11 +299,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
commonTest {
|
commonTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
// TODO: use project dependency when kotlin-test is migrated
|
api(kotlinTest())
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-test-common:$bootstrapKotlinVersion")
|
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-test-annotations-common:$bootstrapKotlinVersion")
|
|
||||||
// compileOnly(project(":kotlin-test:kotlin-test-common"))
|
|
||||||
// compileOnly(project(":kotlin-test:kotlin-test-annotations-common"))
|
|
||||||
}
|
}
|
||||||
kotlin {
|
kotlin {
|
||||||
srcDir("common/test")
|
srcDir("common/test")
|
||||||
@@ -340,7 +336,7 @@ kotlin {
|
|||||||
optIn("kotlin.io.path.ExperimentalPathApi")
|
optIn("kotlin.io.path.ExperimentalPathApi")
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kotlin-test:kotlin-test-junit"))
|
api(kotlinTest("junit"))
|
||||||
}
|
}
|
||||||
kotlin.srcDir("jvm/test")
|
kotlin.srcDir("jvm/test")
|
||||||
kotlin.srcDir("jdk7/test")
|
kotlin.srcDir("jdk7/test")
|
||||||
@@ -349,7 +345,7 @@ kotlin {
|
|||||||
|
|
||||||
val jvmLongRunningTest by getting {
|
val jvmLongRunningTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kotlin-test:kotlin-test-junit"))
|
api(kotlinTest("junit"))
|
||||||
}
|
}
|
||||||
kotlin.srcDir("jvm/testLongRunning")
|
kotlin.srcDir("jvm/testLongRunning")
|
||||||
}
|
}
|
||||||
@@ -416,9 +412,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsTest by getting {
|
val jsTest by getting {
|
||||||
dependencies {
|
|
||||||
api(project(":kotlin-test:kotlin-test-js-ir"))
|
|
||||||
}
|
|
||||||
kotlin.srcDir("${jsDir}/test")
|
kotlin.srcDir("${jsDir}/test")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,9 +486,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
val wasmJsTest by getting {
|
val wasmJsTest by getting {
|
||||||
dependsOn(wasmCommonTest)
|
dependsOn(wasmCommonTest)
|
||||||
dependencies {
|
|
||||||
api(project(":kotlin-test:kotlin-test-wasm-js"))
|
|
||||||
}
|
|
||||||
kotlin {
|
kotlin {
|
||||||
srcDir("wasm/js/test")
|
srcDir("wasm/js/test")
|
||||||
}
|
}
|
||||||
@@ -512,9 +502,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
val wasmWasiTest by getting {
|
val wasmWasiTest by getting {
|
||||||
dependsOn(wasmCommonTest)
|
dependsOn(wasmCommonTest)
|
||||||
dependencies {
|
|
||||||
api(project(":kotlin-test:kotlin-test-wasm-wasi"))
|
|
||||||
}
|
|
||||||
kotlin {
|
kotlin {
|
||||||
srcDir("wasm/wasi/test")
|
srcDir("wasm/wasi/test")
|
||||||
}
|
}
|
||||||
@@ -724,6 +711,7 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val jvmLongRunningTest by registering(Test::class) {
|
val jvmLongRunningTest by registering(Test::class) {
|
||||||
|
group = "verification"
|
||||||
val compilation = kotlin.jvm().compilations["longRunningTest"]
|
val compilation = kotlin.jvm().compilations["longRunningTest"]
|
||||||
classpath = compilation.compileDependencyFiles + compilation.runtimeDependencyFiles + compilation.output.allOutputs
|
classpath = compilation.compileDependencyFiles + compilation.runtimeDependencyFiles + compilation.output.allOutputs
|
||||||
testClassesDirs = compilation.output.classesDirs
|
testClassesDirs = compilation.output.classesDirs
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ sourceSets {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':kotlin-stdlib')
|
api project(':kotlin-stdlib')
|
||||||
testApi project(':kotlin-test:kotlin-test-junit')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ RepoArtifacts.javadocJar(project)
|
|||||||
dependencies {
|
dependencies {
|
||||||
api project(':kotlin-stdlib')
|
api project(':kotlin-stdlib')
|
||||||
api project(':kotlin-stdlib-jdk7')
|
api project(':kotlin-stdlib-jdk7')
|
||||||
testApi project(':kotlin-test:kotlin-test-junit')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -37,7 +36,7 @@ dependencies {
|
|||||||
moduleTestApi project(':kotlin-stdlib')
|
moduleTestApi project(':kotlin-stdlib')
|
||||||
moduleTestApi project(':kotlin-stdlib-jdk7')
|
moduleTestApi project(':kotlin-stdlib-jdk7')
|
||||||
moduleTestCompileOnly project
|
moduleTestCompileOnly project
|
||||||
moduleTestApi project(':kotlin-test:kotlin-test-junit')
|
moduleTestApi RepoDependencies.kotlinTest(project, "junit")
|
||||||
moduleTestApi "org.ow2.asm:asm:9.0"
|
moduleTestApi "org.ow2.asm:asm:9.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ apply plugin: 'kotlin'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':kotlin-stdlib-jdk8')
|
api project(':kotlin-stdlib-jdk8')
|
||||||
testApi project(':kotlin-test:kotlin-test-junit')
|
testApi RepoDependencies.kotlinTest(project, "junit")
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -61,6 +61,37 @@ fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): An
|
|||||||
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
|
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this function to declare a dependency on kotlin-test project artifacts.
|
||||||
|
*
|
||||||
|
* It creates either a project dependency or a binary dependency on bootstrap artifacts when JPS build is imported.
|
||||||
|
*
|
||||||
|
* @param suffix Supported suffixes are:
|
||||||
|
* - `null` for the default project dependency, variant is resolved by attributes
|
||||||
|
* - `junit`, `junit5`, `testng` - jvm variants with annotation typealiases for different test frameworks,
|
||||||
|
* - `js` - js variant with assertions and annotations
|
||||||
|
* @param classifier Supported classifiers are: `null` for the runtime artifact, `sources` for the sources jar artifact
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
fun Project.kotlinTest(suffix: String? = null, classifier: String? = null): Any {
|
||||||
|
return run {
|
||||||
|
val elementsType = when (classifier) {
|
||||||
|
null -> "Runtime"
|
||||||
|
"sources" -> "Sources"
|
||||||
|
else -> error("Unsupported kotlin-test classifier: $classifier")
|
||||||
|
}
|
||||||
|
val configuration = when (suffix?.lowercase()) {
|
||||||
|
null -> classifier?.let { "jvm${elementsType}Elements" }
|
||||||
|
"junit" -> "jvmJUnit${elementsType}Elements"
|
||||||
|
"junit5" -> "jvmJUnit5${elementsType}Elements"
|
||||||
|
"testng" -> "jvmTestNG${elementsType}Elements"
|
||||||
|
"js" -> "js${elementsType}Elements"
|
||||||
|
else -> error("Unsupported kotlin-test flavor: $suffix")
|
||||||
|
}
|
||||||
|
dependencies.project(":kotlin-test", configuration)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun Project.kotlinBuiltins(): Any = kotlinBuiltins(forJvm = false)
|
fun Project.kotlinBuiltins(): Any = kotlinBuiltins(forJvm = false)
|
||||||
|
|
||||||
fun Project.kotlinBuiltins(forJvm: Boolean): Any =
|
fun Project.kotlinBuiltins(forJvm: Boolean): Any =
|
||||||
|
|||||||
Reference in New Issue
Block a user