ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject RE: getting a macro attribute in a script
Date Sun, 07 Mar 2004 07:23:22 GMT

Yep, you can use the value of an attribute as a property.  Generally, this 
should be unique.  As such, you can set these properties to your hearts 
desire and make your macrodef totally reusable..

http://marc.theaimsgroup.com/?l=ant-dev&m=107026918307636&w=2

Note that the discussion there was slightly before the current behavior of 
macrodef became approved for 1.6.0.  Peter's example will work with 1.6.0+.


Jake

At 01:25 PM 3/6/2004 -0800, you wrote:
>The problem is I want to use the macro several times, each time with a 
>different config.file attribute.  This means that I cant use a property.
>
>Is there a way to get at the macro attribute from within the script 
>without using a property?
>
>-----Original Message-----
>
>If you mean you want to set the value of the config_file property then try 
>this
>
><property name="config_file" value="@{config.file}"/>
>
>but better would be to use the @{config.file} where you need it in the 
>macro and avoid the
>property all together.
>
>Remember properties are immutable once set they cannot be reset.
>
>Thanks.  Bill
>
>Bill Rich
>Wilandra Consulting LLC
>1325 Addiewell Place
>San Jose, CA  95120-3905
>phone:      +1 408 268-2452
>mobile:     +1 408 410-9713
>Santa Cruz: +1 831 464-9007
>fax:        +1 413 669-9716
>billrich@wilandra.com or billrich@attglobal.net
>http://www.wilandra.com
>
>-----Original Message-----
>From: Sean Bridges [mailto:sbridges@smgtec.com]
>Sent: Friday, March 05, 2004 5:38 PM
>To: user@ant.apache.org
>Subject: getting a macro attribute in a script
>
>
>How do you get the value of a macro's attribute from within a script.
>
>My build file looks like,
>
>             <macrodef name="replaceClientConfig"
>id="replaceClientConfig_id">
>                         <attribute name="config.file"/>
>                         <sequential>
>                                     <script language="javascript">
>
>                                                 <![CDATA[
>
>                                                 //echo =
>project.createTask("echo");
>
>//echo.setMessage(replaceClientConfig_id.toString());
>                                                 //echo.perform();
>
>                                                 config_file  = ???
>
>
>I want to set the config_file variable to the value of the config.file
>attribute.
>
>Thanks,
>
>Sean
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message