ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dawson <>
Subject proposed <uptodate> enhancement (implementation attached)
Date Tue, 20 Mar 2001 14:57:47 GMT
I'd like to submit a change for Ant 1.4 to add a "value" attribute to the
<uptodate> task.

The reason is that there is a case where I'd like a variable to set to
"false" (rather than "true") if the given target file is up to date.  Here's
what I'm currently doing and why I think the proposed approach is nicer:

I like to make ample use of filtering with the <copy> task.  My filters are
set from properties files.  If any of the properties files have changed
since the last build, I need to set the overwrite attribute on <copy> to
"true", so that the file will be filtered and copied even though the source
file hasn't changed.

Currently to do this, I have to do a level of indirection with an extra
target.  Inside "init", I use <uptodate> in combination with <touch> to
determine whether any of the properties files have changed since the last
build.  Then I have to call another target with an "unless" in order to flip
the boolean value received from the <uptodate> task.

  <target name="init">
    <uptodate property="buildconfig.uptodate" targetfile="${}">
      <srcfiles dir="." includes="*.properties"/>
    <touch file="${}"/>

  <target name="setOverwrite" unless="buildconfig.uptodate">
    <property name="overwrite" value="true"/>

  <target name="compile"
    <copy filtering="yes" todir="${classes.source}"
      <fileset dir="${source.dir}">
        <include name="**/*.properties" />

As you can see, this is pretty much a hack in order to get it to do what I
need.  If we add a value attribute to <uptodate>, then I can do away with
the setOverwrite target with the following:

  <target name="init">
    <uptodate property="overwrite"
      <srcfiles dir="." includes="buildconfig*.properties"/>
    <touch file="${}"/>

And just use ${overwrite} inside my copy task -- much simpler and easier to

I'm not an ANT committer, so I'd like to ask someone who is to please
consider this submission and include it in the 1.4 tree if nobody rasies any


Tim Dawson
Chief Software Architect


View raw message