1 | <?xml version="1.0"?> |
---|
2 | <project name="java" default="test"> |
---|
3 | <tstamp/> |
---|
4 | <property name="debug" value="true"/> |
---|
5 | <property name="project.name" value="ANTLR Java Parser sample"/> |
---|
6 | <property name="project.FormalName" value="jparse"/> |
---|
7 | |
---|
8 | <property name="src.dir" value="."/> |
---|
9 | <property name="build.dir" value="bin"/> |
---|
10 | <property name="antlr.dir" value="..\..\.."/> |
---|
11 | |
---|
12 | <echo message="Building project: '${project.name}'"/> |
---|
13 | |
---|
14 | <target name="clean" description="cleans up everything"> |
---|
15 | <echo message="Deleting directory '${build.dir}': You should rebuild VS.NET project in '${build.dir}\..'."/> |
---|
16 | <delete file="JavaLexer.cs" failonerror="false"/> |
---|
17 | <delete file="JavaRecognizer.cs" failonerror="false"/> |
---|
18 | <delete file="JavaTokenTypes.cs" failonerror="false"/> |
---|
19 | <delete file="JavaTokenTypes.txt" failonerror="false"/> |
---|
20 | <delete file="JavaTreeParser.cs" failonerror="false"/> |
---|
21 | <delete file="JavaTreeParserTokenTypes.cs" failonerror="false"/> |
---|
22 | <delete file="JavaTreeParserTokenTypes.txt" failonerror="false"/> |
---|
23 | <delete dir="${build.dir}" failonerror="false"/> |
---|
24 | </target> |
---|
25 | |
---|
26 | <target name="generate" description="calls ANTLR to generate Lexers/Parsers"> |
---|
27 | <exec program="java.exe" commandline="-cp ${antlr.dir} antlr.Tool java.g" failonerror="true"/> |
---|
28 | <exec program="java.exe" commandline="-cp ${antlr.dir} antlr.Tool java.tree.g" failonerror="true"/> |
---|
29 | </target> |
---|
30 | |
---|
31 | <target name="release" depends="clean" description="build non-debug version"> |
---|
32 | <!-- build a clean release distribution for release --> |
---|
33 | <property name="debug" value="false"/> |
---|
34 | <echo message="Debug = ${debug}"/> |
---|
35 | <call target="build"/> |
---|
36 | </target> |
---|
37 | |
---|
38 | <target name="build" depends="generate" description="compiles the source code"> |
---|
39 | <mkdir dir="${build.dir}"/> |
---|
40 | <!-- copy the assemblies required to build example to the build folder --> |
---|
41 | <copy file="${antlr.dir}\lib\csharp\antlr.runtime\bin\antlr.runtime.dll" tofile="${build.dir}\antlr.runtime.dll" /> |
---|
42 | <copy file="${antlr.dir}\lib\csharp\antlr.astframe\bin\antlr.astframe.dll" tofile="${build.dir}\antlr.astframe.dll" /> |
---|
43 | |
---|
44 | <!-- compile example's ${project.name}.exe --> |
---|
45 | <csc target="exe" output="${build.dir}\${project.FormalName}.exe" debug="${debug}"> |
---|
46 | <sources basedir="${src.dir}"> |
---|
47 | <includes name="**/*.cs"/> |
---|
48 | </sources> |
---|
49 | <references> |
---|
50 | <includes name="${build.dir}\antlr.runtime.dll"/> |
---|
51 | <includes name="${build.dir}\antlr.astframe.dll"/> |
---|
52 | </references> |
---|
53 | <arg value="/nowarn:1591"/> |
---|
54 | </csc> |
---|
55 | </target> |
---|
56 | |
---|
57 | <!-- |
---|
58 | Perform unit tests. If a unit test fails, the build fails. |
---|
59 | The base directory is set to the Test directory so that tests can easily |
---|
60 | load external data files wihtout having to worry about complicated paths. |
---|
61 | --> |
---|
62 | |
---|
63 | <target name="test" depends="build" description="run unit tests"> |
---|
64 | <exec program="${build.dir}\${project.FormalName}.exe" commandline=" -showtree ${src.dir}\tests\Main.java" failonerror="true"/> |
---|
65 | </target> |
---|
66 | </project> |
---|