ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy Lambert <anto...@gmx.de>
Subject Re: Call a Macrodef using a property?
Date Wed, 30 Dec 2009 16:01:57 GMT
Hello Eric,

you would have to embed a scripting language in ant to do this.

Something like (untested)

 <script language="javascript"> <![CDATA[

        macroname=project.getProperty("myProperty");
        macrotask = project.createTask(macroname);
        macrotask.execute();

    ]]> </script>

Look at the corresponding page in the manual (under optional tasks, 
Script) and at the library dependencies.

Regards,

Antoine

Eric Fetzer wrote:
> Is there any way to call a macrodef with the name of the macrodef held in a property?
 Like this (of course this doesn't work):
>
> <project default="main">
>   <target name="main">
>     <property name="myProperty" value="myMac"/>
>     <${myProperty}/>
>   </target>
>   <macrodef name="myMac">
>     <sequential>
>       <echo message="I made it in"/>
>     </sequential>
>   </macrodef>
> </project>
>
>
>       
>   


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


Mime
View raw message