You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dirk Schnelle <di...@tk.informatik.tu-darmstadt.de> on 2003/12/05 11:33:23 UTC

How to determine if files in a fileset are up to date?

Hi,

I have a java preprocesser and want to check if has already done it's work.

The preprocessor source files are stored in my source code folder. The result is written to another directory which serves as an input for the java compiler.

I tested uptodate with
    <uptodate property="preprocessNotRequired">
      <srcfiles dir= "${src}" includes="**/*.oj"/>
      <mapper type="glob" from="${src}*.oj" to="${build}*.java"/>
    </uptodate>

It works if up2date can find the destination files, but sets preprocessNotRequired to true if the files aren't present (after a call to clean).
The preprocessor source files are located in several directories.

How can I tell uptodate that a file is not up to date if it is not present?

A better approach for me would be to determine a fileset containing only all the files that are not up to date. How can I manage this.

I am using ant 1.5.4.

/Dirk

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


Re: How to determine if files in a fileset are up to date?

Posted by Peter Reilly <pe...@corvil.com>.
Dirk Schnelle wrote:

>Hi,
>
>I have a java preprocesser and want to check if has already done it's work.
>
>The preprocessor source files are stored in my source code folder. The result is written to another directory which serves as an input for the java compiler.
>
>I tested uptodate with
>    <uptodate property="preprocessNotRequired">
>      <srcfiles dir= "${src}" includes="**/*.oj"/>
>      <mapper type="glob" from="${src}*.oj" to="${build}*.java"/>
>    </uptodate>
>  
>
You (I think) need to change this to:

    <uptodate property="preprocessNotRequired">
      <srcfiles dir= "${src}" includes="**/*.oj"/>
      <mapper type="glob" from="*.oj" to="${build}/*.java"/>
    </uptodate>

Example:

 <target name="oj">
    <property name="src" location="src"/>
    <property name="build" location="preprocess"/>
    <touch file="src/task/x.oj"/>
    <uptodate property="preprocessNotRequired">
      <srcfiles dir= "${src}" includes="**/*.oj"/>
      <mapper type="glob" from="*.oj" to="${build}/*.java"/>
    </uptodate>
    <mkdir dir="preprocess/task"/>
    <touch file="preprocess/task/x.java"/>
    <uptodate property="preprocessNotRequired2">
      <srcfiles dir= "${src}" includes="**/*.oj"/>
      <mapper type="glob" from="*.oj" to="${build}/*.java"/>
    </uptodate>
    <echo>preprocessNotRequired is ${preprocessNotRequired}</echo>
    <echo>preprocessNotRequired2 is ${preprocessNotRequired2}</echo>
  </target>

results in

oj:
     [echo] preprocessNotRequired is ${preprocessNotRequired}
     [echo] preprocessNotRequired2 is true

Peter

>It works if up2date can find the destination files, but sets preprocessNotRequired to true if the files aren't present (after a call to clean).
>The preprocessor source files are located in several directories.
>
>How can I tell uptodate that a file is not up to date if it is not present?
>
>A better approach for me would be to determine a fileset containing only all the files that are not up to date. How can I manage this.
>
>I am using ant 1.5.4.
>
>/Dirk
>
>---------------------------------------------------------------------
>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