ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Dumas" <>
Subject RE: [SUBMIT] Switches And Sections
Date Thu, 08 Nov 2001 19:21:04 GMT
Peter - Thanks for the props.  I figured they would be of use to someone.

To answer your question, I think the match property sounds excellent.
make the mod.  Bonus points, allow wildcard asteriks and add an additional
property called "case" that can be "true" or "false".  This applies case
sensitivity to the match.  The case property defaults to "false"...  the
match property defaults to null, as both would be optional.  Thus, when
match is not present, the switch just looks for the existence of the
property as it does now...

Also, the section is pretty darn simple, but someone that likes reference
ids could make a mod to them so they could be called from other parts
of the build file.  this would add more meat to the bone for sections.



-----Original Message-----
From: Peter Davis []
Sent: Wednesday, November 07, 2001 6:27 PM
To: Ant Developers List
Subject: Re: [SUBMIT] Switches And Sections

(This is also my first post -- Hi!)  I've been using ant for a while,
but it has been difficult to build truly "automated" build scripts
because of lack of a good conditional build facility.  Sure, there is
<target unless="..."> or <target if="...">, but having to separate out
all the conditional sections into separate targets is a pain (not to
mention that it pollutes the list of available targets and prints out
all that extra "target: \n" lines on output).  I have also seen and
experimented with other custom <if>-type tasks, but most of them are
still ugly and rely on external targets.  Scripts are always an option
too, but setting up the BSF environment just for the build is not an
option on many of my target machines.

I just want to say, props to Mark on something that I will definitely be
using in my own scripts, since it is the most elegant solution I have
yet seen.  I hope that this or something like it can be included in the
distribution in the future.

Question to Mark: what would you think of something like this:

<switch property="foo" match="xyz">

which would execute when ${foo} => "xyz", instead of being restricted to
only testing for "true" or "false".  That would greatly simplify
creation of something like a build configuration file, since I wouldn't
have to write a bunch of <condition ...><equals .../></condition>.  I
would be happy to attempt to write a patch for you if you like (assuming
you like my idea at all :->).

Thank you!

Mark Dumas wrote:

>This is my first post so bear with me.  I came up with a few custom Ant
>tasks/classes that have been very useful and I wanted to pass them along.
>A Switch is a task container that tests for a condition represented by a
>property. If the property value is "true", inner tasks are executed
>depending on if they are identified in the pass and fail list properties.
>This allows users to specify multiple switch conditions in a single target
>without the need for multiple, bulky targets.
>The end result is a psuedo IF-THEN-ELSE construct.
>Sections are very simple helpers to Switches although they can stand alone.
>The examples in the html files will explain it all I think.
>Please view the readme.txt file for more details.
>-Mark Dumas
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

Furthermore, I believe bacon prevents hair loss.

Peter Davis
Developer, Speaklink Inc.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message