--- "Tenchi-kun (Elliott)" <[EMAIL PROTECTED]> wrote:
>   <target name="Target1.A" if="kung">
>     <antcall target="Target1">
>       <param name="foo" value="${foo}" />
>       <param name="kung" value="fu" />
>     </antcall>
>   </target>
>   <target name="Target1.B" unless="kung">
>     <antcall target="Target1">
>     <param name="foo" value="${foo}" />
>     </antcall>
>   </target>

The drawback to doing it this way is that there's no real connection
between the two targets (other than that they both test on the same
property). In other words, you'd need to call them both independently.

If you want to go with two targets, it'd probably be better to have one
target that depends on the alternative, which, if it runs, sets a property
that the dependent target tests on:
  <target name="callTarget1" depends="callT1WithKung"
          unless="antcall.done">
    <antcall target="target1">
      <param name="foo" value = "bar"/>
    </antcall>
  </target>
  <target name="callT1WithKung" if="keyProp">
    <antcall target="target1">
      <param name="foo" value = "bar"/>
      <param name="kung" value = "fu"/>
    </antcall>
    <property name="antcall.done" value="true"/>
  </target>

Alternatively, you could go with the ant-contrib <if> task:
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <target name="callTarget1">
    <if>
      <isset property="keyProp"/>
      <then>
        <antcall target="target1">
          <param name="foo" value = "bar"/>
          <param name="kung" value = "fu"/>
        </antcall>
      </then>
      <else>
        <antcall target="target1">
          <param name="foo" value = "bar"/>
        </antcall>
      </else>
    </if>
  </target>

Note: condition <isset> is only available with 1.5alpha; to use this
approach with 1.4.1 use <equals> with 'arg2="$$keyProp"' (and reverse the
logic).

I've just picked up all the ant-contrib tasks today and put them in a jar,
so if you'd like them, let me know.

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to