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 Wed, 14 Aug 2002 13:40:34 GMT
Since it seems you are checking more than once the
value of a property which you do not expect to change,
you could do it only once:

<target name="buildSources" depends="checkruntarget"
        if="run" description="Building the sources.">
  <!-- antcalls calling CPPProject here -->
</target>

<target name="checkruntarget">
  <condition property="run">
    <istrue value="${runTarget}" />
  </condition>
</target>

-Matt

--- Tibor  Strausz <Tibor.Strausz@tridion.com> wrote:
> yes i want to re-check the same property for now i
> have the following wich
> looks ok to me.
> but if there is a shorter nicer better way i'm hapy
> to hear it :-)
> 
> 
> 
>   <target name="buildSources" description="Building
> the sources.">
>  
>
<!--Installers\CustomActions\VC\TDSDialogValidation\TDSDialogValidation.dsp-
> ->
>     <antcall target="router">
>       <param name="make" value="TDSDialogValidation
> - Win32 Unicode
> Release"/>
>       <param name="target" value="CPPProject"/>  
>       <param name="project"
> value="TDSDialogValidation"/>  
>       <param name="runTarget"
> value="${TDSDialogValidation}"/>  
>       <param name="projectFile"
>
value="Installers\CustomActions\VC\TDSDialogValidation\TDSDialogValidation.d
> sp"/>  
>     </antcall>
> 
>
<!--Installers\CustomActions\VC\TDSMSMQ\TDSMSMQ.dsp-->
>     <antcall target="router">
>       <param name="make" value="TDSMSMQ - Win32
> Unicode Release"/>
>       <param name="target" value="CPPProject"/>  
>       <param name="project" value="TDSMSMQ"/>  
>       <param name="runTarget" value="${TDSMSMQ}"/>  
>       <param name="projectFile"
>
value="Installers\CustomActions\VC\TDSMSMQ\TDSMSMQ.dsp"/>
>  
>     </antcall>
> 
>
<!--Installers\CustomActions\VC\TDSMTSUsr\TDSMTSUsr.dsp-->
>     <antcall target="router">
>       <param name="make" value="TDSMTSUsr - Win32
> Unicode Release"/>
>       <param name="target" value="CPPProject"/>  
>       <param name="project" value="TDSMTSUsr"/>  
>       <param name="runTarget" value="${TDSMTSUsr}"/>
>  
>       <param name="projectFile"
>
value="Installers\CustomActions\VC\TDSMTSUsr\TDSMTSUsr.dsp"/>
>     </antcall>
> [...]
> 
>  </target>
> 
> <!--======-->
> <!--router-->
> <!--======-->
>   <target name="router" description="This will set
> the run property if
> runTarget is true and antcall's the target">
>     <condition property="run">
>       <istrue value="${runTarget}" />
>     </condition>
>     <antcall target="${target}">
>     </antcall>
>   </target>
> 
> <!--===================-->
> <!--=BUILD: CPPProject=if="run"-->
> <!--===================-->
>   <target name="CPPProject" description="make a
> CPPProject" if="run">
>     <echo>Project: ${project}
> Make: ${make}
> File: ${projectFile} 
> Log: ${logDir}\${project}.log</echo>
>     <exec executable="${msdevExe}">
>       <arg line="'${srcDir}\${projectFile}' /MAKE
> '${make}' /REBUILD /OUT
> '${logDir}\${project}.log'"/>
>     </exec>
>   </target>
>  
> 
> 
> > -----Original Message-----
> > From: Matt Benson [mailto:gudnabrsam@yahoo.com]
> > Sent: Tuesday, August 13, 2002 11:31 PM
> > To: Ant Users List
> > Subject: RE: how can i use a property to
> enable/disable a 
> > general target
> > 
> > 
> > Okay, I'm not sure what you're after.  Do you want
> to
> > check for the existence of different properties in
> one
> > run of Ant using only one target?  Or are you
> wanting
> > to re-check the same property over and over?  I
> had
> > the problem of getting the reset property warning
> when
> > the same target was invoked twice, so I did this:
> > 
> > <target name="init" unless="init.done">
> >   <!-- do some stuff -->
> >   <property name="init.done" value="true" />
> > </target>
> > 
> > This allowed me to execute only once, but would
> only
> > be good for checking the value of one property one
> > time and using the results throughout the Ant
> process.
> >  If you need to check multiple properties, the
> simple
> > way would be to use a target per each property,
> > although some dynamic way might be devised, quite
> > possibly involving <antcall>?  I dunno...
> > 
> > -Matt
> > 
> > --- Tibor  Strausz <Tibor.Strausz@tridion.com>
> wrote:
> > > well yes but now the value propset is set and
> can't
> > > be reset can it??
> > > i want to reset it because its a general target
> wich
> > > will be called more
> > > than ones and i want only some to not execute
> and
> > > some to do
> > > 
> > > tibi
> > > 
> > > > -----Original Message-----
> > > > From: Matt Benson
> [mailto:gudnabrsam@yahoo.com]
> > > > Sent: Monday, August 12, 2002 4:21 PM
> > > > To: Ant Users List
> > > > Subject: RE: how can i use a property to
> > > enable/disable a 
> > > > general target
> > > > 
> > > > 
> > > > 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>
> 
=== message truncated ===



__________________________________________________
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