ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Häfelinger <whaefelin...@epo.org>
Subject Re: using multiple properties in the 'if' and 'unless' conditions
Date Mon, 26 Jun 2006 12:00:09 GMT
> -What is the existing one you'd recommend? XPath 1.0? Perl? 
> Pascal-style, Ruby-Style?

I implemented the "test" expression logic found in popular shells, left a 
couple of
tests out (like -p, -O etc) and added a couple of usefull tests like
 -P s  => test whether "s" is a reference
 -R s  => test whether "s" is a reference
 -T s  => test whether "s" is a target
 -M s  => test whether "s" is a macro or task
 ...

> what functions to test for. defined/undefied, true/false, equality?

and also numerical comparison, older/newer then, length of a string ..

> How would I be able to declare and add new functions or operators into 
the language?

You would use the same technique as we are currently using in Ant to 
install my
own property or component handler.

-What are we going to use as a parser; the recursive descent thingy 
built in to java, or use ANTLR to generate our own from the BNF nota

I do not have an opinion on this (ANTLR is fine with me, after all I'm one 
of the contributors :-)

-How are we going to test the language?

Unit tests etc, where's the probem?

-How do we roll it out to other conditional types such as fail?

Add a new attribute named "test" (and deprecate "if"). If "if" and "test" 
are present
do something like  eval(test) && eval(if).

Another idea is to stay with "if" (and "unless") and change it's 
evaluation on demand:

<expression-lang  use="test" />

<fail if="-f some-file" ../>

<expression-lang pop="true" />     fall back to whatever was there before 
using "test"

<fail if="some-property" .. />



Btw, we need to have a quota character. For example

<fail  test=" -d 'C:/Program Files'  " message="..." />


Wolfgang.





Steve Loughran <stevel@apache.org> 
26-06-2006 13:17
Please respond to
"Ant Developers List" <dev@ant.apache.org>


To
Ant Developers List <dev@ant.apache.org>
cc

Subject
Re: using multiple properties in the 'if' and 'unless' conditions






Wolfgang Häfelinger wrote:
>> Which one would you prefer?  Or should we invent a new one?
> 
> Use an existing one of course. There could also be more than one,
> just supported by a "language" attribute.
> 
>> We do have the "clumsy" XML expression language that we built into the
>> condition task and it follows the rest of Ant's "language".
> 
> I do not see  your point why an embedded expression language would
> not follow Ant's language terms. Perhaps you can elaborate on this
> bit further.
> 
>> And regardless which existing language we'd chose, we'd always find 
>> users who'd find it hard to use - not all Ant users are Java 
>> developers and are able to read "a && b".
> 
> Users who do not understand feature are not obligied to use them and
> I still  believe that users quickly get the idea what "a && b" could
> mean. After all, you also need a lot of imagniation to understand 
> what you can do with Ant, right?
> 
> The  only  problem with "&"  is that it is an "XML" character as 
> well.


so clearly then, java booleans are not the obvious choice.
-What is the existing one you'd recommend? XPath 1.0? Perl? 
Pascal-style, Ruby-Style?
-what functions to test for. defined/undefied, true/false, equality?
-How would I be able to declare and add new functions or operators into 
the language?
-What are we going to use as a parser; the recursive descent thingy 
built in to java, or use ANTLR to generate our own from the BNF notation.
-How are we going to test the language?
-How do we roll it out to other conditional types such as fail?

I can see a conditional target as a more likely option.

<ctarget>
   <condition>
    </condition>
   <sequence>
   </sequence>
</ctarget>


-steve

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message