ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Conditional processing
Date Tue, 14 Dec 2004 20:23:24 GMT
--- Laran Evans <lc278@cornell.edu> wrote:

> How would I do something like:
> 
> <target name="x">
>    <if test="true == ${auto-deploy}">
>      <javac dest="${dir.deploy.auto}" ... />
>    </if>
>    <else>
>      <javac dest="${dir.build}" ... />
>    </else>
> </target>
> 
> ?

ant-contrib has an <if> task, but using "classical
Ant" you might do:

<target name="check">
  <condition property="destdir" 
             value="${dir.deploy.auto}">
    <istrue value="${auto-deploy}" />
  </condition>
  <property name="destdir" value="${dir.build}" />
</target>

<target name="x" depends="check">
  <javac dest="${destdir}" ... />
</target>

or, you might do this (arguable more "normal"):

<target name="x" depends="compile,deploy" />
<target name="compile">
  <javac dest="${dir.build}" ... />
</target>
<target name="deploy" if="auto-deploy">
  <!-- note that the if above tests the
       existence of the auto-deploy property
       rather than its actual value -->
  <copy todir="${dir.deploy.auto}">
    <fileset dir="${dir.build}" />
  </copy>
</target>

HTH,
Matt


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

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


Mime
View raw message