Browse Source

Add tempdir attribute to <junit> 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
master
Stefan Bodewig 22 years ago
parent
commit
c99b33079f
3 changed files with 22 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +8
    -1
      docs/manual/OptionalTasks/junit.html
  3. +11
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

+ 3
- 0
WHATSNEW View File

@@ -196,6 +196,9 @@ Other changes:
* <concat> now supports filtering and can check timestamps before
overriding a file. Bugzilla Report 18166.

* <junit> 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
===================================



+ 8
- 1
docs/manual/OptionalTasks/junit.html View File

@@ -142,6 +142,13 @@ elements</a>).</p>
formatters receive the output.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">tempdir</td>
<td valign="top">Where Ant should place temporary files.
<em>Since Ant 1.6</em>.</td>
<td align="center" valign="top">No; default is the project's base
directory.</td>
</tr>
</table>

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

<hr>
<p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights
<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
Reserved.</p>
</body>
</html>

+ 11
- 0
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -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());


Loading…
Cancel
Save