ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Having problem using property to in macrodef if invoke for more than one time
Date Thu, 27 Mar 2008 07:20:55 GMT
On Thu, Mar 27, 2008 at 6:23 AM, CheeYang Chau <cychau@gmail.com> wrote:
> I do run the macrodef in parallel using parallel task. Do you think
>  using var task will work ?
There are lots of tasks that are *not* safe with using in the <parallel> task
and <var> is one of them.

If possible do not use <parallel>

Peter

>
>
>
>  On Thu, Mar 27, 2008 at 2:15 PM, Olivier Gies <olivier.gies@bull.net> wrote:
>  > I recommend using the <var ..> task from ant-contrib. You can se it to
>  >  unset properties in macrodefs, like this:
>  >
>  >  <var name="myvalue" unset="true" />
>  >
>  >  BR,
>  >  Olivier
>  >
>  >
>  >  -------- Original Message  --------
>  >  Subject: Having problem using property to in macrodef if invoke for more
>  >  than one time
>  >
>  >
>  > From: CheeYang Chau <cychau@gmail.com>
>  >  To: user@ant.apache.org
>  >  Date: 27/03/2008 13:52
>  >
>  >  > Hi,
>  >  >
>  >  > I love the macrodef task. However, it has a weakness.  We must be very
>  >  > careful if using property within the macrodef.  I face problem with a
>  >  > macrodef that is more complicated than the following example.  I have
>  >  > to use dirname and condition in my macrodef, but it cause problem if I
>  >  > invoke macrodef for more than one time as the property has been set
>  >  > for the first time.  Here is an example that trying to replay the
>  >  > situation I face:
>  >  >
>  >  >       <macrodef name="a">
>  >  >               <attribute name="module"/>
>  >  >               <sequential>
>  >  >                       <property name="myvalue" value="@{module}"/>
>  >  >                       <echo>${myvalue}</echo>
>  >  >               </sequential>
>  >  >       </macrodef>
>  >  >
>  >  >       <target name="build">
>  >  >               <a module="venus"/>
>  >  >               <a module="mars"/>
>  >  >       </target>
>  >  >
>  >  > I expect the output should be
>  >  >
>  >  > [echo] venus
>  >  > [echo] mars
>  >  >
>  >  > but it turn out:
>  >  >
>  >  > [echo] venus
>  >  > [echo] venus
>  >  >
>  >  > I think this is a common issue using macrodef and there are some
>  >  > temporary solution to pass a temporary property name to the macrodef.
>  >  > This is not feasible in my situation as I need to pass more than 5 to
>  >  > 10 properties to my macrodef.
>  >  >
>  >  > Some other solution is using local property but I couldn't find this
>  >  > task.  I am using ANT 1.7.0.
>  >  >
>  >  > Any solution?  Please advice.  Thank you very much.
>  >  >
>  >
>  >  --
>  >  *Olivier Gies*
>  >
>  >  *Delivery Manager
>  >  Customs & Tax Software Engineering Center
>  >  Bull, Architect of an Open World ^TM
>  >  Phone: +86 (10) 65978001 - Ext 555 *
>  >
>  >  *www.bull.com <http://www.bull.com/>*
>  >
>  >  *This e-mail contains material that is confidential for the sole use of
>  >  the intended recipient. Any review, reliance or distribution by others
>  >  or forwarding without express permission is strictly prohibited. If you
>  >  are not the intended recipient, please contact the sender and delete all
>  >  copies.*
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>  >  For additional commands, e-mail: user-help@ant.apache.org
>  >
>  >
>
>
>
>
> --
>  Best regards,
>  Chau Chee Yang
>
>  E Stream Software Sdn Bhd
>  URL: www.sql.com.my
>  SQL Financial Accounting
>
>  ---------------------------------------------------------------------
>
>
> 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


Mime
View raw message