ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: uptodate vs. outofdate and if/unless gotchas
Date Thu, 04 Mar 2004 17:35:25 GMT
The name of outofdate was a play on uptodate to show that
it does the opposite. But I must admit that the doc for outofdate
is a bit not precise.

As Dominique says, its main purpose is to run an embedded list
of tasks if the outofdate condition is set.

I have never liked the ant idiom of using properties to control
program execution logic.

As a side note, in the current cvs version of ant-contrib, the
<for> task can take an <outofdate> element as a nested
element and set the param macro  for each source file that
is newer than its corresponding target file (for mapped target
files) or than any of the targets (when used with the <targetfiles>
nested element).

    <ac:for param="xmlfile" xmlns:ac="antlib:net.sf.antcontrib">
      <ac:outofdate>
        <ac:sourcefiles>
          <ac:fileset dir="${basedir}/xdocs" includes="**/*.xml"/>
        </ac:sourcefiles>
        <ac:mapper dir="${basedir}/xdocs"
                   type="glob" from="*.xml" to="${basedir}/docs/*.html"/>
      </ac:outofdate>
      <ac:sequential>
        <echo>Need to generate a target html file from source file @{xmlfile}</echo>
      </ac:sequential>
    </ac:for>

Peter

Dominique Devienne wrote:

>>From: Stirling, Scott [mailto:scott.stirling@workscape.com]
>>Hi,
>>
>>These tasks seem like they do the same thing on the surface, but they
>>actually set a property based on opposite conditions.
>>
>>    
>>
>
>You're really missing the part that <outofdate> is not designed to set a
>property, but to *do* something when target files are out-of-date, i.e. are
>not uptodate. I use <outofdate> extensively, and never set a property with
>it. Really, with <outofdate> (which is part of Ant-Contrib, not Ant BTW),
>you don't need <uptodate>, and simply reverse the logic.
>
>With <outofdate>, think Makefile dependencies. This is the logic <outofdate>
>was designed to replicate, and if you think it terms of file dependencies,
>then it's crystal clear.
>
><outofdate>'s goal is to perform its nested <sequential> only when needed,
>i.e. when its target files are ouf-of-date, not to set properties. --DD
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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


Mime
View raw message