ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Bailey" <ch...@codeintensity.com>
Subject RE: How do I delete files using a mapper?
Date Sat, 25 May 2002 03:13:14 GMT
Speaking of this, would the selectors help in this way...  I have an apply
task that basically drives a compiler (this is actually for the described
thing below, but for compiling, not deleting).  It turns .xml into .java.
The big problem is that the source directory and the destination directories
are the same, and secondarily, that there are source files for this
transformation all throughout the package hierarchy.  The problem is that
every time the task runs, it compiles every file, because it thinks the
destination file doesn't exist.  I believe this is because the apply task
only supports a single dest destination directory, and doesn't provide a way
to keep in step with where the sources are coming from.  Is there a way to
solve this so it doesn't try to rebuild 195 files every time?

-----Original Message-----
From: Bruce Atherton [mailto:bruce@callenish.com]
Sent: Friday, May 24, 2002 4:30 PM
To: Ant Users List
Subject: Re: How do I delete files using a mapper?


At 11:18 AM 5/24/2002 -0700, Chris Bailey wrote:
>I have a task that turns .xml files into .java files, that reside in the
>same source dir as the rest of my .java files.  But, I want to be able to
>"clean" those generated java files.  So, in my clean target I'd like to use
>the delete task, but with a Mapper.  But, delete doesn't support Mappers.
>So, what is the proper way to do such a thing?

Although I'm sure Diane's method would work, if you are using the latest
Ant from CVS you could also use the <present> selector. Off the top of my
head (and untested), something like this:

<delete dir="${src}">
     <fileset dir="${src}" >
         <include name="**/*.java"/>
         <present targetdir="$src">
            <mapper type="glob" from="*.java" to="*.xml" />
         </present>
     </fileset>
</delete>

If you are using 1.5 Beta1 then you have to use <presentselect> instead of
<present>, but that should change with the next Ant release.



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



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


Mime
View raw message