forked from tcondie/jol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·155 lines (136 loc) · 5.53 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0"?>
<project name="jol" default="dist" basedir=".">
<description>
An Ant build file for the Java Overlog Library (JOL) implementation.
</description>
<property name="build" location="ant-build"/>
<property name="dist" location="ant-dist"/>
<property name="doc" location="doc"/>
<property name="lib" location="lib"/>
<property name="src" location="src"/>
<property name="parser-dir" location="${src}/jol/lang/parse"/>
<property name="test" location="test"/>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<!-- We need to re-run Rats if any of the .rats files have changed -->
<target name="rats-freshness">
<uptodate property="rats.up-to-date"
targetfile="${parser-dir}/Parser.java">
<srcfiles dir="${parser-dir}" includes="*.rats"/>
</uptodate>
</target>
<target name="rats" depends="rats-freshness" unless="rats.up-to-date">
<echo message="Regenerating Overlog parser using Rats..."/>
<java classname="xtc.parser.Rats" classpath="${lib}/xtc.jar" >
<arg line="-in ${parser-dir}"/>
<arg line="-out ${parser-dir}"/>
<arg value="-lgpl"/>
<arg value="-no-exit"/>
<arg value="${parser-dir}/Parser.rats"/>
</java>
</target>
<target name="compile" depends="init,rats" description="compile the source">
<javac destdir="${build}" debug="yes">
<classpath>
<pathelement location="${lib}/grappa.jar"/>
<pathelement location="${lib}/xtc.jar"/>
<pathelement location="${lib}/grappa1_2.jar"/>
<pathelement location="${lib}/servlet-api.jar"/>
<pathelement location="${lib}/junit.jar"/>
</classpath>
<src>
<pathelement location="${src}"/>
<pathelement location="${test}"/>
</src>
</javac>
</target>
<target name="dist" depends="compile" description="generate a JAR file">
<mkdir dir="${dist}"/>
<!--
We want to redistribute the contents of the XTC JAR file with
the JOL JAR. Since the default Java classloader doesn't support
nested JAR files, we use <zipfileset> to slurp the entire XTC
JAR into the JOL JAR.
XXX: This makes us GPL, by contamination. The full XTC JAR is
also pretty large. It would be better to depend on only the
LGPL'd Rats files. We also slurp in the JARs for the Servlet API
and Grappa, which is wrong for similar reasons.
-->
<jar jarfile="${dist}/jol.jar">
<fileset dir="${build}" excludes="jol/test/**"/>
<!-- Include the OLG files we need to bootstrap JOL in the JAR -->
<fileset dir="${src}" includes="**/*.olg"/>
<!-- Include the RATS runtime files that we need -->
<zipfileset src="${lib}/xtc.jar"/>
<zipfileset src="${lib}/grappa.jar"/>
<zipfileset src="${lib}/servlet-api.jar"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="jol.core.Runtime"/>
</manifest>
</jar>
<!-- Build a separate JAR file containing the test bytecode and
the dependent OLG files -->
<jar jarfile="${dist}/jol-test.jar">
<fileset dir="${build}" includes="jol/test/**"/>
<fileset dir="${test}" includes="**/*.olg"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
</jar>
</target>
<target name="war" depends="compile" description="Make .war containg lincoln servlets">
<mkdir dir="${dist}"/>
<war destfile="${dist}/lincoln.war"
webxml="examples/servlet/web.xml">
<classes dir="${src}" includes="**/*.olg"/>
<fileset dir="examples/servlet/" includes="**/*.css"/>
<fileset dir="examples/servlet/" includes="**/*.html"/>
<fileset dir="examples/servlet/" includes="**/*.js"/>
<fileset dir="examples/" includes="**/*.olg"/>
<classes dir="${build}" excludes="jol/test/**"/>
<lib dir="${lib}" includes="xtc.jar"/>
<lib dir="${lib}" includes="grappa.jar"/>
</war>
</target>
<target name="doc" description="generate Javadoc documentation">
<javadoc destdir="${doc}" sourcepath="${src}" classpath="${lib}/xtc.jar"/>
</target>
<target name="test" description="run JUnit tests">
<!-- Note that we fork a JVM to run the tests in. This is probably
good for robustness reasons; it also seems necessary to
prevent JUnit from interferring with our classpath and
preventing the loading of OLG files.
<rant>
There is no apparent way to get ant to output strack traces via
output formatters, so I disabled formatters, and use
'showoutput="yes"' to have it dump exceptions to console.
Also, 'filtertrace="yes"' helpfully filters lines that start w/
junit package names, but the stack traces that it wants to filter
start with the word 'at', so it doesn't really do anything useful
at all, so I disabled it.
- RCS
</rant>
-->
<junit fork="yes" showoutput="yes" filtertrace="no" printsummary="yes">
<classpath>
<pathelement location="${dist}/jol.jar"/>
<pathelement location="${dist}/jol-test.jar"/>
<pathelement location="${lib}/junit.jar"/>
<pathelement location="${lib}/grappa.jar"/>
</classpath>
<batchtest>
<fileset dir="${test}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="clean" description="clean up">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${doc}"/>
</target>
</project>