From c99b33079f5cd10abf44645de85729fe35b82cda Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 31 Mar 2003 12:27:14 +0000 Subject: [PATCH] Add tempdir attribute to to control placement of temporary file. PR: 15454 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274351 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ docs/manual/OptionalTasks/junit.html | 9 ++++++++- .../tools/ant/taskdefs/optional/junit/JUnitTask.java | 11 +++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 2d075b1d8..0860cb681 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -196,6 +196,9 @@ Other changes: * now supports filtering and can check timestamps before overriding a file. Bugzilla Report 18166. +* has a new attribute tempdir that controls the placement of + temporary files. Bugzilla Report 15454. + Changes from Ant 1.5.2 to Ant 1.5.3 =================================== diff --git a/docs/manual/OptionalTasks/junit.html b/docs/manual/OptionalTasks/junit.html index 2da44b465..97288c6d9 100644 --- a/docs/manual/OptionalTasks/junit.html +++ b/docs/manual/OptionalTasks/junit.html @@ -142,6 +142,13 @@ elements).

formatters receive the output. No + + tempdir + Where Ant should place temporary files. + Since Ant 1.6. + No; default is the project's base + directory. +

By using the errorproperty and failureproperty @@ -479,7 +486,7 @@ aborted. Results are collected in files named ${reports.tests}.


-

Copyright © 2000-2002 Apache Software Foundation. All rights +

Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.

diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index a0e9ae425..8af441f1d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -174,6 +174,7 @@ public class JUnitTask extends Task { private Path antRuntimeClasses = null; private boolean showOutput = false; + private File tmpDir; /** * If true, smartly filter the stack frames of @@ -501,6 +502,15 @@ public class JUnitTask extends Task { .setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"); } + /** + * Where Ant should place temporary files. + * + * @since Ant 1.6 + */ + public void setTempdir(File tmpDir) { + this.tmpDir = tmpDir; + } + /** * Adds the jars or directories containing Ant, this task and * JUnit to the classpath - this should make the forked JVM work @@ -636,6 +646,7 @@ public class JUnitTask extends Task { // forked test File propsFile = FileUtils.newFileUtils().createTempFile("junit", ".properties", + tmpDir != null ? tmpDir : getProject().getBaseDir()); cmd.createArgument().setValue("propsfile=" + propsFile.getAbsolutePath());