mbenson 2004/06/16 09:41:38
Modified: . WHATSNEW
src/testcases/org/apache/tools/ant/taskdefs
ExecuteOnTest.java
src/etc/testcases/taskdefs/exec apply.xml
docs/manual/CoreTasks apply.html
src/main/org/apache/tools/ant/taskdefs ExecuteOn.java
Log:
Add ignoremissing attribute to <apply>.
PR: 29585
Revision Changes Path
1.624 +6 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.623
retrieving revision 1.624
diff -u -r1.623 -r1.624
--- WHATSNEW 14 Jun 2004 12:23:49 -0000 1.623
+++ WHATSNEW 16 Jun 2004 16:41:38 -0000 1.624
@@ -33,6 +33,10 @@
* A new base class DispatchTask has been added to facilitate elegant
creation of tasks with multiple actions.
+* <apply> has a new ignoremissing attribute (default true for BC)
+ which will allow nonexistent files specified via <filelist>s to
+ be passed to the executable. Bugzilla Report 29585.
+
Changes from Ant 1.6.1 to current Ant 1.6 CVS version
=====================================================
@@ -228,6 +232,8 @@
* Add implicit nested element to <macrodef>. Bugzilla Report 25633.
* Add deleteonexit attribute to <delete>.
+
+* Added Target.getIf/Unless(). Bugzilla Report 29320.
Changes from Ant 1.6.0 to Ant 1.6.1
=============================================
1.6 +4 -0
ant/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java
Index: ExecuteOnTest.java
===================================================================
RCS file:
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ExecuteOnTest.java 27 Mar 2004 21:22:59 -0000 1.5
+++ ExecuteOnTest.java 16 Jun 2004 16:41:38 -0000 1.6
@@ -550,6 +550,10 @@
assertNull("unexpected redirector.err content",
getFileString("redirector.err"));
}
+ public void testIgnoreMissing() {
+ executeTarget("ignoremissing");
+ }
+
//borrowed from TokenFilterTest
private String getFileString(String filename) throws IOException {
String result = null;
1.3 +41 -0 ant/src/etc/testcases/taskdefs/exec/apply.xml
Index: apply.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/exec/apply.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- apply.xml 27 Mar 2004 21:22:58 -0000 1.2
+++ apply.xml 16 Jun 2004 16:41:38 -0000 1.3
@@ -303,6 +303,47 @@
</apply>
</target>
+ <target name="ignoremissing">
+ <filelist id="xylist" dir="${basedir}" files="x,y" />
+ <filelist id="xyzlist" dir="${basedir}" files="x,y,z" />
+
+ <touch file="x" />
+ <touch file="y" />
+
+ <pathconvert property="xy" pathsep="${line.separator}">
+ <path>
+ <filelist refid="xylist" />
+ </path>
+ </pathconvert>
+
+ <pathconvert property="xyz" pathsep="${line.separator}">
+ <path>
+ <filelist refid="xyzlist" />
+ </path>
+ </pathconvert>
+
+ <apply executable="echo" ignoremissing="true"
+ outputproperty="ignoretrue" append="true">
+ <filelist refid="xyzlist" />
+ </apply>
+
+ <apply executable="echo" ignoremissing="false"
+ outputproperty="ignorefalse" append="true">
+ <filelist refid="xyzlist" />
+ </apply>
+
+ <fail>
+ <condition>
+ <not>
+ <and>
+ <equals arg1="${xy}" arg2="${ignoretrue}" />
+ <equals arg1="${xyz}" arg2="${ignorefalse}" />
+ </and>
+ </not>
+ </condition>
+ </fail>
+ </target>
+
<target name="cleanup">
<delete>
<fileset refid="xyz" />
1.30 +6 -0 ant/docs/manual/CoreTasks/apply.html
Index: apply.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/apply.html,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- apply.html 23 Apr 2004 14:44:43 -0000 1.29
+++ apply.html 16 Jun 2004 16:41:38 -0000 1.30
@@ -248,6 +248,12 @@
Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td>
<td align="center" valign="top">No</td>
</tr>
+ <tr>
+ <td valign="top">ignoremissing</td>
+ <td valign="top">Whether to ignore nonexistent files specified
+ via filelists. <em>Since Ant 1.7.</em></td>
+ <td align="center" valign="top">No, default is <i>true</i></td>
+ </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>fileset</h4>
1.54 +12 -2 ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
Index: ExecuteOn.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- ExecuteOn.java 23 Apr 2004 19:33:02 -0000 1.53
+++ ExecuteOn.java 16 Jun 2004 16:41:38 -0000 1.54
@@ -71,6 +71,7 @@
private int maxParallel = -1;
private boolean addSourceFile = true;
private boolean verbose = false;
+ private boolean ignoreMissing = true;
/**
* Has <srcfile> been specified before <targetfile>
@@ -183,6 +184,15 @@
}
/**
+ * Whether to ignore nonexistent files from filelists.
+ *
+ * @since Ant 1.7
+ */
+ public void setIgnoremissing(boolean b) {
+ ignoreMissing = b;
+ }
+
+ /**
* Marker that indicates where the name of the source file should
* be put on the command line.
*/
@@ -354,10 +364,10 @@
for (int j = 0; j < names.length; j++) {
File f = new File(base, names[j]);
- if ((f.isFile() && !"dir".equals(type))
+ if ((!ignoreMissing) || (f.isFile() &&
!"dir".equals(type))
|| (f.isDirectory() && !"file".equals(type))) {
- if (f.isFile()) {
+ if (ignoreMissing || f.isFile()) {
totalFiles++;
} else {
totalDirs++;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]