Fred Welland <[EMAIL PROTECTED]> 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

Reply via email to