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, Script, MD.Attribute
Date Fri, 17 Oct 2003 12:04:36 GMT
Good point,

<script> does not do replace properties on
the contained text but macrodef does on
all contained text so the following works:

  <macrodef name="hello">
    <attribute name="x"/>
    <sequential>
      <script language="beanshell">
        System.out.println("Hello world ${x}");
      </script>
    </sequential>
  </macrodef>
  <hello x="this is x"/>

Another way would be to use <variable> from
antelope, and now in ant-contrib to
override the value each time. (Does not
work too good with <parallel/>)

Peter

On Friday 17 October 2003 12:53, Jan.Materne@rzf.fin-nrw.de wrote:
> How can I access macrodef attributes from inside a script?
>
> <macrodef>
>     <attribute name="foo"/>
>     <sequential>
>         <script language="javascript"> <![CDATA[
>
>             // how to access the value of 'foo' ??
>
>         ]]></script>
>     </sequential>
> </macrodef>
>
>
> Because <attribute>s are not <property>s, I canĀ“t use
> project.getProperty("foo"). And setting a
>     <property name="fooValue" value="${foo}"/>
> will work only on first time, because properties are
> immutable.
>
>
> Jan


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


Mime
View raw message