ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Conditional logic in ANT build scripts
Date Wed, 09 Apr 2003 06:52:28 GMT
<target name="dev-check">
    <condition property="dev-check">
        <isequal arg1="dev" arg2="${environment}"/>
    </condition>
</target>

<target name="dev" depends="dev-check" if="dev-check">
    <echo> DEV-Environment </echo>
</target> 


Jan Matèrne


> -----Urspr√ľngliche Nachricht-----
> Von: Andrew Zeon [mailto:AndrewZ@hothouse.com.au]
> Gesendet am: Mittwoch, 9. April 2003 08:55
> An: Ant Mailing List (E-mail)
> Betreff: Conditional logic in ANT build scripts
> 
> Hi, 
> 
> I know that the 'if' attribute in the 'target' task can be 
> used to determine
> whether or not a target should be executed. However, it is my 
> understanding
> that the 'if' attribute does not take into consideration the 
> value of the
> property... it merely checks its presence. Is there a way I 
> can dynamically
> determine whether or not a target is to be executed according 
> to the actual
> value of a property?
> 
> The reason why I ask is I have a build script, but that build script's
> behaviour has to be different for different environments. 
> This is how I
> invoke my script:
> 
> "ant -Denvironment=dev dist"
> 
> for the development environment
> 
> "ant -Denvironment=staging dist "
> 
> for the staging environment
> 
> ant -D environment=live dist
> 
> for the live environment
> 
> 
> I have targets which should only be run for specific 
> environments... how can
> I do this?
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message