ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Leftwich <digi...@ix.net.au>
Subject Re: Ant and Conditional Expressions1
Date Fri, 04 May 2001 04:44:50 GMT
At 11:39 AM 04-05-01 +0800, Adam Flegman wrote:
>Hello All,
>
>I am very new to the world of XML and in particular have just discovered Ant
>
>I am was wondering if there was an easy way to create conditional
>expressions within the ant xml build files to help control execution of the
>build process. (eg to execute a target depending on the value for a given
>parameter).
>
>
>To give a more concrete example:
>========================
>We have an orb parameter (orb) declared in an external property file which
>should have either the value 'orbix' or 'visibroker'.
>
>I have separate targets created to copy the visibroker or orbix files to the
>output build area in my project. II would like to branch to the appropriate
>task based on the value of the ${orb} parameter.
>
>I notice that targets can have an 'if' argument, but unfortunately this is
>only concerned with the existence of a parameter whereas I am also
>interested in the value of a parameter

You can do the following :

<property name="orbParam_${orb}" value="1"/>

<!-- orbix task -->
<target name="orbix.task" if="orbParam_orbix">
         ...
</target>

<!-- visibroker task -->
<target name="visibroker.task" if="orbParam_visibroker">
         ...
</target>

HTH

Robert


Mime
View raw message