ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrier, Nathan" <>
Subject RE: Equivalent: <ant
Date Fri, 08 Jul 2011 15:55:01 GMT
Agreed, I try to use antcall as little as possible.  It also tends to
eat up memory if you have a ton of antcall tasks in a large build

Macrodefs are a nice substitute, but they really need an "if/else"
attribute.  I find that I often have targets that are just wrappers for
macrodef or use antcontrib's if/else tasks to accomplish this.

-----Original Message-----
From: Dominique Devienne [] 
Sent: Friday, July 08, 2011 10:50 AM
To: Ant Users List
Subject: Re: Equivalent: <ant

On Fri, Jul 8, 2011 at 10:27 AM, Perrier, Nathan <>
> No, because antcall creates a new project underneath the hood, whereas
runtarget (antcontrib task) does not.

I would add that <runtarget> (and <antcall> as well in fact) goes
against the Ant philosophy of having declarative builds using targets
with proper dependencies between them, where by "dependencies" I mean
that target just state their "requirements" and should not care when
or in which order those requirements are fulfilled,  since that's the
job of the "dependency manager" to analyze the graph of targets and
order them such that each one runs only once and in the proper order,
detecting circular references. Targets are not functions that one
would call at will, leading to procedural as opposed to declarative
builds. <macrodef> usage should eliminate the need for most
<runtarget> usage and is preferred in general.

In more practical terms, <antcall> does indeed create a new project
(i.e. a new "scope"), which means that any property it sets will not
be visible to the build that used <antcall>. <runtarget> does not
create a new Project, so all properties set *are* visible to the
"caller", and it achieves that via a loophole in Ant's API which is
not plugged for backward-compatibility reasons.

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

> -----Original Message-----
> From: Steve Amerige []
> Are the two statements below equivalent?
> <antcall target="doit" InheritRefs="true" />
> <runtarget target="doit" />

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

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

View raw message