--- Stefan Bodewig <[EMAIL PROTECTED]> wrote:
> Hmm,
>
> <condition property="iswindows">
> <os family="windows" />
> </condition>
>
> <target name="winlib" depends="compile" if="iswindows">
> ....
>
> would do it, no?
>
> Or with less features that are not there yet
>
> <property name="is.${os.name}" />
> <target name="winlib" depends="compile" if="is.Windows 2000">
>
> I think your case can properly be handled by target if/unless and
> setting some properties.
>
> Stefan
Hmm, yes, either would do it. IMHO, the second option is inferior, though,
simply because it looks kind of like a hack. It just doesn't look as
"intuitive" as would, say, 'if="${os.name}==Windows 2000"'.
I have other examples in the same file that I'm working my way around. For
instance, I now have a section that copies build products around - and expects
some copy sources to be missing. It's all clean now, but when I first looked
at the problem, I though "I need an if or os for this." As above, I'm still
not perfectly satisfied with it because anyone else reading the file will
really have to understand what is happening and why (i.e. it is acceptable for
copy sources to be missing) before they can understand the way it is written.
What I take from this example is this - while it certainly seems possible for
experts to do without conditions in *most* cases, it seems that they should be
provided and allowed in order to make Ant more usable for beginners who might
not yet understand the more advanced patterns (or for experts who are just
being dense. ;-))
A response to this might be "well, they should just learn the advanced
patterns!" At least in my experience, though, build beginners have to learn by
doing - there usually aren't classes, books, or mentors to teach them these
things, so it often takes years for them to discover advanced patterns, either
by themselves or by stumbling across someone else's scripts.
But I'm starting to sound soapboxy again. Anyway, I hope I have given you a
good example to consider.
roger
__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/