Specify common sources for stdlib test compilation tasks

Some multiplatform tests are compiled in single-platform projects:
- in kotlin-stdlib-jdk7
- in kotlin-stdlib-jdk8
- in kotlin-stdlib-js-ir. The latter is technically MPP but with a
single platform, so its common sources are not considered as common.

Pass information about common sources to test compilation tasks in order
to use OptionalExpectation annotations there.

Co-authored-by: Svyatoslav Scherbina <svyatoslav.scherbina@jetbrains.com>
This commit is contained in:
Ilya Gorbunov
2020-12-11 13:53:47 +03:00
committed by Svyatoslav Scherbina
parent c094d77794
commit 8f4e4a4d40
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -90,6 +90,7 @@ compileTestKotlin {
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.io.path.ExperimentalPathApi",
"-Xcommon-sources=${fileTree('../test').join(',')}",
]
}
+1
View File
@@ -82,6 +82,7 @@ compileTestKotlin {
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.io.path.ExperimentalPathApi",
"-Xcommon-sources=${fileTree('../test').join(',')}",
]
}
+9
View File
@@ -149,6 +149,15 @@ val compileKotlinJs by tasks.existing(KotlinCompile::class) {
kotlinOptions.freeCompilerArgs += "-Xir-module-name=kotlin"
}
val compileTestKotlinJs by tasks.existing(KotlinCompile::class) {
doFirst {
// Note: common test sources are copied to the actual source directory by commonMainSources task,
// so can't do this at configuration time:
kotlinOptions.freeCompilerArgs += "-Xcommon-sources=${kotlin.sourceSets["commonTest"].kotlin.joinToString(",")}"
}
}
val packFullRuntimeKLib by tasks.registering(Jar::class) {
dependsOn(compileKotlinJs)
from(buildDir.resolve("classes/kotlin/js/main"))