ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger Vaughn <>
Subject RE: if and unless attributes for all Tasks
Date Tue, 15 May 2001 20:33:54 GMT
--- Jose Alberto Fernandez <>
> Just to cut to the chase, what Peter is trying to
> say is that instead of
> asking for:
> 	<target name="A" depends="B,C">
> 	<task1 if="c1" />
> 	<task2 if="c2" />
> 	</target>
> the way to do this in ANT is:
> 	<target name="A" depends="B,C,t1,t2" />
> 	<target name="t1 if="c1" > <task1> </target>
> 	<target name="t2" if="c2" > <task2> </target>
> That's it.

In my opinion, this often obscures the definition of
what you are trying to accomplish.  Instead of reading
task1 and task2 as parts of a sequence (and possibly
even dependent on each other), you have to read the
dependencies, search for the targets, etc. etc.  Also,
it frequently turns out that you have some
(non-conditional) tasks which much run *before* task1,
leading to even more targets - and often an empty
target A, which ends up merely serving as a
placeholder for dependencies.

Don't forget also that all targets are exposed to
command-line invocation - in certain cases it may be a
BAD THING to allow targets t1 or t2 to be invoked this

These cases aren't just pedantic argument - I have
encountered them in real situations several times.  Of
course, I had to solve them with multiple targets, but
was less than thrilled with the result (which others
will have to understand and maintain after I am

Now, if you subscribe to the principles of minimal
completeness, then there is only one answer anyway...

Roger Vaughn

Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

View raw message