forked from krka/kahlua2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
292 lines (244 loc) · 8.95 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<?xml version="1.0" encoding="UTF-8"?>
<project name="Kahlua" basedir="." default="all">
<property file="local.properties" />
<property name="emma.dir" value="/usr/share/java" />
<property name="cldc11.src.dir" value="${basedir}/cldc11/src"/>
<property name="core.src.dir" value="${basedir}/core/src"/>
<property name="j2se.src.dir" value="${basedir}/j2se/src"/>
<property name="build.dir" value="${basedir}/bin"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="test.dir" value="${basedir}/testsuite"/>
<property name="test.src.dir" value="${test.dir}/src"/>
<property name="test.build.dir" value="${test.dir}/bin"/>
<property name="test.classes.dir" value="${test.build.dir}/classes"/>
<property name="test.lua.output.dir" value="${test.build.dir}/lua"/>
<property name="test.lua.input.dir" value="${test.dir}/lua"/>
<property name="test.emma.coverage.dir" value="${test.dir}/coverage"/>
<path id="cldc11.dependencies">
<pathelement path="${classes.dir}/core"/>
<pathelement location="${basedir}/lib/cldcapi11.jar" />
</path>
<path id="j2se.dependencies">
<pathelement path="${classes.dir}/core"/>
<pathelement location="${basedir}/j2se/lib/jsyntaxpane-0.9.5.jar" />
</path>
<path id="main.classpath">
<pathelement path="${classes.dir}/j2se"/>
<path refid="j2se.dependencies" />
</path>
<path id="test.classpath">
<path refid="main.classpath" />
<pathelement path="${test.classes.dir}"/>
</path>
<path id="emma.lib" >
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<!-- Main targets -->
<target name="all" depends="package, run-test" />
<target name="clean" description="Removes old build files">
<delete dir="${build.dir}" failonerror="false"/>
<delete dir="${test.build.dir}" failonerror="false"/>
<delete dir="${test.classes.dir}" failonerror="false"/>
</target>
<target name="setup">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}/core"/>
<mkdir dir="${classes.dir}/j2se"/>
<mkdir dir="${classes.dir}/cldc11"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.classes.dir}"/>
<mkdir dir="${test.lua.output.dir}"/>
</target>
<target name="compile" depends="setup, compile-core, compile-cldc11, compile-j2se, annotation-processor-j2se" description="Compiles Kahlua">
</target>
<target name="build" depends="compile, build-stdlib" description="Builds Kahlua">
</target>
<target name="compile-core" depends="setup">
<javac
destdir="${classes.dir}/core"
debug="true"
target="1.4"
source="1.4"
classpathref="cldc11.dependencies"
>
<compilerarg value="-bootclasspath" />
<compilerarg value="" />
<src path="${core.src.dir}"/>
</javac>
</target>
<target name="compile-cldc11" depends="compile-core">
<javac
destdir="${classes.dir}/cldc11"
debug="true"
target="1.4"
source="1.4"
classpathref="cldc11.dependencies"
>
<classpath>
<pathelement location="${classes.dir}/core" />
</classpath>
<compilerarg value="-bootclasspath" />
<compilerarg value="" />
<src path="${cldc11.src.dir}"/>
</javac>
</target>
<target name="compile-j2se" depends="compile-core">
<javac
destdir="${classes.dir}/j2se"
debug="true"
classpathref="j2se.dependencies"
>
<src path="${j2se.src.dir}"/>
</javac>
<copy todir="${classes.dir}/j2se">
<fileset dir="${basedir}/j2se/resources">
</fileset>
</copy>
</target>
<target name="annotation-processor-j2se" depends="compile-j2se">
<delete dir="${build.dir}/annotation-tmp" />
<mkdir dir="${build.dir}/annotation-tmp" />
<javac
destdir="${build.dir}/annotation-tmp"
debug="on"
deprecation="on"
optimize="on"
classpathref="main.classpath"
>
<src path="${j2se.src.dir}"/>
<compilerarg value="-processor"/>
<compilerarg value="se.krka.kahlua.integration.processor.LuaDebugDataProcessor"/>
</javac>
<move toDir="${classes.dir}/j2se">
<fileset dir="${build.dir}/annotation-tmp">
<include name="**/*.luadebugdata" />
</fileset>
</move>
<delete dir="${build.dir}/annotation-tmp" />
</target>
<target name="package" depends="setup, build" description="Package the final kahlua jar">
<jar jarfile="${build.dir}/kahlua-core.jar">
<fileset dir="${classes.dir}/core" />
</jar>
<jar jarfile="${build.dir}/kahlua-cldc11.jar">
<fileset dir="${classes.dir}/cldc11" />
</jar>
<jar jarfile="${build.dir}/kahlua-j2se.jar">
<fileset dir="${classes.dir}/j2se" />
</jar>
</target>
<target name="release" depends="setup" description="Create a release zip">
<tstamp />
<zip zipfile="${build.dir}/kahlua-release-${DSTAMP}.zip">
<fileset dir="${basedir}">
<include name="build.xml" />
<include name="resources/**" />
<include name="lib/**" />
<include name="docs/**" />
<include name="src/**" />
<include name="testsuite/**" />
<exclude name="testsuite/bin/**" />
<exclude name="testsuite/coverage/**" />
<include name="contrib/j2se-util/**" />
<exclude name="contrib/j2se-util/bin/**" />
<include name="contrib/JavaLuac/include/**" />
<include name="contrib/JavaLuac/jni_src/**" />
<include name="contrib/JavaLuac/src/**" />
<include name="contrib/midlet/resources/**" />
<include name="contrib/midlet/src/**" />
<include name="contrib/midlet/build.xml" />
<include name="contrib/midlet-interpreter/src/**" />
<include name="contrib/midlet-interpreter/build.xml" />
<include name="contrib/j2se-interpreter/src/**" />
<include name="contrib/j2se-interpreter/run.sh" />
<include name="contrib/j2se-interpreter/build.xml" />
<exclude name="**/.svn/**" />
</fileset>
</zip>
</target>
<target name="build-stdlib" depends="compile-test">
<java classname="LuaC" fork="true" dir="${basedir}">
<classpath location="${instrumented.dir}" />
<classpath refid="test.classpath" />
<arg value="${basedir}/core/resources/stdlib.lua" />
<arg value="${classes.dir}/core/stdlib.lbc" />
</java>
</target>
<target name="luac">
<fail unless="input" message="Syntax: ant luac -Dinput=<file> -Doutput=<file2>" />
<fail unless="output" message="Syntax: ant luac -Dinput=<file> -Doutput=<file2>" />
<available property="exists" file="${input}" />
<fail unless="exists" message="${input} not found." />
<java classname="LuaC" fork="true" dir="${basedir}">
<classpath location="${instrumented.dir}" />
<classpath refid="test.classpath" />
<arg value="${input}" />
<arg value="${output}" />
</java>
</target>
<!-- Test stuff -->
<target name="compile-test" depends="setup, compile" description="Compile test classes">
<javac
destdir="${test.classes.dir}"
debug="true"
target="1.5"
source="1.5"
classpathref="main.classpath"
>
<src path="${test.src.dir}"/>
</javac>
</target>
<target name="test-depend" depends="setup, build, compile-test">
</target>
<target name="debug-listen">
<property name="debugargs" value="-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=5005,suspend=y" />
</target>
<target name="default-debugargs">
<property name="debugargs" value="" />
</target>
<target name="run-interpreter" depends="build" description="Run the gui interpreter">
<java classname="se.krka.kahlua.j2se.interpreter.InteractiveShell" fork="true" dir="${basedir}">
<classpath refid="main.classpath" />
</java>
</target>
<target name="run-test" depends="test-depend, default-debugargs" description="Run the test-suite">
<property name="test.file" value="" />
<java classname="Test" fork="true" dir="${basedir}">
<jvmarg line="${debugargs}" />
<classpath location="${instrumented.dir}" />
<classpath refid="test.classpath" />
<arg value="${test.lua.input.dir}" />
<arg value="${test.file}" />
</java>
</target>
<target name="clean-emma">
<delete dir="${test.emma.coverage.dir}" />
</target>
<target name="emma" depends="clean-emma, test-depend" description="Run Emma to get code coverage">
<property name="test.file" value="" />
<emmajava enabled="true" libclasspathref="emma.lib"
classname="Test"
classpathref="test.classpath"
sort="+class,+method,+name,+block"
metrics="method:100,block:90,line:80,class:100"
>
<arg value="${test.lua.input.dir}" />
<arg value="${test.file}" />
<filter includes="se.krka.kahlua.*" />
<sourcepath>
<dirset dir="${basedir}/src" />
</sourcepath>
<txt outfile="${test.emma.coverage.dir}/coverage.txt" />
<xml outfile="${test.emma.coverage.dir}/coverage.xml" />
<html outfile="${test.emma.coverage.dir}/coverage.html" />
</emmajava>
</target>
<target name="javadoc" description="Generate javadoc">
<javadoc
sourcepath="${src.dir}"
destdir="${build.dir}/javadoc"
/>
</target>
</project>