peterreilly 2004/03/08 10:50:34 Modified: src/main/org/apache/tools/ant/types Tag: ANT_16_BRANCH FileList.java docs/manual/CoreTypes Tag: ANT_16_BRANCH filelist.html Log: sync nested file support for filelist type/class Revision Changes Path No revision No revision 1.9.2.5 +35 -0 ant/src/main/org/apache/tools/ant/types/FileList.java Index: FileList.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/FileList.java,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -u -r1.9.2.4 -r1.9.2.5 --- FileList.java 23 Feb 2004 15:46:48 -0000 1.9.2.4 +++ FileList.java 8 Mar 2004 18:50:34 -0000 1.9.2.5 @@ -159,4 +159,39 @@ } } + /** + * Inner class corresponding to the <file> nested element. + */ + public static class FileName { + private String name; + + /** + * The name attribute of the file element. + * + * @param name the name of a file to add to the file list. + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the name of the file for this element. + */ + public String getName() { + return name; + } + } + + /** + * Add a nested <file> nested element. + * + * @param name a configured file element with a name. + */ + public void addConfiguredFile(FileName name) { + if (name.getName() == null) { + throw new BuildException( + "No name specified in nested file element"); + } + filenames.addElement(name.getName()); + } } No revision No revision 1.7.4.3 +35 -6 ant/docs/manual/CoreTypes/filelist.html Index: filelist.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTypes/filelist.html,v retrieving revision 1.7.4.2 retrieving revision 1.7.4.3 diff -u -r1.7.4.2 -r1.7.4.3 --- filelist.html 9 Feb 2004 22:12:10 -0000 1.7.4.2 +++ filelist.html 8 Mar 2004 18:50:34 -0000 1.7.4.3 @@ -17,9 +17,8 @@ specified as a list of files, relative to the specified directory, with no support for wildcard expansion (filenames with wildcards will be included in the list unchanged). -FileLists can appear inside tasks that support this feature or at the -same level as <code><target></code> (i.e., as children of -<code><project></code>). +FileLists can appear inside tasks that support this feature or as stand-alone +types. </p> <table border="1" cellpadding="2" cellspacing="0"> <tr> @@ -34,11 +33,30 @@ </tr> <tr> <td valign="top">files</td> - <td valign="top">The list of file names.</td> - <td valign="top" align="center">Yes</td> + <td valign="top">The list of file names. This is a list of + file name separated by whitespace, or by commas.</td> + <td valign="top" align="center"> + Yes, unless there is a nested file element</td> </tr> </table> - + <h4>Nested Element: file</h4> + <p> + This represents a file name. The nested element allows filenames containing + white space and commas. + </p> + <p><em>Since ant 1.7</em></p> + <table border="1" cellpadding="2" cellspacing="0"> + <tr> + <td valign="top"><b>Attribute</b></td> + <td valign="top"><b>Description</b></td> + <td align="center" valign="top"><b>Required</b></td> + </tr> + <tr> + <td valign="top">name</td> + <td valign="top">The name of the file.</td> + <td valign="top" align="center">Yes</td> + </tr> +</table> <h4>Examples</h4> <blockquote><pre> <filelist @@ -64,6 +82,17 @@ <blockquote><pre> <filelist refid="docfiles"/> +</pre></blockquote> + +<p>Same files as the example above.</p> + +<blockquote><pre> +<filelist + id="docfiles" + dir="${doc.src}"> + <file name="foo.xml"/> + <file name="bar.xml"/> +</filelist> </pre></blockquote> <p>Same files as the example above.</p>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]