I'd like to move some of my macros to scriptdef definitions, and I've
started to investigate how to do so. One aspect is escaping me. I
believe I understand how to pass an attribute, but I have a case where
I want to have my scriptdef pass an element on to the called macro.
>From the API doc, it's not clear to me how I should do that. I've
googled for a tutorial or example, but I've been unable to find
anything (and I suspect my failed searches are due to me not knowing
the best search terms).
A trivialized example looks like so - how do I have wrapIt pass its
fileset element on to the call of doEcho?
<macrodef name="doEcho">
<attribute name="attr"/>
<element name="fileset"/>
<sequential>
<echo message="doEcho: attr is... @{attr}"/>
</sequential>
</macrodef>
<scriptdef name="wrapIt" language="groovy">
<attribute name="attr"/>
<element name="fileset" type="fileset"/>
<![CDATA[
attr = attributes.get("attr");
fileset = elements.get("fileset");
doEcho = project.createTask("doEcho");
doEcho.setDynamicAttribute("attr", "Inner call!");
if (null != fileset) {
// What goes here?
}
doEcho.perform();
]]>
</scriptdef>
In the API doc, I've looked at MacroInstance, and it's clear I
shouldn't be using createDynamicElement(). I suspect I need to be
working with a MacroDef, but I don't see how to piece everything
together to get what I'm after.
Apologies for the entry level question,
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]