build: better tests isolation set USERPROFILE and HOME environment variables
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/3b69830d Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/3b69830d Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/3b69830d Branch: refs/heads/develop Commit: 3b69830d13e8d0f3affe2b1c480143f304ec9edd Parents: e504fe4 Author: Paul Merlin <[email protected]> Authored: Sat Nov 19 21:25:57 2016 +0100 Committer: Paul Merlin <[email protected]> Committed: Sat Nov 19 21:25:57 2016 +0100 ---------------------------------------------------------------------- .../org/apache/zest/gradle/AllProjectsPlugin.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/3b69830d/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy index 82441f2..0c700bc 100644 --- a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy @@ -131,9 +131,15 @@ class AllProjectsPlugin implements Plugin<Project> def tmpDir = new File( testDir, 'tmp' ) def homeDir = new File( testDir, 'home' ) testTask.workingDir = workDir - testTask.systemProperties[ 'user.dir' ] = workDir - testTask.systemProperties[ 'java.io.tmpdir' ] = tmpDir - testTask.systemProperties[ 'home.dir' ] = homeDir + testTask.systemProperties << ( [ + 'user.dir' : workDir.absolutePath, + 'java.io.tmpdir': tmpDir.absolutePath, + 'home.dir' : homeDir.absolutePath + ] as Map<String, Object> ) + testTask.environment << ( [ + 'HOME' : homeDir.absolutePath, + 'USERPROFILE': homeDir.absolutePath + ] as Map<String, Object> ) testTask.doFirst { Test task -> [ workDir, tmpDir, homeDir ]*.mkdirs() }
