Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 94898 invoked from network); 5 May 2004 08:24:06 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 May 2004 08:24:06 -0000 Received: (qmail 52662 invoked by uid 500); 5 May 2004 08:23:29 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 52600 invoked by uid 500); 5 May 2004 08:23:28 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 52560 invoked from network); 5 May 2004 08:23:27 -0000 Received: from unknown (HELO elitecore.com) (203.88.135.194) by daedalus.apache.org with SMTP; 5 May 2004 08:23:27 -0000 Received: (qmail 3054 invoked by uid 11188); 5 May 2004 08:25:40 -0000 Received: from pawanraj@elitecore.com by mailhost.elitecore.com by uid 503 with qmail-scanner-1.20 (iscan: v3.1/v7.000-1011/857/62001. spamassassin: 2.63. Clear:RC:1(192.168.1.136):. Processed in 0.019182 secs); 05 May 2004 08:25:40 -0000 Received: from unknown (HELO elitecore86) ([192.168.1.136]) (envelope-sender ) by elitecore.com (qmail-ldap-1.03) with SMTP for ; 5 May 2004 08:25:39 -0000 Reply-To: From: "Pawanraj Sadhwani" To: "'Ant Users List'" Subject: RE: If in MacroDef? Date: Wed, 5 May 2004 13:53:19 +0530 Message-ID: <003e01c4327a$39441aa0$8801a8c0@elitecore86> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <879A5AD5DD0ED511891F0003473A9B560E23F09A@Z011004> Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N one more thing.. how bout calling the independent targets that have that if="present" check from the main target. and use runtarget instead of the macro call? would that incurr too heavy a performance hit. the idea of revising the build file this time around is basically getting it to run faster... Pawan -----Original Message----- From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] Sent: Wednesday, May 05, 2004 1:40 PM To: user@ant.apache.org Subject: RE: If in MacroDef? If you always have it would be cleaner only to pass the FOO/BAR and let the macrodef do the tests. Of course the macrodef can do the availability checks - but be aware that properties are immutable! For some checks it would be useful to store an interim value. That can�t be done with properties. There is a patch on bugzilla according to "local variables" inside macrodef. (or is that part of the regular source tree, Peter?) Or you can use the task from AntContrib - especially if you already use AC. For a more "complex" use of macrodef see Ant�s own buildfile. A lot of selectors are defined to be used if special environment settings are present (most of them depend on a 3rd party library). On line 834 a macrodef defines the which is used to build most of the ant-*.jar�s in the lib directory. Jan > -----Original Message----- > From: Pawanraj Sadhwani [mailto:pawanraj@elitecore.com] > Sent: Wednesday, May 05, 2004 9:47 AM > To: 'Ant Users List' > Subject: RE: If in MacroDef? > > > Hi jan > > Thanx for the fast reply. > > i considered using antcontrib. I will be able to do it using that way. > > I was wondering if it would be possible to have something cleaner like > > > The macro performs certain actions on some directories... and > fails in case > the directory is not present.. during build init i set > properties using the > task. > > the idea is that developers might not have all directories on > the local > machine. (hence the initial antcalls and if's) > > rather than having the "checking for property" in the macro > itself, i want > to call the macro only if the property is set. > > This means that if i am using , there will be a lot of if's. Using > foreach is something i can look into.. cuz i dont want to > write 10 s.. > also, i putting the if. in the macro is a good idea. thanx again > > Pawan > > > -----Original Message----- > From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] > Sent: Wednesday, May 05, 2004 1:02 PM > To: user@ant.apache.org > Subject: RE: If in MacroDef? > > > Is that what you want (using AntContrib)? > > Jan > > > > > > > > > > > > > > doing @{param} > > > > > > > > > > > > > > > C:\TEMP>ant -Ddo2.present=true > Buildfile: build.xml > [echo] doing do2 > > BUILD SUCCESSFUL > Total time: 0 seconds > C:\TEMP>ant -Ddo2.present=true -Ddo1.present=true > Buildfile: build.xml > [echo] doing do1 > [echo] doing do2 > > BUILD SUCCESSFUL > Total time: 0 seconds > > > > > -----Original Message----- > > From: Pawanraj Sadhwani [mailto:pawanraj@elitecore.com] > > Sent: Wednesday, May 05, 2004 9:21 AM > > To: 'Ant Users List' > > Subject: If in MacroDef? > > > > > > Hi, > > > > I have a set of tasks repeating in the build file. uptil ant > > 1.5 i was using > > the antcall with a parameter passed to a common task i had written. > > > > In case of that target, i was using a if="foo" to allow for > > conditional > > execution. > > > > can similar thing be achieved using a macro? I refactored the > > common task > > into a macro. now, when i call the macro, i would like an > 'if' for the > > execution. how to do it? > > > > code snippet is: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > I could achieve what i want to by keeping antcalls in do-all > > and using macro > > in do1 and do2. > > > > However, I have a lot of antcalls in do-all which i dont like. Is it > > possible to use if in the macro so i could replace > ant-calls in do-all > > target? > > > > Thanx > > > > Pawan > > > > > > > --------------------------------------------------------------------- > 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