1 | <?xml version="1.0"?> |
---|
2 | <project name="columns" default="test"> |
---|
3 | <tstamp/> |
---|
4 | <property name="debug" value="true"/> |
---|
5 | <property name="project.name" value="ANTLR example - parseBinary"/> |
---|
6 | <property name="project.FormalName" value="parseBinary"/> |
---|
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="L.cs" failonerror="false"/> |
---|
17 | <delete file="LTokenTypes.cs" failonerror="false"/> |
---|
18 | <delete file="LTokenTypes.txt" failonerror="false"/> |
---|
19 | <delete dir="${build.dir}" failonerror="false"/> |
---|
20 | </target> |
---|
21 | |
---|
22 | <target name="generate" description="calls ANTLR to generate Lexers/Parsers"> |
---|
23 | <exec program="java.exe" commandline="-cp ${antlr.dir} antlr.Tool data.g" failonerror="true"/> |
---|
24 | </target> |
---|
25 | |
---|
26 | <target name="release" depends="clean" description="build non-debug version"> |
---|
27 | <!-- build a clean release distribution for release --> |
---|
28 | <property name="debug" value="false"/> |
---|
29 | <echo message="Debug = ${debug}"/> |
---|
30 | <call target="build"/> |
---|
31 | </target> |
---|
32 | |
---|
33 | <target name="build" depends="generate" description="compiles the source code"> |
---|
34 | <mkdir dir="${build.dir}"/> |
---|
35 | <!-- copy the assemblies required to build example to the build folder --> |
---|
36 | <copy file="${antlr.dir}\lib\csharp\antlr.runtime\bin\antlr.runtime.dll" tofile="${build.dir}\antlr.runtime.dll" /> |
---|
37 | |
---|
38 | <!-- compile example's ${project.name}.exe --> |
---|
39 | <csc target="exe" output="${build.dir}\${project.FormalName}.exe" debug="${debug}"> |
---|
40 | <sources basedir="${src.dir}"> |
---|
41 | <includes name="**/*.cs"/> |
---|
42 | </sources> |
---|
43 | <references> |
---|
44 | <includes name="${build.dir}\antlr.runtime.dll"/> |
---|
45 | </references> |
---|
46 | <arg value="/main:AppMain"/> |
---|
47 | <arg value="/nowarn:1591"/> |
---|
48 | </csc> |
---|
49 | <!-- compile example's MkData.exe --> |
---|
50 | <csc target="exe" output="${build.dir}\MkData.exe" debug="${debug}"> |
---|
51 | <sources basedir="${src.dir}"> |
---|
52 | <includes name="**/*.cs"/> |
---|
53 | </sources> |
---|
54 | <references> |
---|
55 | <includes name="${build.dir}\antlr.runtime.dll"/> |
---|
56 | </references> |
---|
57 | <arg value="/main:MkData"/> |
---|
58 | <arg value="/nowarn:1591"/> |
---|
59 | </csc> |
---|
60 | </target> |
---|
61 | |
---|
62 | <!-- |
---|
63 | Perform unit tests. If a unit test fails, the build fails. |
---|
64 | The base directory is set to the Test directory so that tests can easily |
---|
65 | load external data files wihtout having to worry about complicated paths. |
---|
66 | --> |
---|
67 | |
---|
68 | <target name="test" depends="build" description="run unit tests"> |
---|
69 | <sysinfo verbose="false" /> |
---|
70 | <exec program="${sys.os.folder.system}\command.com" commandline="/C ${build.dir}\MkData.exe " failonerror="true"/> |
---|
71 | <exec program="${sys.os.folder.system}\command.com" commandline="/C ${build.dir}\${project.FormalName}.exe < ${src.dir}\data" failonerror="true"/> |
---|
72 | </target> |
---|
73 | </project> |
---|