title: ant - uptodate task : regenerate only outdated files
body: <p>I'm new to ant and rather used to Makefiles. In a project, the i18n language modules named Message_zh.class etc are built unconditionally from zh.po etc with every compile, although they already exist, which wastes much time. I figured these are the relevant parts of build.xml:</p>
  
  <pre><code>&lt;target id="msgfmt" name="msgfmt"&gt;
      &lt;mkdir dir="po/classes" /&gt;
      &lt;propertyregex property="filename"
                input="${file}"
                regexp="[.]*/po/([^\.]*)\.po"
                select="\1"
                casesensitive="false" /&gt;
      &lt;exec dir="." executable="msgfmt"&gt;
          &lt;arg line="--java2 -d po/classes -r app.i18n.Messages -l ${filename} po/${filename}.po"/&gt;
      &lt;/exec&gt;
  &lt;/target&gt;
  
  &lt;target id="build-languageclasses" name="build-languageclasses" &gt;
      &lt;echo message="Compiling po files." /&gt;
      &lt;foreach target="msgfmt" param="file"&gt;
        &lt;path&gt;
          &lt;fileset dir="po" casesensitive="yes"&gt;
            &lt;include name="**/*.po"/&gt;
          &lt;/fileset&gt;
        &lt;/path&gt;
      &lt;/foreach&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>The target build-languageclasses is depended on in the compile target and so, every compile, the whole bunch is msgfmted again. How should this be written to invoke msgfmt only if 1. the po file was changed, or 2. the class file doesn't exist? I would be glad if this would be possible without further software. Can you help or point me to an example?</p>
  
  <p>A first attempt at solution makes no difference in ant's behaviour:</p>
  
  <pre><code>&lt;target id="build-languageclasses" description="compile if Messages??.class files not uptodate" name="build-languageclasses" unless="i18n.uptodate"&gt;
    &lt;condition property="i18n.uptodate"&gt;
      &lt;uptodate&gt;
        &lt;srcfiles dir="${po}" includes="**/*.po"/&gt;
        &lt;mapper type="glob" from="${po}/*.po" to="${po}/classes/app/i18n/Messages*.class"/&gt;
      &lt;/uptodate&gt;
    &lt;/condition&gt;
    &lt;echo message="Compiling po files." /&gt;
    &lt;foreach target="msgfmt" param="file"&gt;
      &lt;path&gt;
        &lt;fileset dir="po" casesensitive="yes"&gt;
          &lt;include name="**/*.po"/&gt;
        &lt;/fileset&gt;
      &lt;/path&gt;
    &lt;/foreach&gt;
  &lt;/target&gt; 
  </code></pre>
  
  <p>What's wrong here?</p>