ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: appending to fileset
Date Tue, 10 Jun 2008 13:59:00 GMT
On Sun, Jun 8, 2008 at 11:22 PM, Shawn Castrianni
<> wrote:
> Is there a way to incrementally add files to a fileset?
> I am building a fileset by looping through an XML file and need to add files
> to a named fileset one by one if they meet certain criteria.
> Is this possible without converting everything into paths or strings or stuff like that?

(impressive solution Gilbert BTW. I had no idea something like this
was possible)

Shawn, I believe that incrementally adding files to a fileset is going
against the philosophy of <fileset>. A  fileset is designed to scan a
directory for *existing* files, and add a subset of them to an
internal list when requested by client tasks (I don't remember if it
caches the list or not). Forcibly adding files to a fileset, if
possible at all, should be strongly discouraged. <filelist> and <path>
are the datatypes which accept arbitrary files (i.e. not necessarily
rooted in the same directory), where the files can be non-existent,
and or better choices if you persist in the adding-files direction.
(or possible the new ResourceCollection, which I never studied)

Now if the files mentioned in your XML file do exist, a better
approach is to code in a new FileSelector which is configured with
your XML file, to have the files mentioned (by name or pattern) added
to the subset of files held by the fileset (after scanning). You
selector parses the XML as a one time initialization, building an
internal PatternSet or composite selector (you have
AbstractCompositeSelector in buildmagic already doing the plumbing),
and yea or nay scanned files using either (see MultiPresentSelector or
NonePresentSelector NonePresentSelector as examples).

Without more details, it's hard to propose any alternative solutions. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message