ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: IDs and macrodef
Date Fri, 12 Dec 2003 11:17:09 GMT
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: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
>  
>


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


Mime
View raw message