I'm a oldtime make user who is now adjusting to ant (which I love BTW).

In make you use dependencies to enforce ordering of targets.  You can do the same 
thing in ant using the "depends" attribute.  In ant you can also directly invoke other 
ant targets using the "antcall" builtin task.  The build files below are similar in 
that the "all" target causes "subtask" to be run and then "all"; one uses antcall the 
other uses depends.  The "antcall" solution has the side-effect of unconditionally 
invoking all dependencies of "subtask" so in this example you see the "init" target 
invoked twice.  However "antcall" is nice in that you can pass properties to the 
invoked target.

So I guess I'm just looking for best practice advice here.  Do people avoid antcall?  
Use it a lot? As needed?  I dislike the reinvocation of the "init" target but don't 
know how else to build a reusable target that can be invoked at oher points in the 
build file (with  varying properties as arguments).

Thanks for your opinions!

<!-- START -->
<project name="antcall" default="all">

  <target name="init">
    <echo message="init task"/>
  </target>

  <target name="all" depends="init">
    <antcall target="subtask"/>
    <echo message="all task"/>
  </target>

  <target name="subtask" depends="init">
    <echo message="subtask task"/>
  </target> 

</project>
<!-- END -->

<!-- START -->
<project name="depends" default="all">

  <target name="init">
    <echo message="init task"/>
  </target>

  <target name="all" depends="init,subtask">
    <echo message="all task"/>
  </target>

  <target name="subtask" depends="init">
    <echo message="subtask task"/>
  </target> 

</project>
<!-- END -->


------------------------------------------------------------------
John Lindwall                              mailto:[EMAIL PROTECTED]
XIFIN                                      http://www.xifin.com
2233 Faraday Ave Ste A, Carlsbad CA 92008  (760) 804-0770 ext 16

This message is for the sole use of the intended recipient(s) and may contain 
confidential and privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, please contact the 
sender and destroy all copies of the original message.

Reply via email to