PR: 29585 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276587 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -33,6 +33,10 @@ Other changes: | |||||
| * A new base class DispatchTask has been added to facilitate elegant | * A new base class DispatchTask has been added to facilitate elegant | ||||
| creation of tasks with multiple actions. | 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 | Changes from Ant 1.6.1 to current Ant 1.6 CVS version | ||||
| ===================================================== | ===================================================== | ||||
| @@ -229,6 +233,8 @@ Other changes: | |||||
| * Add deleteonexit attribute to <delete>. | * Add deleteonexit attribute to <delete>. | ||||
| * Added Target.getIf/Unless(). Bugzilla Report 29320. | |||||
| Changes from Ant 1.6.0 to Ant 1.6.1 | Changes from Ant 1.6.0 to Ant 1.6.1 | ||||
| ============================================= | ============================================= | ||||
| @@ -248,6 +248,12 @@ to send input to it is via the input and inputstring attributes.</p> | |||||
| Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td> | Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td> | ||||
| <td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
| </tr> | </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> | </table> | ||||
| <h3>Parameters specified as nested elements</h3> | <h3>Parameters specified as nested elements</h3> | ||||
| <h4>fileset</h4> | <h4>fileset</h4> | ||||
| @@ -303,6 +303,47 @@ | |||||
| </apply> | </apply> | ||||
| </target> | </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"> | <target name="cleanup"> | ||||
| <delete> | <delete> | ||||
| <fileset refid="xyz" /> | <fileset refid="xyz" /> | ||||
| @@ -71,6 +71,7 @@ public class ExecuteOn extends ExecTask { | |||||
| private int maxParallel = -1; | private int maxParallel = -1; | ||||
| private boolean addSourceFile = true; | private boolean addSourceFile = true; | ||||
| private boolean verbose = false; | private boolean verbose = false; | ||||
| private boolean ignoreMissing = true; | |||||
| /** | /** | ||||
| * Has <srcfile> been specified before <targetfile> | * Has <srcfile> been specified before <targetfile> | ||||
| @@ -182,6 +183,15 @@ public class ExecuteOn extends ExecTask { | |||||
| verbose = b; | verbose = b; | ||||
| } | } | ||||
| /** | |||||
| * 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 | * Marker that indicates where the name of the source file should | ||||
| * be put on the command line. | * be put on the command line. | ||||
| @@ -354,10 +364,10 @@ public class ExecuteOn extends ExecTask { | |||||
| for (int j = 0; j < names.length; j++) { | for (int j = 0; j < names.length; j++) { | ||||
| File f = new File(base, names[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))) { | || (f.isDirectory() && !"file".equals(type))) { | ||||
| if (f.isFile()) { | |||||
| if (ignoreMissing || f.isFile()) { | |||||
| totalFiles++; | totalFiles++; | ||||
| } else { | } else { | ||||
| totalDirs++; | totalDirs++; | ||||
| @@ -550,6 +550,10 @@ public class ExecuteOnTest extends BuildFileTest { | |||||
| assertNull("unexpected redirector.err content", getFileString("redirector.err")); | assertNull("unexpected redirector.err content", getFileString("redirector.err")); | ||||
| } | } | ||||
| public void testIgnoreMissing() { | |||||
| executeTarget("ignoremissing"); | |||||
| } | |||||
| //borrowed from TokenFilterTest | //borrowed from TokenFilterTest | ||||
| private String getFileString(String filename) throws IOException { | private String getFileString(String filename) throws IOException { | ||||
| String result = null; | String result = null; | ||||