[1] | 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 - IDL"/> |
---|
| 6 | <property name="project.FormalName" value="idl"/> |
---|
| 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 idl.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="/nowarn:1591"/> |
---|
| 47 | </csc> |
---|
| 48 | </target> |
---|
| 49 | |
---|
| 50 | <!-- |
---|
| 51 | Perform unit tests. If a unit test fails, the build fails. |
---|
| 52 | The base directory is set to the Test directory so that tests can easily |
---|
| 53 | load external data files wihtout having to worry about complicated paths. |
---|
| 54 | --> |
---|
| 55 | |
---|
| 56 | <target name="test" depends="build" description="run unit tests"> |
---|
| 57 | <sysinfo verbose="false" /> |
---|
| 58 | <exec program="${sys.os.folder.system}\command.com" commandline="/C ${build.dir}\${project.FormalName}.exe < ${src.dir}\test.idl" failonerror="true"/> |
---|
| 59 | </target> |
---|
| 60 | </project> |
---|