ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Determining empty fileset
Date Thu, 08 Dec 2005 07:11:01 GMT
>I am new to ant and I am trying to create a script to 
>distribute only those files that were modified since the last 

Use the <modified> selector and you´ll only get files which content has changed.
Otherwise usually only the timestamp is checked (in <copy> e.g.)

>I would like to stop distribution if no files have been changed. 
>However, I cannot seem to be able to work this into my script. 
>I know that I can use path convert to determine if a fileset 
>is empty or not, but I don't know how or how to use the 
>property from pathconvert.

01: <target name="-deploy.check">
02:     <fileset id="fs" dir="dir">
03:         <modified/>
04:     </fileset>
05:     <pathconvert property="changedFiles" 
06:                  refid="fs" 
07:                  setonempty="false"/>
08: </target>
10: <target name="deploy" 
11:         depends="-deploy.check" 
12:         if="changedFiles">
13:     <!-- deploy -->
14: </target>

01: use a leading '-' so the user cant invoke it from the command line
03: check against the files content; if the timestamp is enough, dont use this
    for better performance
07: important for line 12
11: perform the first target before (and before if/unless check)
12: only execute this target, if a property "changedFiles" is set - to some value
    (e.g. "false" or "true" or "file1,file2")


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message