FileList DataType
A
filelist is a DataType supporting a named list of
files, implemented by
org.apache.tools.ant.types.FileList. The files do
not have to exist in order to be included in a
filelist. Following are the allowable attributes:
-
dir(1.4, File, *) The directory used to compute absolute filenames.
-
files(1.4, String, *) A comma-separated list of filenames.
-
refid(1.4, Reference, N) A reference to a
<filelist>defined elsewhere. The<filelist>being referred to defines a list of files. This is useful if you wish to define a list of files once, and then refer to it from several places in your buildfile.
Both dir and files are
required, unless refid is specified, in which case
neither dir nor files is
allowed.
Example
The filelist DataType was introduced in Ant 1.4,
along with the dependset task. (Since
filelist is only used with
dependset, we must talk about the
dependset task to explain the
filelist DataType). The
dependset task compares one or more input files to
one or more output files. If any of the input files are newer, then
all of the output files are erased. Additionally, if any of the input
files are missing, all of the output files are erased. Comparing
output files to a set of input files that may not yet exist is why
the filelist DataType is necessary.
Let’s illustrate why the combination of the
filelist DataType and the
dependset task is valuable. In this example, we
are comparing a list of XML and XSLT files to a single HTML file. The
HTML file, employeeDirectory.html ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access