You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dan Vint <dv...@dvint.com> on 2007/12/17 17:25:45 UTC

Testing properties with condition

I'm trying to use properties to control the processing within my 
script. I have several conditions that I want to test and based on 
them to stop further processing.

I think my problem lies with the not-set condition and how to handle 
this. I don't see anything in the documentation that indicates how 
<istrue> and <isfalse> should report an unset value, and I'm assuming 
isset returns true if set, but what does it return if not set?

So my big problem seems to be around using <available> to test if a 
file exists, so I have that set to true by default with

<available property='have.book' file='foo.txt'/>

Then I test with the condition:

<condition property='continue-processing'>
   <or>
	<isset property='${no.work}/>
	<isset property="${Missing.File.Present}"/>
	<not>
                <istrue property="$have.book"/>
	</not>
</or>
</condition>

So the first 2 properties go true if I want to stop, so I'm thinking 
that isset works here, have.book is really a reverse condition. If 
its set, I don't want to stop processing, so I have tires istrue and 
isset inside the not to try and make it false and that doesn't seem 
to be working.

Can anyone spot my logic probelm?

I'm using ant1.5 and can't easily change to something more current as 
there are a bunch of ant extensions that were created that I don''t 
have access to.

..dan
---------------------------------------------------------------------------
Danny Vint

Specializing in Panoramic Images of California and the West
http://www.dvint.com

voice: 510-522-4703

When H.H. Bennett was asked why he preferred to be out
shooting landscapes rather than spending time in his portrait studio:

"It is easier to pose nature and less trouble to please."

http://www.portalwisconsin.org/bennett_feature.cfm

     


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


Re: Testing properties with condition

Posted by Peter Reilly <pe...@gmail.com>.
You have use the name of the property and not the value of the property - :

<condition property="status">
 <not>
       <isset property="have.book"/>
 </not>
 </condition>

Peter

On Dec 17, 2007 4:52 PM, Dan Vint <dv...@dvint.com> wrote:
> Some more info. It appears that <not> is not working.
> SO I have this
>
> <available property='have.book' file='foo.txt'/>
> <property name="have.book" value='false'/>
>
> <condition property="status">
> <not>
>       <isset property="${have.book}"/>
> </not>
> </condition>
>
> <echo message="reset book isset: ${status}"/>
>
> <condition property="status2">
> <not>
>       <istrue value="${have.book}"/>
> </not>
> </condition>
>
> <echo message="reset book istrue: ${status2}"/>
>
> Results in:
>
> [echo] rest book isset: true
> [echo] reset book istrue: ${status2}
>
> Can anyone explain this result?
>
> thanks
>
> ..dan
>
>
> At 08:25 AM 12/17/2007, Dan Vint wrote:
> >I'm trying to use properties to control the processing within my
> >script. I have several conditions that I want to test and based on
> >them to stop further processing.
> >
> >I think my problem lies with the not-set condition and how to handle
> >this. I don't see anything in the documentation that indicates how
> ><istrue> and <isfalse> should report an unset value, and I'm
> >assuming isset returns true if set, but what does it return if not set?
> >
> >So my big problem seems to be around using <available> to test if a
> >file exists, so I have that set to true by default with
> >
> ><available property='have.book' file='foo.txt'/>
> >
> >Then I test with the condition:
> >
> ><condition property='continue-processing'>
> >   <or>
> >         <isset property='${no.work}/>
> >         <isset property="${Missing.File.Present}"/>
> >         <not>
> >                <istrue property="$have.book"/>
> >         </not>
> ></or>
> ></condition>
> >
> >So the first 2 properties go true if I want to stop, so I'm thinking
> >that isset works here, have.book is really a reverse condition. If
> >its set, I don't want to stop processing, so I have tires istrue and
> >isset inside the not to try and make it false and that doesn't seem
> >to be working.
> >
> >Can anyone spot my logic probelm?
> >
> >I'm using ant1.5 and can't easily change to something more current
> >as there are a bunch of ant extensions that were created that I
> >don''t have access to.
> >
> >..dan
> >---------------------------------------------------------------------------
> >Danny Vint
> >
> >Specializing in Panoramic Images of California and the West
> >http://www.dvint.com
> >
> >voice: 510-522-4703
> >
> >When H.H. Bennett was asked why he preferred to be out
> >shooting landscapes rather than spending time in his portrait studio:
> >
> >"It is easier to pose nature and less trouble to please."
> >
> >http://www.portalwisconsin.org/bennett_feature.cfm
> >
> >
> >
>
> ---------------------------------------------------------------------------
> Danny Vint
>
> Specializing in Panoramic Images of California and the West
> http://www.dvint.com
>
> voice: 510-522-4703
>
> When H.H. Bennett was asked why he preferred to be out
> shooting landscapes rather than spending time in his portrait studio:
>
> "It is easier to pose nature and less trouble to please."
>
> http://www.portalwisconsin.org/bennett_feature.cfm
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Re: Testing properties with condition

Posted by Dan Vint <dv...@dvint.com>.
Some more info. It appears that <not> is not working.
SO I have this

<available property='have.book' file='foo.txt'/>
<property name="have.book" value='false'/>

<condition property="status">
<not>
      <isset property="${have.book}"/>
</not>
</condition>

<echo message="reset book isset: ${status}"/>

<condition property="status2">
<not>
      <istrue value="${have.book}"/>
</not>
</condition>

<echo message="reset book istrue: ${status2}"/>

Results in:

[echo] rest book isset: true
[echo] reset book istrue: ${status2}

Can anyone explain this result?

thanks

..dan

At 08:25 AM 12/17/2007, Dan Vint wrote:
>I'm trying to use properties to control the processing within my 
>script. I have several conditions that I want to test and based on 
>them to stop further processing.
>
>I think my problem lies with the not-set condition and how to handle 
>this. I don't see anything in the documentation that indicates how 
><istrue> and <isfalse> should report an unset value, and I'm 
>assuming isset returns true if set, but what does it return if not set?
>
>So my big problem seems to be around using <available> to test if a 
>file exists, so I have that set to true by default with
>
><available property='have.book' file='foo.txt'/>
>
>Then I test with the condition:
>
><condition property='continue-processing'>
>   <or>
>         <isset property='${no.work}/>
>         <isset property="${Missing.File.Present}"/>
>         <not>
>                <istrue property="$have.book"/>
>         </not>
></or>
></condition>
>
>So the first 2 properties go true if I want to stop, so I'm thinking 
>that isset works here, have.book is really a reverse condition. If 
>its set, I don't want to stop processing, so I have tires istrue and 
>isset inside the not to try and make it false and that doesn't seem 
>to be working.
>
>Can anyone spot my logic probelm?
>
>I'm using ant1.5 and can't easily change to something more current 
>as there are a bunch of ant extensions that were created that I 
>don''t have access to.
>
>..dan
>---------------------------------------------------------------------------
>Danny Vint
>
>Specializing in Panoramic Images of California and the West
>http://www.dvint.com
>
>voice: 510-522-4703
>
>When H.H. Bennett was asked why he preferred to be out
>shooting landscapes rather than spending time in his portrait studio:
>
>"It is easier to pose nature and less trouble to please."
>
>http://www.portalwisconsin.org/bennett_feature.cfm
>
>
>

---------------------------------------------------------------------------
Danny Vint

Specializing in Panoramic Images of California and the West
http://www.dvint.com

voice: 510-522-4703

When H.H. Bennett was asked why he preferred to be out
shooting landscapes rather than spending time in his portrait studio:

"It is easier to pose nature and less trouble to please."

http://www.portalwisconsin.org/bennett_feature.cfm

     


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