ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Local Properties
Date Tue, 28 Aug 2007 04:21:41 GMT
On Mon, 27 Aug 2007, Peter Reilly <> wrote:
> On 8/27/07, Stefan Bodewig <> wrote:

>> How does nesting of locals work?  If a macro calls another macro,
>> are the properties set in the outer macro available to the inner?
>> What about <ant> subbuilds invoked from inside a macro?
> Nesting works for calling other macros (otherwise ant-contrib for
> would not work too good!).


> But not for calling ant subbuilds invoked from inside a macro.
> The reasoning here is that 1) the code is awful (and thus hard to
> maintain) and 2) it is not necessary as one can use nested
> <property> tags on the <ant> task and 3) it may be confusing (where
> do these fit with nested property, user and non-user properties).

2) implies that I'm aware there is a local property around.  I know I
am probably constructing something unlikely to happen, but I'm trying
to understand what would happen before I dive into the code.


<target name="echo">
  <echo>In antcall: ${foo}</echo>

<macrodef name="inner">
    <echo>In inner: ${foo}</echo>
    <antcall target="echo"/>

<macrodef name="outer">
    <make a local property "foo" and set it to "baz"/>

<target name="callWithMacro">
  <property name="foo" value="bar"/>

would result in

In inner: baz
In antcall: bar


By just looking at inner and not at the path it gets called you can't
know that a local property exists.

I don't say this is a big problem, but I can see how it is going to
confuse people.  At least we need to document it properly - or find a
non-awful way to make it work 8-)

>> I think there are two options: restricting it to sequential or
>> allowing it for any TaskContainer.
> This is hard as the TaskContainer user implementation controls when
> the sequence of UEs are to be invoked (or reinvoked) and there is no
> hook back to ant core as to when this happens.

OK, so I really need to read the code before I comment any further.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message