You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Daniel Kalcevich <DK...@MercuryInsurance.com> on 2005/02/22 17:51:02 UTC
Conditional Question for Build Script
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
RE: Conditional Question for Build Script
Posted by Stephen McConnell <mc...@apache.org>.
> -----Original Message-----
> From: Daniel Kalcevich [mailto:DKalcevich@MercuryInsurance.com]
> Sent: Wednesday, 23 February 2005 3:21 AM
> To: user@ant.apache.org
> Subject: Conditional Question for Build Script
>
> 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.
Lets assume the the default behaviour is to *not* set a propery named
"production" to some value. You could then setup something like:
<condition property="production.isSet" value="true">
<isset property="production"/>
</condition>
If the product property is set then the production.isSet condition is true.
Otherwise it is false. Your target can then declare a guard. Fopr example:
<target name="whatever" depends="whatever-prod,whatever-stage"/>
<target name="whatever-prod" if="production.isSet">
<echo>Doing something with 'prod' mode.</test>
</target>
<target name="whatever-stage" unless="production.isSet">
<echo>Doing something with 'stage' mode.</test>
</target>
Cheers, Steve.
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Conditional Question for Build Script
Posted by Ninju Bohra <ni...@yahoo.com>.
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 <DK...@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