References are IMO broken in ant in general in that they
are processed at parse time and at run time.

Your example however works ok:

<target name="path">
<macrodef name="foo">
<attribute name="bar"/>
<sequential>
<path id="@{bar}" location="@{bar}"/>
</sequential>
</macrodef> <foo bar="classes" />
<foo bar="example" />
<path id="classpath">
<path refid="classes" />
<path refid="example" />
</path>
<pathconvert targetos="unix" refid="classpath" property="path.unix"/>
<echo>${path.unix}</echo>
</target>


Outputs:

path:
    [echo] /home/preilly/learning/ant/classes:/home/preilly/learning/ant/example



I had a quick look at having local references, but the above problem
defeated this.

local (for properties) will not be in ant 1.6.

Peter
Dominique Devienne wrote:

Hi Peter and al.,

How do macrodef and IDs interact? Suppose I want to define an ID'd path or
fileset inside a macro, something like so:

<macrodef name="foo">
 <attribute name="bar"/>
 <sequential>
   <path id="${bar}" location="build/classes/${bar}" />
   ...
 </sequential>
</macrodef>

<foo bar="acme-rt" />
<foo bar="acme-mt" />
<foo bar="acme-pt" />

<path id="classpath">
 <path refid="acme-rt" />
 <path refid="acme-mt" />
 <path refid="acme-pt" />
</path>

(Note that's I'm still using beta1, thus the ${name} notation...)

Since IDs are processed at parse time (are they still?), I suspect
the Ant code below won't go down too well???

Note that the example is contrived, and a bit silly as-is,
but hopefully shows the gist of what I'm wondering... --DD

PS: Also, is some form of local for macrodef in beta3?
   I think I need it to do something...

---------------------------------------------------------------------
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]



Reply via email to