ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <ddevie...@gmail.com>
Subject Re: Equivalent: <ant
Date Fri, 08 Jul 2011 15:49:59 GMT
On Fri, Jul 8, 2011 at 10:27 AM, Perrier, Nathan <nperrier@ptc.com> wrote:
> 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 [mailto:Steve.Amerige@sas.com]
>
> Are the two statements below equivalent?
> <antcall target="doit" InheritRefs="true" />
> <runtarget target="doit" />

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


Mime
View raw message