ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject RE: how can i use a property to enable/disable a general target
Date Mon, 12 Aug 2002 14:20:46 GMT
Try this:

<project name="test" default="invokeme" basedir=".">

  <target name="checkprop">
    <condition property="propset">
      <isset property="myproperty" />
    </condition>
  </target>

  <target name="invokeme"
          depends="checkprop"
          if="propset">
    <echo message="Here we go!" />
  </target>

</project>

Is this what you want to do?

-Matt


--- Tibor  Strausz <Tibor.Strausz@tridion.com> wrote:
> i now have this:
> but is this the sortest and or best way??
> 
> thnx
> tibi
> 
> <?xml version="1.0"?>
> <project name="test" basedir="." default="c">
> 
>   <property name="run_a" value="yes"/>
>   <property name="run_b" value="no"/>
>   
>   <target name="a" if="run">
>     <echo>a ${run}</echo>
>   </target>
>   
>   <target name="b" if="run">
>     <echo>b ${run}</echo>
>   </target>
>   
>   
>   <target name="router">
>     <echo>runTarget: ${runTarget}</echo>
>     <condition property="run">
>       <istrue value="${runTarget}" />
>     </condition>
>     <echo>run: ${run}</echo>
>     <antcall target="${target}"/>
>   </target>
> 
> 
>   <target name="c">
>     <antcall target="router">
>       <param name="runTarget" value="${run_a}"/>    
>       <param name="target" value="a"/>    
>     </antcall>
> 
>     <antcall target="router">
>       <param name="runTarget" value="${run_b}"/>    
>       <param name="target" value="b"/>    
>     </antcall>
>   </target>
> 
> </project>
> 
> 
> 
> > -----Original Message-----
> > From: Geoff Meakin [mailto:geoffm@isocra.com]
> > Sent: Monday, August 12, 2002 12:23 PM
> > To: Ant Users List
> > Subject: RE: how can i use a property to
> enable/disable a 
> > general target
> > 
> > 
> > An easy, although perhaps not particularly
> attractive way of 
> > doing this is
> > to define a router-task, that you antcall, with
> the 
> > router-task depending
> > on the RunBat. That way you get the if/unless
> working again
> > 
> > e.g.
> > 
> > <antcall target="RunBat_router">
> >   <params  etc.. />
> > </antcall>
> > 
> > <target name="RunBat_router" depends="RunBat"/>
> > <target name="RunBat" if="BuildTypeLib">
> >   do whatever...
> > </target>
> > 
> > 
> > There's probably a neater way of doing it though.
> > In fact is there? Cos if there is I'd like to know
> :)
> > 
> > Cheers
> > -Geoff
> > 
> > 
> > -----Original Message-----
> > From: Tibor Strausz
> [mailto:Tibor.Strausz@tridion.com]
> > Sent: 12 August 2002 10:40 AM
> > To: Ant Users List (E-mail)
> > Subject: how can i use a property to
> enable/disable a general target
> > 
> > 
> > 
> > hi,
> > 
> > main question: how can i use a property to
> enable/disable a 
> > general target.
> > 
> > i have a general target which i execute from a
> main target 
> > with antcall with
> > differnet param's
> > like so:
> >     <antcall target="RunBat">
> >       <param name="project" 
> > value="Shared\TDSDefines\BuildTypeLib.bat"/>
> >     </antcall>
> > this is ok ;-)
> > 
> > now i have a build.properties in which the user
> can define if 
> > he want st
> > build the different steps
> > like so:
> >   <property name="BuildTypeLib" value="yes"/>
> > 
> > how can i use this property so that the general
> RunBat will 
> > only build if
> > ${BuildTypeLib} == true
> > 
> > if can't use <traget name="RunBat"
> if="${BuildTypeLib}"/> 
> > because its a
> > general task (and the if only looks at if the
> BuildTypeLib is 
> > defined and
> > not if its true/yes/on but thats a minor problem
> which i can 
> > work arround
> > ;-)
> > 
> > thnx
> > 
> > tibi
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Mime
View raw message