I have a target in ANT that needs to run a compiler on a given set of files twice: once for debug, once for production. I only want to run the compiler if the source file has changed, so I set up a < modified> selector. However, since I need both the debug and prod task to run for a given modified file, I set the 'update' property to false on the first run. I have something along the lines of:
<!-- Do the debug build -->
<apply executable="compiler">
<fileset dir="${js.src.dir}" includes="*.js">
<!-- don't update the cache so the prod build below works -->
<modified update="false"
seldirs="true"
cache="propertyfile"
algorithm="digest"
comparator="equal">
<param name="cache.cachefile" value="cache.properties"/>
<param name="algorithm.algorithm" value="md5"/>
</modified>
</fileset>
<args for debug build/>
</apply>
<!-- Do the production build -->
<apply executable="compiler">
<fileset dir="${js.src.dir}" includes="*.js">
<modified update="true"
seldirs="true"
cache="propertyfile"
algorithm="digest"
comparator="equal">
<param name="cache.cachefile" value="cache.properties"/>
<param name="algorithm.algorithm" value="md5"/>
</modified>
</fileset>
<args for prod build/>
</apply>
However this is not working. My first call to the compiler ends up updating the cache anyway, and the second call gets skipped. What am I missing here?
UPDATE: I got around the problem by using the < depend> selector instead, but still curious how to accomplish the same using < modified>