ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Denner <m...@evtechnology.com>
Subject Re: conditional logic and making it nicely extensible
Date Thu, 06 Sep 2001 14:44:16 GMT
Jack Woehr wrote:
 >

> I have since realized that the way to accomplish what you and I both want
> in the TRUE ANT THEOLOGY :-) is to
> 
>    1. Set a variable using Condition
>          1. That variable should be the name of a target
>    2. Use Antcall on the variable to hit the right target
> 
> Here's an example ... run it without setting any props, then run it with


i can certainly see how that works and, must admit, i hadn't thought of it.
i'll look at it to see if it helps with our build system but we do
something pretty similar: we call a XYZ.check target as a dependency of
the XYZ target, and have that set a XYZ.doit property which XYZ has as an
if; or more simply:

<target name="XYZ" depends="XYZ.check" if="XYZ.doit">
   ...
</target>

<target name="XYZ.check">
   <condition property="XYZ.doit">
     ...
   </condition>
</target>

when we have a choice then we simply create do targets XYZ.success and
XYZ.failure with 'if' and 'unless' attributes.  it works ok but doesn't
half look nasty!

that really wasn't the intention of the email, although it was part of the
thinking.  what i really need is opinions on how to improve the
introspection that Ant does on elements to allow for a much nicer method of
extension (specifically the conditional stuff).

but thanks, that has given me an insight into the mentality of an Ant
project writer ;)  i guess nobody is maintaining a FAQ with these useful
tips in it?

Cheers,
Matt

-----------------------------------------------------------------------------
Sessami is a trademark of Escape Velocity Technology Mobile Services Limited.
All information contained in this e-mail is confidential and for the use of
the addressee only.  If you receive this message in error please notify.


Mime
View raw message