Use absolute path for temporary directory in tests (#52228)
We explicitly set the path for the temporary directory to use in test tasks, but today this path is a relative path, relative to the current working directory of the test task. The fact that we are using a relative path here appears to be legacy, simply leftover from the days of the Maven build. An absolute path is preferred here, since it's explicit and we do not have to rely on everyone resolving the path properly relative to the working directory.
This commit is contained in:
parent
6ed3311443
commit
bb2e04bc16
|
@ -732,9 +732,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
test.jvmArgs '-ea', '-esa'
|
||||
}
|
||||
|
||||
// we use './temp' since this is per JVM and tests are forbidden from writing to CWD
|
||||
test.systemProperties 'gradle.dist.lib': new File(project.class.location.toURI()).parent,
|
||||
'java.io.tmpdir': './temp',
|
||||
'java.awt.headless': 'true',
|
||||
'tests.gradle': 'true',
|
||||
'tests.artifact': project.name,
|
||||
|
@ -742,7 +740,6 @@ class BuildPlugin implements Plugin<Project> {
|
|||
'tests.security.manager': 'true',
|
||||
'jna.nosys': 'true'
|
||||
|
||||
|
||||
// ignore changing test seed when build is passed -Dignore.tests.seed for cacheability experimentation
|
||||
if (System.getProperty('ignore.tests.seed') != null) {
|
||||
nonInputProperties.systemProperty('tests.seed', BuildParams.testSeed)
|
||||
|
@ -753,6 +750,8 @@ class BuildPlugin implements Plugin<Project> {
|
|||
// don't track these as inputs since they contain absolute paths and break cache relocatability
|
||||
nonInputProperties.systemProperty('gradle.worker.jar', "${project.gradle.getGradleUserHomeDir()}/caches/${project.gradle.gradleVersion}/workerMain/gradle-worker.jar")
|
||||
nonInputProperties.systemProperty('gradle.user.home', project.gradle.getGradleUserHomeDir())
|
||||
// we use 'temp' relative to CWD since this is per JVM and tests are forbidden from writing to CWD
|
||||
nonInputProperties.systemProperty('java.io.tmpdir', test.workingDir.toPath().resolve('temp'))
|
||||
|
||||
nonInputProperties.systemProperty('compiler.java', "${-> BuildParams.compilerJavaVersion.majorVersion}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue