Setup JRE version for codegen tests
Add camelCase task name aliases for codegen tests
This commit is contained in:
@@ -82,36 +82,47 @@ projectTest {
|
|||||||
|
|
||||||
evaluationDependsOn(":compiler:tests-common-jvm6")
|
evaluationDependsOn(":compiler:tests-common-jvm6")
|
||||||
|
|
||||||
fun Project.codegenTest(taskName: String, body: Test.() -> Unit): Test = projectTest(taskName) {
|
fun Project.codegenTest(taskName: String, jdk: String, body: Test.() -> Unit): Test = projectTest(taskName) {
|
||||||
dependsOn(*testDistProjects.map { "$it:dist" }.toTypedArray())
|
dependsOn(*testDistProjects.map { "$it:dist" }.toTypedArray())
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
environment("TEST_SERVER_CLASSES_DIRS", project(":compiler:tests-common-jvm6").the<JavaPluginConvention>().sourceSets.getByName("main").output.classesDirs.asPath)
|
environment("TEST_SERVER_CLASSES_DIRS", project(":compiler:tests-common-jvm6").the<JavaPluginConvention>().sourceSets.getByName("main").output.classesDirs.asPath)
|
||||||
filter.includeTestsMatching("org.jetbrains.kotlin.codegen.CodegenJdkCommonTestSuite*")
|
filter.includeTestsMatching("org.jetbrains.kotlin.codegen.CodegenJdkCommonTestSuite*")
|
||||||
|
|
||||||
|
if (jdk == "JDK_9") {
|
||||||
|
jvmArgs = listOf("--add-opens", "java.desktop/javax.swing=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")
|
||||||
|
}
|
||||||
body()
|
body()
|
||||||
|
doFirst {
|
||||||
|
val jdkPath = project.property(jdk) ?: error("$jdk is not optional to run this test")
|
||||||
|
executable = "$jdkPath/bin/java"
|
||||||
|
println("Running test with $executable")
|
||||||
|
}
|
||||||
|
}.also {
|
||||||
|
task(taskName.replace(Regex("-[a-z]"), { it.value.takeLast(1).toUpperCase() })) {
|
||||||
|
dependsOn(it)
|
||||||
|
group = "verification"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest("codegen-target6-jvm6-test") {
|
codegenTest("codegen-target6-jvm6-test", "JDK_18") {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
||||||
systemProperty("kotlin.test.java.compilation.target", "1.6")
|
systemProperty("kotlin.test.java.compilation.target", "1.6")
|
||||||
systemProperty("kotlin.test.box.in.separate.process.port", "5100")
|
systemProperty("kotlin.test.box.in.separate.process.port", "5100")
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest("codegen-target6-jvm9-test") {
|
codegenTest("codegen-target6-jvm9-test", "JDK_9") {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
||||||
jvmArgs = listOf("--add-opens", "java.desktop/javax.swing=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest("codegen-target8-jvm8-test") {
|
codegenTest("codegen-target8-jvm8-test", "JDK_18") {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest("codegen-target8-jvm9-test") {
|
codegenTest("codegen-target8-jvm9-test", "JDK_9") {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
||||||
jvmArgs = listOf("--add-opens", "java.desktop/javax.swing=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest("codegen-target9-jvm9-test") {
|
codegenTest("codegen-target9-jvm9-test", "JDK_9") {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
systemProperty("kotlin.test.default.jvm.target", "1.8")
|
||||||
systemProperty("kotlin.test.substitute.bytecode.1.8.to.1.9", "true")
|
systemProperty("kotlin.test.substitute.bytecode.1.8.to.1.9", "true")
|
||||||
jvmArgs = listOf("--add-opens", "java.desktop/javax.swing=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user