The if task has 2 properties to handle what you are describing. One is "propertyexists" and the other is "propertytrue".
So, the following is what you want I think. (I have updated the source so the existence check is done before the true check. It is an AND operation if both are used.)
 
<if propertyexists="propName" propertytrue="propName">
 
</>
 
This is what should happen.
 
No exceptoin should be thrown, ever.
<if propertyexists="propName">
   
</>
 
An exception may be thrown if exists check is not done first. If we end up changing "not true" == false for all properties (ie null/false == false) then this should change too.
<if propertytrue="propName">
   
</>
 
I still think there is a big difference between propertyexists and propertytrue.
 
Take this example:
<property name="output.dir" value="run1output"/>
 
...
<!-- ifnot is an if with a !result returned -->
<ifnot propertyexits="output.dir">
</>
 
or
 
<property name="setup.dir" value="setupfiles"/>
...
<if propertyexists="setup.dir">
    <call target="make.setup"/>
</>
----- Original Message -----
Sent: Thursday, March 06, 2003 8:35 AM
Subject: [nant-dev] proposal : change to if task behaviour

Hi,
 
I'd like to change the behaviour of the if task :
 
right now, the if task throw a buildexception when you use the propertyexists check and the property does not exist.
 
I'd like to change this behaviour to the following :
 
propertyexists is true when the property exists AND is true
 
propertyexists is false when the property does NOT exist OR the property is false
 
What do you guys think about this proposal ?
 
Thanks,
 
Gert

Reply via email to