ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Question about <arg>s in <exec>
Date Thu, 16 Nov 2000 18:39:32 GMT
--- Stanislas Pinte <> wrote:
> At 07:07 PM 11/15/00 -0800, you wrote:
> >Conditionally set a property, ${Vflag}, then pass that in the <arg>
> >instead of hard-coding the -V${label} in the <arg>.
> Could you give an example, please? I couldn't understand what you mean.

Sorry about that -- should have tested it before I suggested it. I thought
if the property wasn't set, the value for <arg> would just resolve to
nothing, but it turns out it actually passes the *literal string*
${prop_name}. (Yuck!) So you'd have to have a two-way switch for setting
Vflag, which means you'd need to do that for each of the three other
conditional properties (you said there were four altogether, right?) 
Unless they're all connected -- ie., does having the "label" property set
imply all four will be? If that were the case, you'd only need a two-way
switch on "label", and have all four get set in the one target (okay,
actually two targets, but you know what I mean :)

In any case, this is what it amounts to (as an example just for the
setting of -V${label}:

  <target name="setVflag" if="label">
    <property name="Vflag" value="-V${label}"/>
  <!-- Set the property to nothing so <exec> doesn't pass literal --> 
  <target name="setNoVflag" unless="label">
    <property name="Vflag" value=""/>

  <target name="fetch" depends="setVflag,setNoVflag">
    <exec dir="${src}" executable="ss">
      [your other args...]
      <arg value="${Vflag}"/>
      <arg value="-GL${basedir}\${fetchToDir}"/>

Hope that's a little clearer,


Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!

View raw message