peterreilly 2004/06/08 09:20:29 Modified: . Tag: ANT_16_BRANCH WHATSNEW src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH Delete.java docs/manual/CoreTasks Tag: ANT_16_BRANCH delete.html Log: sync Revision Changes Path No revision No revision 1.503.2.101 +4 -1 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.503.2.100 retrieving revision 1.503.2.101 diff -u -r1.503.2.100 -r1.503.2.101 --- WHATSNEW 7 Jun 2004 12:28:47 -0000 1.503.2.100 +++ WHATSNEW 8 Jun 2004 16:20:28 -0000 1.503.2.101 @@ -94,7 +94,8 @@ * JDependTask did not close an output file. Bugzilla Report 28557. -* Using <macrodef> could break XmlLogger. Bugzilla Report 28993. +* Using <macrodef> could break XmlLogger. Bugzilla Report 28993 +. * <genkey> no longer requires keytool to be in your PATH. Bugzilla Report 29382. @@ -179,6 +180,8 @@ DynamicConfigurator. Bugzilla Report 28436. * Add implicit nested element to <macrodef>. Bugzilla Report 25633. + +* Add deleteonexit attribute to <delete>. Changes from Ant 1.6.0 to Ant 1.6.1 ============================================= No revision No revision 1.47.2.6 +21 -2 ant/src/main/org/apache/tools/ant/taskdefs/Delete.java Index: Delete.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Delete.java,v retrieving revision 1.47.2.5 retrieving revision 1.47.2.6 diff -u -r1.47.2.5 -r1.47.2.6 --- Delete.java 20 Apr 2004 22:15:19 -0000 1.47.2.5 +++ Delete.java 8 Jun 2004 16:20:28 -0000 1.47.2.6 @@ -69,6 +69,7 @@ private int verbosity = Project.MSG_VERBOSE; private boolean quiet = false; private boolean failonerror = true; + private boolean deleteOnExit = false; /** * Set the name of a single file to be removed. @@ -126,6 +127,16 @@ this.failonerror = failonerror; } + /** + * If true, on failure to delete, note the error and set + * the deleteonexit flag, and continue + * + * @param deleteOnExit true or false + */ + public void setDeleteOnExit(boolean deleteOnExit) { + this.deleteOnExit = deleteOnExit; + } + /** * If true, delete empty directories. @@ -540,9 +551,17 @@ } try { Thread.sleep(DELETE_RETRY_SLEEP_MILLIS); - return f.delete(); } catch (InterruptedException ex) { - return f.delete(); + // Ignore Exception + } + if (!f.delete()) { + if (deleteOnExit) { + int level = quiet ? Project.MSG_VERBOSE : Project.MSG_INFO; + log("Failed to delete " + f + ", calling deleteOnExit" + f, level); + f.deleteOnExit(); + return true; + } + return false; } } return true; No revision No revision 1.18.2.3 +10 -0 ant/docs/manual/CoreTasks/delete.html Index: delete.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/delete.html,v retrieving revision 1.18.2.2 retrieving revision 1.18.2.3 diff -u -r1.18.2.2 -r1.18.2.3 --- delete.html 9 Feb 2004 22:12:07 -0000 1.18.2.2 +++ delete.html 8 Jun 2004 16:20:28 -0000 1.18.2.3 @@ -131,6 +131,16 @@ Default excludes are used when omitted.</td> <td valign="top" align="center">No</td> </tr> + <tr> + <td valign="top">deleteonexit</td> + <td valign="top"> + Indicates whether to use File#deleteOnExit() if there is a + failure to delete a file, this causes the jvm to attempt + to delete the file when the jvm process is terminating. + The default is false. + <em>Since Ant 1.6.2</em> + <td valign="top" align="center">No</td> + </tr> </table> <h3>Examples</h3> <pre> <delete file="/lib/ant.jar"/></pre>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]