-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
91 lines (79 loc) · 2.58 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<project name="Compiler" default="jar" basedir=".">
<property name="cup" location="cup" />
<property name="jflex" location="jflex" />
<property name="src" location="src" />
<property name="java" location="java" />
<property name="classes" location="classes" />
<property name="dist" location="jar" />
<property name="lib" location="lib" />
<property name="bin" location="bin" />
<property environment="env" />
<!-- We rely on CUP-11a JFlex 1.4.1 -->
<!-- Here compile time tools -->
<path id="binaries">
<pathelement location="${bin}" />
<fileset dir="${bin}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
<pathelement path="${java.class.path}" />
<pathelement path="${classes}" />
</path>
<!-- Here, the runtime libraries are stored -->
<path id="libraries">
<pathelement location="${lib}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
<pathelement path="${java.class.path}" />
</path>
<!-- We also use JFlex -->
<taskdef name="jflex"
classname="JFlex.anttask.JFlexTask"
classpath="${bin}/JFlex.jar"
/>
<!-- We also use CUP-11a -->
<taskdef name="cup"
classname="java_cup.anttask.CUPTask"
classpath="${bin}/java-cup-11a.jar"
/>
<target name="init">
<mkdir dir="${classes}"/>
<mkdir dir="${java}"/>
<mkdir dir="${dist}"/>
</target>
<target name="cup" depends="init">
<cup srcfile="${cup}/Parser.cup"
destdir="${java}"
interface="true"
parser="Parser"
/>
</target>
<target name="jflex" depends="init">
<jflex file="${jflex}/Scanner.jflex" destdir="${java}" />
</target>
<target name="compile" depends="jflex,cup">
<javac srcdir="${java}" destdir="${classes}">
<classpath refid="libraries" />
</javac>
</target>
<target name="jar" depends="compile">
<jar jarfile="${dist}/Compiler.jar" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="Raptor.Parser" />
<!-- CUP runtime is needed for parsing! -->
<attribute name="Class-Path" value="java-cup-11a-runtime.jar" />
</manifest>
</jar>
<!-- Thrid party libraries can only be found by java -jar if they reside in the same dir -->
<copy todir="${dist}">
<fileset dir="${lib}" includes="**/**.jar"/>
</copy>
</target>
<target name="clean">
<delete dir="${java}" />
<delete dir="${classes}" />
<delete dir="${dist}" />
</target>
</project>