Ant-users,
I've started using <macrodef/> and <presetdef/> and before I get too far
down one path or another, I wanted to see what sort of wisdom you might
impart upon me.
Take, for example, the following two *def's:
<presetdef name="my.preset.ant">
<ant dir="NOT SET" antfile="build.xml" target="test" />
</presetdef>
<macrodef name="my.macro.ant">
<attribute name="dir" />
<attribute name="antfile" default="build.xml" />
<attribute name="target" default="test" />
<sequential>
<ant dir="@{dir}" antfile="@{antfile}"
target="@{target}" />
</sequential>
</macrodef>
And the two following calls:
<my.preset.ant dir="foo" />
<my.macro.ant dir="foo" />
Both calls do exactly the same thing, and both allow overriding of all three
attributes, but their underlying definition is quite different.
Aside from the difference that <my.macro.ant/> requires the dir= attribute
to be set, whereas <my.preset.ant/> would simply fail (assuming
"${basedir}/NOT SET" doesn't exist!), are there other vagaries, differences,
or gotchas that are good to know?
Obviously, given no major differences, the <presetdef/> version is probably
preferable due, simply, to its readability. Moreover, it seems to me that a
one-line <macrodef/> should simply be replaced by a <presetdef/>, with the
caveat that there is nothing to actually catch required properties that are
unset. Are there any other twists that I'm overlooking?
Your thoughts are welcome,
~Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]