ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: The Ant way of doing things
Date Fri, 18 Feb 2005 12:54:10 GMT
Thanks Stefan.
That all looks helpful.  It's great to have some examples of solving 
specific problems.
Hmmmm... anyone working on an O'Reilly Ant Cookbook :-)
I've resisted the idea of writing a custom task, but maybe that's what's 
needed here.
Thanks again.
--Alex Buccino

Stefan Bodewig <>
02/18/2005 03:25 AM
Please respond to "Ant Users List"

        Subject:        Re: The Ant way of doing things

On Thu, 17 Feb 2005, alexander buccino
<> wrote:

> I'm trying to take a subset of files in a directory, compare them to
> a set of files with a different extension in another directory, and
> compile these files and move them to the new directory if they are
> newer than the target files.

Should be do-able with a combination of selectors, something like (Ant
1.6.2 only because of the implicit use of compositemapper):

    <filename name="a.rod"/>
    <filename name="c.rod"/>
  <depend targetdir="dir2">
      <globmapper from="*.rod" to="*.bas"/>
      <globmapper from="*.rod" to="*.rox"/>
      <globmapper from="*.rod" to="*.txt"/>

> Another problem I'm running into is the case where I have file
> foo.rod including library bar.rol.  I need to recompile foo.rod if
> either foo.rod or bar.rol is newer than any of foo.bas, foo.rox, or
> foo.txt.

This is a job for <dependset>.

  <srcfilelist dir="dir1">
    <file name="foo.rod"/>
    <file name="bar.rol"/>
  <targetfileset dir="dir2" includes="foo.*"/>

this will delete foo.* in dir2 if bar.rol is newer and your "normal"
compile task will recreate them even if foo.rod hasn't changed (since
the targets are no longer there).

IMHO the way that will save you the most headaches in the end would be
to write a custom Ant task for your compiler, though.  This task would
already know about the mappings and it may even become smart enough to
parse foo.rod, realize it imports bar.rol and therefore add bar.rol to
the timestamp comparison automatically.


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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message