ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jful...@ruminate.co.uk
Subject Re: The Ant way of doing things
Date Fri, 18 Feb 2005 12:59:06 GMT
alexander.buccino@na.nykline.com wrote ..
> 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 :-)

hehe, I am but its called Ant Gems...it focuses on Ant uses outside of pure java build...its
publishing will be announced on this list.

good luck, Jim Fuller.

> I've resisted the idea of writing a custom task, but maybe that's what's
> needed here.
> Thanks again.
> --Alex Buccino
> 
> 
> 
> 
> 
> Stefan Bodewig <bodewig@apache.org>
> 02/18/2005 03:25 AM
> Please respond to "Ant Users List"
> 
>  
>         To:     user@ant.apache.org
>         cc: 
>         Subject:        Re: The Ant way of doing things
> 
> 
> On Thu, 17 Feb 2005, alexander buccino
> <alexander.buccino@na.nykline.com> 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):
> 
> <and>
>   <or>
>     <filename name="a.rod"/>
>     <filename name="c.rod"/>
>   </or>
>   <depend targetdir="dir2">
>     <mapper>
>       <globmapper from="*.rod" to="*.bas"/>
>       <globmapper from="*.rod" to="*.rox"/>
>       <globmapper from="*.rod" to="*.txt"/>
>     </mapper>
>   </depend>
> </and>
> 
> > 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>.
> 
> <dependset>
>   <srcfilelist dir="dir1">
>     <file name="foo.rod"/>
>     <file name="bar.rol"/>
>   </srcfilelist>
>   <targetfileset dir="dir2" includes="foo.*"/>
> </dependset>
> 
> 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.
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message