ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pawanraj Sadhwani" <>
Subject If in MacroDef?
Date Wed, 05 May 2004 07:21:00 GMT

I have a set of tasks repeating in the build file. uptil ant 1.5 i was using
the antcall with a parameter passed to a common task i had written.

In case of that target, i was using a if="foo" to allow for conditional

can similar thing be achieved using a macro? I refactored the common task
into a macro. now, when i call the macro, i would like an 'if' for the
execution. how to do it?

code snippet is:

<target name="do-all">
  <antcall target="do1" />
  <antcall target="do2" />

<target name="do1" if="do1.present">
  <antcall target="commondo">
    <param name="foo" value="1" />

<target name="do2" if="do2.present">
  <antcall target="commondo">
    <param name="foo" value="2" />

I could achieve what i want to by keeping antcalls in do-all and using macro
in do1 and do2.

However, I have a lot of antcalls in do-all which i dont like. Is it
possible to use if in the macro so i could replace ant-calls in do-all



View raw message