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: AW: How to determine if files in a fileset are up to date?
Date Fri, 05 Dec 2003 13:11:12 GMT
You can also use the <outofdate> and <pathtofileset> tasks from ant-contrib:

  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <target name="oj2">
    <property name="src" location="src"/>
    <property name="build" location="preprocess"/>

    <delete quiet="yes" dir="preprocess"/>
    <mkdir dir="preprocess/task"/>
    <touch file="preprocess/task/x.java"/>
    <touch file="src/task/x.oj"/>
    <touch file="src/task/y.oj"/>
    <touch file="src/task/z.oj"/>

    <outofdate outputsourcespath="modified.sources.path">
      <sourcefiles>
        <fileset dir="${src}" includes="**/*.oj"/>
      </sourcefiles>
      <mapper dir="${src}" type="glob" from="*.oj" to="${build}/*.java"/>
      <sequential>
        <pathtofileset name="modified.sources.fileset"
                       pathrefid="modified.sources.path"
                       dir="${src}"/>
        <pathconvert
          targetos="unix" property="modified.fileset.property"
          refid="modified.sources.fileset"/>
        <echo>modified files are ${modified.fileset.property}</echo>
      </sequential>
    </outofdate>
  </target>

This prints out:
   [delete] Deleting directory /home/preilly/learning/ant/preprocess
    [mkdir] Created dir: /home/preilly/learning/ant/preprocess/task
    [touch] Creating /home/preilly/learning/ant/preprocess/task/x.java
     [echo] modified files are 
/home/preilly/learning/ant/src/task/y.oj:/home/preilly/learning/ant/src/task/z.oj

Peter
Antoine Lévy-Lambert wrote:

>You might then download the source code of ant 1.6 from CVS (or ant HEAD, it
>is 99% the same) and isolate the classes that you need to get this
>ModifiedSelector to work. (actually there is a package
>org.apache.tools.ant.types.selectors.modifiedselector with 7 classes in it).
>You can certainly get it to work as a custom selector.
>Antoine
>
>-----Ursprüngliche Nachricht-----
>Von: Dirk Schnelle [mailto:dirk@tk.informatik.tu-darmstadt.de]
>Gesendet: Freitag, 5. Dezember 2003 13:47
>An: Ant Users List
>Betreff: AW: How to determine if files in a fileset are up to date?
>
>
>
>This looks great!
>Unfortunately I must not use this release. I have 1.5.4.
>
>/Dirk
>
>-----Ursprüngliche Nachricht-----
>Von:	Antoine Lévy-Lambert [mailto:antoine@antbuild.com]
>Gesendet:	Fr 05.12.2003 13:28
>An:	Ant Users List
>Cc:
>Betreff:	AW: How to determine if files in a fileset are up to date?
>Hi Dirk,
>
>the <modified/> selector of ant1.6beta3 might be what you need.
>See http://ant.apache.org/manual-1.6beta/CoreTypes/selectors.html#modified
>
>Cheers,
>Antoine
>
>-----Ursprüngliche Nachricht-----
>Von: Dirk Schnelle [mailto:dirk@tk.informatik.tu-darmstadt.de]
>Gesendet: Freitag, 5. Dezember 2003 13:16
>An: Ant Users List
>Betreff: AW: How to determine if files in a fileset are up to date?
>
>
>Yes. But if I want to compare timestamps of the generated and the source
>file I have to compare this for each file. Can I use a mapper for this like
>in uptodate?
>/Dirk
>
>
>-----Ursprüngliche Nachricht-----
>Von:	Antoine Lévy-Lambert [mailto:antoine@antbuild.com]
>Gesendet:	Fr 05.12.2003 12:51
>An:	Ant Users List
>Cc:
>Betreff:	AW: How to determine if files in a fileset are up to date?
>You should have a look at the selectors, in the ant manual under concept and
>types.
>selectors are nested elements of filesets, which can restrict a fileset to
>fit certain criteria.
>
>Cheers,
>Antoine
>
>
>---------------------------------------------------------------------
>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
>
>
>
>  
>


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


Mime
View raw message