ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Haas <>
Subject Re: JavaCC tasks for ANT
Date Mon, 26 Jun 2000 12:20:42 GMT

Attached please find our implemenmtation of a JavaCC task.

Our build file looks like the following:
<target name="javacc">
<mkdir dir="${}"/>
<element location="${}"/>
<element location="${lib.metamata}"/>
<deltree dir="${}"/>

The variables tool.metamata.home, tool.metamata.workdir and lib.metamata
are set like the following:

tool.metamata.home: directory where metamata is installed with the
following contents:

tool.metamata.workdir: some directory created and erased used by javacc
to put temp. files in.

lib.metamata: points to the jar ${tool.metamata.home}/lib/metamata.jar

javacc cleans up some files left behind javacc lik OO393.class and other
javacc only rebuilds the .java files if the .jj files are newer

Use file matching or multiple file arguments

This is in production for 3 months now at our site.

Feedback welcomed.

- tom (Marius Scurtescu) wrote:
 > Hi all,
 > I am writing you because while checking the ANT mailing
 > list archives I saw that you were interested in JavaCC
 > related tasks for ANT.
 > Since running JJTree and JavaCC are time consuming my
 > main problem is running them only if the source grammar
 > file was touched. While you can get this quite easily
 > with a classic make utility, there is no support for
 > this in ANT. Do you have a solution for this?
 > The way I run JavaCC is by using a "java" task to
 > run the main applications directly:
 > <target name="jjdoc" depends="jj">
 > <java classname="COM.sun.labs.jjdoc.JJDocMain" args="-OUTPUT_FILE= 
Doc/grammar.html java.jj" fork="yes"/>
 > </target>
 > <target name="jj" depends="jjt">
 > <java classname="COM.sun.labs.javacc.Main" args="-OUTPUT_DIRECTORY= 
Source/parser java.jj" fork="yes"/>
 > </target>
 > <target name="jjt">
 > <java classname="COM.sun.labs.jjtree.Main" args="-OUTPUT_DIRECTORY= 
Source/parser java.jjt" fork="yes"/>
 > <rename src="Source/parser/java.jj" dest="java.jj"/>
 > </target>
 > This will work assuming that is in your class path.
 > To solve the time stamp based conditional task run I was
 > thinking to create a generic task that will add a property
 > based on time stamp comparison between two sets of files, the
 > inputs and outputs to some other task. This other task/targets
 > could then be run only if this property is set.
 > Please let me know if all this makes sense in your opinion.
 > Cheers,
 > Marius

View raw message