ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose Alberto Fernandez <JFernan...@viquity.com>
Subject RE: [PATCH] Allow check for values on if/unless <target>
Date Tue, 10 Oct 2000 18:31:25 GMT
The problem I have with only allowing checking for property existance is
that it really causes the pollution of the files with lots  and lots of
auxiliary properties whose only reason of existance is trying to check for a
simple value. So if the user configuration passes me a property with three
possible different values I will need to add three new properties to check
for it.

Now I know I could write my own little task to do this, but it seems to me
such a simple capability should be available in the core. Would you be
willing to add such a task to core if I do create it. I am thinking of:

  <case property="prop.name" >
    <when value="value1" property="prop.name.value1" />
    <when value="value2" property="prop.name.value2" />
    <else property="prop.name.noneoftheabove" value="none" />
  </case>

The when clauses specify which property to set (to the value of prop.name)
if such value is the one specified. The else clause tells a property and
value to set if none of the else clauses apply; if no value is provided for
the else, the default is the value of the property or "true" if it was not
set.

If I give you this task, soon enough,would you be willing to add it?
I think you can not get more declarative than that. I need to know because
otherwise I will add it as part of our project tasks, so this will affect
which package names I must use.

Let me know....

Jose Alberto

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Tuesday, October 10, 2000 2:03 AM
> To: ant-dev@jakarta.apache.org
> Subject: Re: [PATCH] Allow check for values on if/unless <target>
> 
> 
> >>>>> "JAF" == Jose Alberto Fernandez <JFernandez@viquity.com> writes:
> 
>  JAF> Notice that the only thing you can do is check for equality "="
>  JAF> and everything counts: spaces included. I dead that is I use ==
>  JAF> people will want: !=, <=, or whatever.
> 
> I'm afraid they will do anyway, once you open this up - including &&
> and || of course as well as indexOf to check for substrings ...
> 
> Personally I'd prefer to not include you patch. It is quite easy to
> write your own task that sets a property if another one has a given
> value, you could even use scripting for it.
> 
> Stefan
> 

Mime
View raw message