ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Curt Arnold" <carn...@houston.rr.com>
Subject Re: incremental zip or tar
Date Fri, 26 Apr 2002 05:15:30 GMT
Since nobody else has responded to this, I'll take a shot.

Doing a quick scan of the source code for usage of the Date and Time didn't
uncover anything that looked like Ant could already do what you want to do.

I definitely think that your approach should be to extend or hack the
FileSet and not to try to extend or hack the archiving tasks.

The next question is whether you were proposing the question as something
that you think is a general need and should be integrated into Ant or this
is something that is a specialized need that can be accomplished by a hack.

If you were proposing a general solution, then the right approach would be
to add some facility to FileSet to exclude files based on dates, maybe
adding a before and after attribute.  However the timing is inconvienient to
get this added into Ant 1.5 release since the new feature window is closing
this weekend.

If you want to do it as a hack to just get the job done, then I would try
this.

1. Derive a class from FileSet
2. add a setBefore(Date d) and setAfter(Date d) methods
3. overload getDirectoryScanner() and wrap the directory scanner with
another class that filters its results based on the before and after dates

In your build file, add a typedef for your class

<typedef name="myfileset" classname="com.example.MyFileSet"/>

At the same level as a <target> add a <myfileset> and provide it with an id

<myfileset id="zip-this" after="2002-04-15" dir="${src.dir}">
    <include name="*.*"/>
</myfileset>

In the <zip> (or similar task) use a reference fileset to point to your
extended fileset

<zip destfile="${build.dir}/myzip" basedir="${src.dir}">
   <fileset refid="zip-this"/>
</zip>

If that doesn't work (which would probably due to something is the reference
mechanism not allowing mechanisms to derived classes), an alternative would
be to define a FileSet with an id and then have a task populate the
FileSet's patterns but that would be an even uglier hack.

Not sure if either approach would work, but would appreciate hearing your
experiences.  Good luck.



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message