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 Question for Build Script
Date Wed, 23 Feb 2005 06:28:59 GMT
Ant uses this technique for handling optional stuff
- set a property if needed jars are there: <available>
- include the classes only if that property is set: <include if|unless>

So you could the copying stuff with

    <!-- copy usual things -->
    <mkdir dir="${to.dir}"/>
    <copy todir="${to.dir}"><fileset dir="${src.dir}"/></copy>
    
    <!-- copy special file from another directory -->
    <copy todir="${to.dir}">
        <fileset dir=".">
            <include name="stage.only" if="stage"/>
        </fileset>
    </copy>

But dont forget: as the same as in target´s if/unless clause
here the same is checked: WHETHER that property is set, not to which
value!

Usual copy
    ant

Stage copy
    ant -Dstage=true

Another stage copy
    ant -Dstage=false


Jan


> -----Ursprüngliche Nachricht-----
> Von: Ninju Bohra [mailto:ninju_bohra@yahoo.com]
> Gesendet am: Dienstag, 22. Februar 2005 19:09
> An: Ant Users List
> Betreff: Re: Conditional Question for Build Script
> 
> You can use the <if> task (part of the ant-contrib project).
>  
> <if>
>    <equals arg1="${destination}" arg2="stage"/>
>    <then>
>         // Things to do if destination==stage
>    </then>
>    <else>
>         // Things to do if destination==stage
>    </else>
> </if>
> 
> Or you can use the <switch> task  :-)
> 
> Daniel Kalcevich <DKalcevich@MercuryInsurance.com> wrote:
> All,
> 
> I have a situation where I need to perform a check as to 
> whether or not
> a file needs to be included in build based upon a property. The
> property would represent the environment, either "stage" or "prod".
> Based upon the value of that property, I would need to rename 
> a file and
> move it to a different directory. Can anyone let me know the best way
> to do this? Thanks.
> 
> Daniel
> 
> This email and/or any files or attachments transmitted with 
> it are confidential and intended solely for the use of the 
> individual or entity to whom they are addressed, and may 
> contain information that is privileged, confidential and 
> exempt from disclosure under applicable law. If you are not 
> the intended recipient, or the employee or agent responsible 
> for delivering the message to the intended recipient, you are 
> hereby notified that any dissemination, distribution or 
> copying of this e-mail and/or any files or attachments 
> transmitted with it is strictly forbidden. If you have 
> received this email in error, please delete the e-mail and/or 
> any files or attachments, and also notify the system manager 
> (PostMaster@mercuryinsurance.com) of the error. Please note 
> that any views or opinions presented in this email are solely 
> those of the author and do not necessarily represent those of 
> the company. Finally, the recipient should check this email 
> and any attachments for the presence of viruses.
>  The company accepts no liability for any damage caused by 
> any virus transmitted by this email and/or any files or 
> attachments transmitted with it.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 

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