That makes sense. The only hitch is that my "determining property" is an environment variable.
So, as you say, I have to jump through a bunch of <conditional> hoops to turn that into
one of several different properties for a <target>'s "if".
Might I propose that this would be much simpler if <target> had this construct:
<target name="..." depends="..." if="prop.name" equals="prop.value">
...
</target>
The presence of the "equals" attribute implies doing more than just testing the existence
of a property but actually testing the value of a property. So I can set the property with
a single line based on my environment variable. Then I don't need any conditionals, just the
<target>s you suggest. There could also be an "equalsIgnoreCase", and they'd both work
for "unless" also.
Thanks again,
Donnie
>>> holtdl@yahoo.com 12/19/01 01:22PM >>>
Actually, I was thinking you'd have targets with the block of properties
you need to set, conditionally running the target based on your
determining property.
Using <condition>, you'd set a property to "if" on in the property-setting
targets (eg., you'd set something like "setForVal1" if your determining
property was equal to "val1", "setForVal2" if it was equal to "val2",
etc., and have <target name="setVal1Props" if="setForVal1">).
Using Matt's <switch>, you'd just set "target" to run the property-setting
target you needed (eg., <case value="val1" target="setVal1Props"/>).
Diane
--- DONNIE HALE <DHALE@longaberger.com> wrote:
> The use of <condition> becomes tedious, it seems, for lots of conditions
> and lots of properties per condition. The <switch> task looks close, but
> I need to be able to set multiple properties per <case>:
>
> <switch value="..."> <!--for consistency, "value" should be
> "property"-->
> <case value="val1">
> <property name="prop1" value="prop1.1" />
> <property name="prop2" value="prop2.1" />
> </case>
> <case value="val2">
> <property name="prop1" value="prop1.2" />
> <property name="prop2" value="prop2.2" />
> </case>
> ...
> </switch>
>
> Hope that makes sense. At that point, the clarity and length of the .xml
> file vs. my shell script is about equal.
>
> If <switch> is enhanced that way, I'd say add it as a core task. :)
>
> Thanks,
>
> Donnie
>
>
> >>> holtdl@yahoo.com 12/19/01 11:51AM >>>
> --- DONNIE HALE <DHALE@longaberger.com> wrote:
> > We've only got one target - the .ear file. What we have is four
> > different WebLogic "domains" - unit, int, qa, and "arch" (for
> > architecture testing, etc.). Each of those imply different
> directories,
> > admin server ports, etc. The shell script has a case statement that
> sets
> > up all this very nicely, and with Ant's current facilities, it's much
> > more convoluted. Now if Ant had a <case> task ... :)
>
> I take it you don't think <condition> would do it for you? (I think I
> could see it being used, but then, I haven't seen your shell-script.)
> But
> if you don't think it would, you might want to consider asking Matt
> Inger
> for his <switch> task -- see:
> http://marc.theaimsgroup.com/?l=ant-dev&m=99409422803319&w=2
>
> Diane
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
>
=====
(holtdl@yahoo.com)
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
--
To unsubscribe, e-mail: <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
|