OK I will give that a shot.

I might even take dance lessons =)

Thanks,

Cory

-----Original Message-----
From: Diane Holt [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 5:43 PM
To: [EMAIL PROTECTED]
Subject: RE: Using IF


Maybe it would help if you think of the if/unless as a test for the
property's existence, since it will only exist if it's set to something
(the example property-name given in your quote is somewhat misleading,
since it includes "IsSetTo" rather than simply "IsSet").

If you need to test against the actual value of the property, you can use
the (new to 1.4) <condition> task, in which case you would most likely
then "if" on the existence of the property that got set (or not) by
<condition>. For example:

  <target name="areWeDancing">
    <condition property="letsDance">
      <and>
        <equals arg1="${dance}" arg2="funkyChicken"/>
        <not>
          <equals arg1="${dance}" arg2="theTwist"/>
        </not>
      </and>
    </condition>
  </target>

  <target name="doWork" depends="areWeDancing,danceFirst">
    <echo message="Workworkwork..."/>
  </target>

  <target name="danceFirst" if="letsDance">
    <echo message="Cluckitycluckcluck..."/>
  </target>

$ ant doWork
doWork:
     [echo] Workworkwork...

$ ant -Ddance=theTwist doWork
doWork:
     [echo] Workworkwork...

$ ant -Ddance=funkyChicken doWork
danceFirst:
     [echo] Cluckitycluckcluck...
doWork:
     [echo] Workworkwork...

Note: I edited out the header and footer output, but I didn't need to edit
out the targets that didn't actually do anything, since I always use
NoBannerLogger as my logger. (Just throwin' in another little plug to have
it be the default :)

Diane

--- Cory Adams <[EMAIL PROTECTED]> wrote:
> I think I'm still missing something.
> 
> what would the following transalte to: if="danceTypeIsSetToFunkyChicken"
> 
> Is that really saying if (property != null)  ?????  If so we really
> need: if
> (property == "someCrazyValue").
> 
> I could not find the <condition> tag in the docs from the Jakarta site
> either???
> 
> Also how might we pull the OS type?  I need to change behavior based off
> of
> whether or not I'm running on NT vs Unix.
> 
> Thanks,
> 
> Cory
> 
> -----Original Message-----
> From: J. Matthew Pryor [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 13, 2001 9:07 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Using IF
> 
> 
> Unless I missed it, I can't find an example of it in the documentation
> for
> 1.4, but I think the <equals> element of <condition> is what you want
> 
> Something like :
> 
>   <condition property="danceTypeIsSetToFunkyChicken">
>       <equals arg1="${danceType}" arg2="FunkyChicken"/>
>   </condition>
> 
>   <target name="doTheFunkyChicken if="danceTypeIsSetToFunkyChicken">
>       <doTheFunkyChicken/>
>   </target>
> 
> I haven't tested it yet, but I will
> 
> jmp
> 
> 
> > -----Original Message-----
> > From: Diane Holt [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 13, 2001 5:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Using IF
> >
> >
> > --- Cory Adams <[EMAIL PROTECTED]> wrote:
> > > Could somebody please help me with regard to using if statments in
> Ant?
> >
> > As of release 1.4, you can use the <condition> task to test the value
> of a
> > property (see the doc for examples). The if/unless attributes of
> <target>
> > are only for testing whether a property is set/not-set.
> >
> > Diane
> >
> > =====
> > ([EMAIL PROTECTED])
> >
> >
> >
> > __________________________________________________
> > Terrorist Attacks on U.S. - How can you help?
> > Donate cash, emergency relief information
> > http://dailynews.yahoo.com/fc/US/Emergency_Information/
> 
> 


=====
([EMAIL PROTECTED])



__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

Reply via email to