Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 60046 invoked from network); 15 Feb 2008 00:27:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2008 00:27:09 -0000 Received: (qmail 74245 invoked by uid 500); 15 Feb 2008 00:26:59 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 74181 invoked by uid 500); 15 Feb 2008 00:26:59 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 74170 invoked by uid 99); 15 Feb 2008 00:26:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2008 16:26:59 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.30.16] (HELO QMTA01.emeryville.ca.mail.comcast.net) (76.96.30.16) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 00:26:26 +0000 Received: from OMTA07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by QMTA01.emeryville.ca.mail.comcast.net with comcast id pcMv1Y0011GXsucA101900; Fri, 15 Feb 2008 00:26:14 +0000 Received: from [192.168.1.100] ([76.103.42.212]) by OMTA07.emeryville.ca.mail.comcast.net with comcast id pcSY1Y00Q4afPYU8T00000; Fri, 15 Feb 2008 00:26:33 +0000 X-Authority-Analysis: v=1.0 c=1 a=UM5S0jvYJ3IA:10 a=H_es7uPQAAAA:8 a=Eh18HA1TQF_2n1qCUwQA:9 a=cOKztWsuJecv4Clfs70A:7 a=ztM3ZRR7HRBrLY8NSy6Ua6O6J-sA:4 a=MSl-tDqOz04A:10 a=igkdSQrOE6AA:10 Message-ID: <47B4DC43.7070600@wilandra.com> Date: Thu, 14 Feb 2008 16:26:43 -0800 From: Bill Rich Reply-To: bill@wilandra.com Organization: Wilandra Consulting LLC User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Ant Users List Subject: Re: conditional statements References: <265537f80802141142l50ed8fe8ma30ac79f55512abb@mail.gmail.com> <47B4C152.7010109@iplay.com> In-Reply-To: <47B4C152.7010109@iplay.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org First I must say that Ant is not a process language it is a rules language so tasks like and do not belong in Ant. Now, is this more like what you want... X is True! X is False! Yadda... Yadda... Yadda... Fully testing this snippet is left as an exercise for the reader. What is intended is that your goal is to run the "the_rest" target. It will run only if its dependencies are met. Both the "do_if_x_is_true" target and the "do_if_x_is_false" target will terminate correctly (run) because whether x is true or not their dependencies are met. Those two targets, in turn, can not be run unless the "evalx" target is run so they both depend on "evalx". Robin Chaddock wrote: > > [quote] > ...but you must include the ant-contrib-xxx.jar file in your Ant's > classpath... > [/quote] > > It's a lot neater, and portable to other peoples configurations if the > antcontrib lib jar is simply specified in the classpath attribute of > the appropriate taskdef[s]. > e.g. > classpath="*${ant-contrib.jar}*" /> > > > David Weintraub wrote: >> In standard Ant, you use the task to set a property, then >> you can use to call a task. >> >> >> > property="x.is.true"> >> >> >> >> >> Yadda... >> Yadda... >> Yadda... >> >> >> > if="x.is.true"> >> X is True! >> >> >> > unless="x.is.true"> >> X is False! >> >> >> A little complex, but that's how it's done. >> >> AntContrib (as others have pointed out) has an task: >> >> >> >> >> X is True! >> >> >> X is False >> >> >> >> >> This is simpler, but you must include the ant-contrib-xxx.jar file in >> your Ant's classpath, and include a task in your build.xml >> file. See the AntContrib website for more information. >> >> On Thu, Feb 14, 2008 at 2:42 PM, jonese wrote: >> >>> How would i do something like >>> >>> if x = true{ >>> stuff >>> }else{ >>> other stuff >>> } >>> >>> in ant? basically i want to see if a property is true and if it is do >>> x instructions, if it's false do y. >>> >>> jonese >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >>> For additional commands, e-mail: user-help@ant.apache.org >>> >>> >>> >> >> >> >> > > > > ________________________________________________________________________ > E-mail is an informal method of communication and may be subject to > data corruption, interception and unauthorised amendment for which > I-play, a trading name of Digital Bridges Ltd will accept no > liability. Therefore, it will normally be inappropriate to rely on > information contained on e-mail without obtaining written confirmation. > > This e-mail may contain confidential and/or privileged information. If > you are not the intended recipient (or have received this e-mail in > error) please notify the sender immediately and destroy this e-mail. > Any unauthorized copying, disclosure or distribution of the material > in this e-mail is strictly forbidden. > > (C) 2005. I-play is a trademark and trading name of Digital Bridges > Limited. All Rights Reserved. > ________________________________________________________________________ > This message has been checked for all known viruses by the MessageLabs > Virus Scanning Service. For further information visit > http://www.messagelabs.com/stats.asp --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org