ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter reilly <peter.rei...@corvil.com>
Subject Re: macrodef and properties
Date Fri, 14 Nov 2003 09:02:00 GMT
On Friday 14 November 2003 05:28, Jacob Kjome wrote:
> I have a macrodef where It does some work, then does a <pathconvert> which
> stores the result in a property, then something else uses that property
> value.   When I make calls to this, the first call works fine, but
> subsequent calls use the previously set property which, apparently, is set
> globally in the build.  This isn't very useful at all.  Is this going to be
> changed.  I saw the following conversations, but I'm not completely sure if
> the issues raised/fixed there affect my issue...
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=23942
> http://marc.theaimsgroup.com/?l=ant-dev&m=106664032815130&w=2
> http://marc.theaimsgroup.com/?l=ant-user&m=106674668723133&w=2
>
> Will the stuff in bug 23942 solve my issue?  If so, when is this patch
> going to be applied?  I'm using the latest 1.6 CVS.  Is my only workaround
> using <antcall>?  Wasn't the whole point of <macrodef> to get rid of the
> necessity for <antcall>?

This is the whole point of the <local/> patch - to allow <macrodef/> to
work in this fashion.

With it one can do the following:

  <target name="pathconvert">
    <macrodef name="showpathref">
      <attribute name="pathref"/>
      <sequential>
        <local name="converted"/>
        <!-- the pathconvert will set the local property "converted" -->
        <pathconvert property="converted" targetos="unix" refid="${pathref}"/>
        <echo>Pathref ${pathref} is ${converted}</echo>
      </sequential>
    </macrodef>

    <path id="s_xmls">
      <fileset dir="." includes="s*.xml"/>
    </path>
    <showpathref pathref="s_xmls"/>

    <path id="p_xmls">
      <fileset dir="." includes="p*.xml"/>
    </path>
    <showpathref pathref="p_xmls"/>

  </target>

There is currently some debate in the dev list about whether <local/> should
be part of ant 1.6, and whether the macrodef's attributes should be local
properties.

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message