ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: How Do I do conditionally set a prop (not OS specific prop).
Date Thu, 29 Mar 2001 14:18:51 GMT
Fred Welland <fwelland@intelixinc.com> wrote:

> I have a Exec target like the follwoing:
> 
> <target name="my_target">
>     <property name="my_path" refid="some.other.path"/>
>     <exec    dir="${outdir}"
>                    excutable="${my_bin}/my_prog"
>                    failonerror="yes">
>                     <arg line="-debug -p ${my_path} parm1 parm2"/>
>     </exec>
> </target>\
> 
> I would like to conditionally include the "-debug" flag.  I am
> already using a props file where we have a property called
> "be_verbose" which is used on delete tasks (e.g <delete
> verbose="${be_verbose}" ..../>).  I would like this property to
> controll the inclusion of the -debug flag on the exec arg line.


You'll need something hacky like this

<property name="debug.${be_verbose}" value="1" />

<target name="with.debug" if="debug.true">
  <property name="cmdline" value="-debug " />
</target>

<target name="without.debug" unless="debug.true">
  <property name="cmdline" value="" />
</target>

<target name="exec" depends="with.debug,without.debug">
  <exec dir="${outdir}"
        excutable="${my_bin}/my_prog"
        failonerror="yes">
     <arg line="${cmdline}-p ${my_path} parm1 parm2"/>
</target>

Stefan

Mime
View raw message