ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Mitchell <geoff_mitch...@homedecorators.com>
Subject Re: *****spam***** Conditional execution of tasks
Date Thu, 31 Aug 2006 18:06:32 GMT
Have one target build a fileset of the modified files and give it a 
refid, and also use pathconvert to assign a property containing the 
contents of the fileset with setonempty="false".

Then run your copy target conditionally on the property.

<target name="check.copy">
  <fileset id="files.to.copy">
    <!--Use selectors to get your modified files-->
  </fileset>
  <pathconvert property="copy.required" pathsep=";" setonempty="false">
    <path>
       <fileset refid="files.to.copy/>
    </path>
  </pathconvert>
</target>

<target name="copy.files" depends="check.copy" if="copy.required">
  <copy ...>
    <fileset refid="files.to.copy/>
  </copy>
  <!--Do your other thing here.-->
</target>

Charles Abreu wrote:

> Hi,
>
> A use a copy task to copy modified files from one directory to another
> directory. I need to run another task if, and only if, at last one 
> file was
> copied. Is this possible?
>
> Thanks!
>

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


Mime
View raw message