ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: The Ant way of doing things
Date Fri, 18 Feb 2005 08:25:19 GMT
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