forked from Tigraine/Compiler-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
72 lines (59 loc) · 2.56 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!--
Example ANT build file for compiling the YAPL compiler.
(C) 2010, ITEC, M. Taschwer
-->
<project name="YAPL Compiler" default="compile-java" basedir=".">
<description>
Example ANT build file for compiling the YAPL compiler.
Properties:
src - location of the source files
build - location where to put the compiled files
grammar - JavaCC grammar file
javacc - home directory of the JavaCC installation
yapl - test program to run the YAPL compiler
Example for compiling: ant -Djavacc=/usr/local/javacc-5.0/
Example for running: ant run -Dyapl=test01.yapl
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="bin-ant"/>
<property name="javacc" location="C:\Program Files (x86)\eclipse\plugins\sf.eclipse.javacc_1.5.17\"/>
<property name="yapl" location="test.yapl"/>
<property name="outfile" location="test.mj"/>
<property name="grammar" location="${src}/yapl/yapl.jj"/>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile-javacc" depends="init"
description="compile the grammar file">
<javacc target="${grammar}" javacchome="${javacc}" static="true"/>
</target>
<target name="compile-java" depends="compile-javacc"
description="compile the source" >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" excludes="yapl/tests/**" />
</target>
<target name="run" depends="compile-java" description="run the YAPL compiler">
<java classname="yapl.Program"> <!-- must match the class name given in ${grammar} file -->
<classpath>
<pathelement location="${build}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<arg value="${yapl}"/>
<arg value="${outfile}"/>
</java>
</target>
<target name="clean" description="remove all generated files" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="bin" />
<delete>
<fileset dir="${src}" includes="yapl\yapl.java"/>
<fileset dir="${src}" includes="yapl\yaplConstants.java"/>
<fileset dir="${src}" includes="yapl\SimpleCharStream.java"/>
<fileset dir="${src}" includes="yapl\yaplTokenManager.java"/>
<!-- add all java files generated by javacc here, which have not been modified by you! -->
</delete>
</target>
</project>