ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pawanraj Sadhwani" <pawan...@elitecore.com>
Subject RE: patterns conditionals/macrodef
Date Thu, 03 Jun 2004 08:31:44 GMT
Hi,

I remember suggesting an if="property.set" in the macrodef just like we have
in the target.. it would help people not wanting to rely on antcontrib.

if u are using antcontrib.. and want to avoid if, you might want to take a
look at the <runtarget> target that calls a target without creating a new
project.

Pawan

-----Original Message-----
From: Shackelford, John-Mason
[mailto:john-mason.shackelford@pearson.com]
Sent: Wednesday, June 02, 2004 10:56 PM
To: 'user@ant.apache.org '
Subject: patterns conditionals/macrodef


I have tried to be a purist and avoid the antcontrib if task, but it doesn't
appear to be possible to make effective use of macrodef without it. I was
looking forward to using macrodef to help me solve the classic problem
wherein one wants to reuse an ant snippet in two different targets, and in
one target the snippet requires some action first, whereas in the second
target the action isn't required at all.

<target name="build" depends="init,clean">
    <!-- macrodef calls -->
   <build-jar-deps />
   <build-jar-no-deps />
</target>

<target name="build-no-deps" depends="init,clean">
    <!-- macrodef calls -->
    <build-jar-no-deps />
</target>

As soon as a condition is required in one of the macrodefs, the whole thing
falls apart. If I tear out the macrodefs and replace them with targets so
that I can get the if/unless attributes, I have no alternative but to use
antcall again, yuck!

Have the committers have found a pattern which allows them to avoid this
situation? If not, of the two evils which should I regard as the greater:
the if task, or the antcall? Is there a solution for this catch-22 on the
horizon?


John-Mason Shackelford

Software Developer
Pearson Educational Measurement - eMeasurement Group

2510 North Dodge St.
Iowa City, IA 52245
ph. 319-354-9200x6214
john-mason.shackelford@pearson.com
http://etest.ncspearson.com

****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************

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



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


Mime
View raw message