For a long time I have thought on adding local contet to ANT. In principle it would be something like:
<target ....> <property name="x" value="w"/> <echo message="${x}"/> ... <local-property name="x"> <!-- here ${x} has no value assigned to it <echo message="${x}"/> <property name="x" value="y"/> <echo message="${x}"/> </local-property> <echo message="${x}"/> ... </target> The output of the above target would be something like: [echo] w [echo] ${x} [echo] y [echo] w You could also assign a value in the local-property, but using it as above allows setting the property using other tasks that set properties. The above is simple, and probably not too controversial, the question is what happens if I do an <ant> or <antcall> within the <local-property/> which value of ${x} should be inherited in the call at that point of the execution? Such a task, would be not too dificult to do, but it really needs access to the internals of ANT, it needs to be part of core, for sure. Jose Alberto > From: peter reilly [mailto:[EMAIL PROTECTED] > > The parellel would cause grief. > The problem is not the attribute, I think > but the "newcurrent" global "variable". > > On using macrodef, I have noticed that > it would be really cool to have a static scopped > variable. > > Peter > > On Thursday 16 October 2003 21:32, Shatzer, Larry wrote: > > I have run into a possible bug when working with macrodef > and parallel > > in a recursive situation. > > > > The following build file snip example exhibits this: (This requires > > the <if> ant-contrib task, and <math> from Antelope, soon to be > > ant-contrib). > > > > <macrodef name="recurse"> > > <attribute name="until"/> > > <attribute name="current"/> > > <attribute name="met --> > hod"/> > > <sequential> > > <if> > > <equals arg1="${until}" arg2="${current}"/> > > <then> > > <echo message="Method: ${method} done"/> > > </then> > > <else> > > <math > > datatype = "int" > > operand1 = "${current}" > > operand2 = "1" > > operation = "+" > > result = "newcurrent" > > /> > > <echo > > message = "1: M: ${method}, C: ${current}, U: ${until}" > > /> > > <sleep seconds="1"/> > > <echo > > message = "2: M: ${method}, C: ${current}, U: ${until}" > > /> > > <recurse > > current = "${newcurrent}" > > method = "${method}" > > until = "${until}" > > /> > > </else> > > </if> > > </sequential> > > </macrodef> > > > > <target name="test"> > > <parallel> > > <recurse current="0" method="0" until="5"/> > > <recurse current="0" method="1" until="10"/> > > <recurse current="0" method="2" until="15"/> > > <recurse current="0" method="3" until="20"/> > > </parallel> > > </target> > > > > Depending on the situation, this could result in an endless loop. > > > > I use something similar to this method when checking out/updating a > > list of cvs projects in parallel, and ran across the methoddef's > > steeping on each others toes. I was converting from using > antcall to > > macrodef. > > > > I don't know how to handle this, since macrodef should be > able to set > > and read properties in a global context, but sometimes you > want local > > variables. Maybe add a flag to <attribute> of global/local? > > > > -- Larry > > > > > --------------------------------------------------------------------- > > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]