> -----Original Message----- > From: Daniel Kalcevich [mailto:[EMAIL PROTECTED] > 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 > ([EMAIL PROTECTED]) 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: [EMAIL PROTECTED] For > additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]