ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Amerige <>
Subject macrodef, runtarget, antcall
Date Fri, 08 Jul 2011 22:14:47 GMT
Hi Dominique and all,

You've spotted exactly the issue at hand. :-)  Please accept for purposes of discussion the
requirement that Ant MUST be used in a 
procedural manner.  Plans to use scriptdef and Groovy are in the works, but that's not now.
 So, the question is what are the best 
set of practices to do in the case that only Ant and Ant-Contrib are allowable and one wants
to have reasonably modular-looking code 
that differentiates between public APIs, test APIs, internal "functions and macros"?

I was thinking that <runtarget> would serve as a function call mechanism, but what I've
heard in this mailing list is that I should 
use <macrodef> instead.  Are there any things that I won't be able to do with macrodef
that I could do with runtarget (and the other 
way around)?  The one advantage of using runtarget is that in Eclipse it shows up in Outline
view as an unfilled target.  This makes 
it easy to categorize code as follows:

* Filled-target-icon in Outline View: "Public" API Tasks
* Unfilled-target-icon in Outline View: "Local Tasks" that are either major portions of a
task or are "Test" APIs
* Macrodef-icon in Outline View: "Reusable code" that I don't think of as a task or subtask
* Scriptdef-icon in Outline View: is not helpful because the scriptdef name isn't shown (compared
to target and macrodef elements)

And, with conventions being followed to help distinguish between public APIs (publicAPIName),
test APIs (_.testAPIName), internal 
"functions" and macrodefs (_internalFunctionMacrodefEtc), the code is reasonably easy to read.

Believe it or not, the ability or organize code better feels like a good reason to prefer
runtarget over macrodef.  I'm still 
curious as to whether there are any practical (e.g., perfomance) reasons for favoring macrodef
over runtarget.

Gotta love this group... good technical discussions here!

Steve Amerige
SAS Institute, Deployment Software Developer

* P.S.

On 7/8/2011 11:49 AM, Dominique Devienne wrote:
> Using<antcall>  and<runtarget>  is IMHO a symptom of using Ant and
> builds with a wrong (procedural) mindset. I've created lots of large
> and complex builds in the past without any, so it's certainly not
> necessary to idiomatic Ant usage, although it remains quite popular to
> many:)  My $0.02. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message