ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Richardson <>
Subject Re: depends vs. antcall
Date Fri, 13 Jul 2001 20:40:46 GMT
Diane Holt wrote:
> I use <antcall> when I have the same actions that need to be done on
> different sets of files. For example:
>   <target name="genParser" depends="chkParser" unless="parser.done">
>     <echo message="  ${msg}"/>
>     <delete>
>       <fileset dir="${directory}" includes="${rmfiles}"/>
>     </delete>
>     <java classname="COM.sun.labs.javacc.Main"
>           classpath="${jjpath}"
>                 dir="${directory}"
>                fork="yes"
>         failonerror="true">
>       <arg value="${jjfile}"/>
>     </java>
>   </target>
>   <target name="chkParser">
>     <uptodate property="parser.done"
>               targetfile="${directory}/${chkfile}" >
>       <srcfiles dir="${directory}" includes="${jjfile}" />
>     </uptodate>
>   </target>
> Doing it this way not only saves on duplicating the same code over and
> over, but since it's always run as either an <antcall> or an <ant>, I
> don't have to worry about my "done" property getting set and staying set.
> If I didn't do it this way, I'd have to come up with a different target
> name for each parser-generating target, which in turn would each need
> their own up-to-date-checking target, with their own "done" property. Ugh.

This is a very neat pattern. How do you drive this process? Do you add a
antcall target with all the changing properties for each file you want
to process with javacc?


View raw message