Explicitly define the set of environment variables needed for tests
This commit is contained in:
@@ -107,6 +107,7 @@ fun Project.projectTest(
|
||||
maxHeapSizeMb: Int? = null,
|
||||
minHeapSizeMb: Int? = null,
|
||||
reservedCodeCacheSizeMb: Int = 256,
|
||||
defineJDKEnvVariables: List<JdkMajorVersion> = emptyList(),
|
||||
body: Test.() -> Unit = {}
|
||||
): TaskProvider<Test> {
|
||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||
@@ -249,10 +250,9 @@ fun Project.projectTest(
|
||||
?: forks.coerceIn(1, Runtime.getRuntime().availableProcessors())
|
||||
}
|
||||
|
||||
JdkMajorVersion.values().forEach { version ->
|
||||
project.getToolchainLauncherFor(version).orNull?.let {
|
||||
environment(version.envName, it.metadata.installationPath.asFile.absolutePath)
|
||||
}
|
||||
defineJDKEnvVariables.forEach { version ->
|
||||
val javaLauncher = project.getToolchainLauncherFor(version).orNull ?: error("Can't find toolchain for $version")
|
||||
environment(version.envName, javaLauncher.metadata.installationPath.asFile.absolutePath)
|
||||
}
|
||||
}.apply { configure(body) }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import java.io.File
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
@@ -52,7 +50,10 @@ sourceSets {
|
||||
}
|
||||
}
|
||||
|
||||
projectTest(parallel = true) {
|
||||
projectTest(
|
||||
parallel = true,
|
||||
defineJDKEnvVariables = listOf(JdkMajorVersion.JDK_1_8, JdkMajorVersion.JDK_11_0, JdkMajorVersion.JDK_17_0)
|
||||
) {
|
||||
dependsOn(":dist")
|
||||
|
||||
workingDir = rootDir
|
||||
|
||||
Reference in New Issue
Block a user