unfortunately properties are immutable so that wont work i would suggest using variable instead http://ant-contrib.sourceforge.net/tasks/tasks/variable_task.html
Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: dbai...@hp.com > To: user@ant.apache.org > Date: Wed, 5 May 2010 16:10:41 +0000 > Subject: RE: Better alternative than using foreach, for and if/then/else? > > > > -----Original Message----- > > From: Peter Reilly [mailto:peter.kitt.rei...@gmail.com] > > Sent: 05 May 2010 14:46 > > To: Ant Users List > > Subject: Re: Better alternative than using foreach, for and > > if/then/else? > > > > You need to use ant 1.8 and the <local> task. > > <local> declares that a property is local to the current scope, > > as defined by the enclosing <target> or <seqential> > > > > see: http://ant.apache.org/manual/CoreTasks/local.html > > > > <for list="${kernel.currver.variants}" param="kernel.variant" > > delimiter=" " trim="true"> > > <sequential> > > <local name="dir.kernel.build"/> > > <local name="dir.module.build"/> > > <if> > > <equals arg1="@{kernel.variant}" arg2='""' /> > > <then> > > <property name="dir.kernel.build" > > location="/lib/modules/${kernel.version}/build" /> > > <property name="dir.module.build" > > location="${dir.build}/output/${kernel.version}" /> > > </then> > > <else> > > <property name="dir.kernel.build" > > location="/lib/modules/${kernel.versi...@{kernel.variant}/build" /> > > <property name="dir.module.build" > > location="${dir.build}/output/${kernel.versi...@{kernel.variant}" /> > > </else> > > > > ... > > > > > > Peter > > Was aware of the local task, but haven't tried switching to Ant 1.8 to be > able to use it just yet. > > My main concerns at the moment are the following: > 1) Is for/foreach the only real option for what I'm attempting to accomplish > here in building multiple end targets based on the contents of properties? Is > looping over the property contents using those two tasks the only way in Ant, > or is there another way to allow Ant to see a variable list of sub-targets to > be run depending on property contents? In make I had rule patterns and eval > to be able to expand to give a list of targets, in Ant I have ??? > > I spotted a mail from yesterday to another person using for/foreach > suggesting using xslt to generate a build file and execute it, "A trick which > I have learned and used myself is to generate on the fly a small build file > using xslt and invoke it using <ant/>". I've yet to look at this closely. > > 2) Is there a better way to pass an empty string in and append it to the > properties above, rather than requiring an if/then/else construct to set > properties? Right now, if I don't use the if/then/else, the directory path > that dif.kernel.build gets resolved to is > /lib/modules/2.6.18-194.el5""/build, which is clearly wrong. > > -- > Regards, > Darragh Bailey > > Systems Software Engineer > Hewlett Packard Galway Ltd. > > Postal Address: Hewlett Packard Galway Limited, Ballybrit Business Park, > Galway > Registered Office: Hewlett Packard Galway Limited, 63-74 Sir John Rogerson's > Quay Dublin 2 > Registered Number: 361933 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4