forked from arianne/marauroa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
325 lines (291 loc) · 11.6 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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<?xml version='1.0'?>
<project name="marauroa" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<property file="build.ant.properties"/>
<property name="jarname" value="marauroa-${version}.jar"/>
<property name="jarname_client" value="marauroa-client-only-${version}.jar"/>
<path id="compile-classpath">
<pathelement path="${log4j_jar}"/>
<pathelement path="${junit_jar}"/>
<pathelement path="${jnlp_jar}"/>
<pathelement path="${jython_jar}"/>
<fileset dir="${libdir}">
<include name="jetty*.jar"/>
<include name="json-simple*.jar"/>
<include name="servlet*.jar"/>
<include name="websocket*.jar" />
</fileset>
</path>
<path id="compile-tests-classpath">
<path refid="compile-classpath" />
<path location="${build-classes}" />
</path>
<path id="run-tests-classpath">
<path refid="compile-tests-classpath" />
<pathelement location="${h2_jar}"/>
<pathelement path="${build-tests}" />
<pathelement path="."/>
</path>
<!-- Clears the instalation -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${docs}"/>
<delete dir="${build-archive}"/>
<delete dir="${dist}"/>
</target>
<!-- Create the initial folders for the build -->
<target name="init">
<mkdir dir="${build-archive}" />
<mkdir dir="${build}" />
<mkdir dir="${build-classes}" />
<mkdir dir="${build-tests}" />
<mkdir dir="${build-tests-report}" />
<mkdir dir="${build-coverage}" />
<mkdir dir="${dist}" />
<mkdir dir="${docs}" />
</target>
<!-- Compiles the project -->
<target name="compile" depends="init">
<!-- Exclude python support if jython.jar is not present -->
<condition property="exclude.python" value="**/python/*.*">
<not>
<available file="${jython_jar}"/>
</not>
</condition>
<!-- Exclude junit support if junit is not present -->
<condition property="exclude.junit" value="**/*tests/*.*">
<not>
<available file="${junit_jar}"/>
</not>
</condition>
<!-- exclude.web -->
<condition property="exclude.web" value="**/web/*.*">
<or>
<not>
<available file="${servletapi_jar}"/>
</not>
<not>
<available file="${socketio_jar}"/>
</not>
</or>
</condition>
<!-- Update version number. -->
<replaceregexp file="${src}/marauroa/server/marauroad.java"
match="private static final String VERSION = ".*";"
replace="private static final String VERSION = "${version}";"
byline="true"/>
<!-- Compile it -->
<javac srcdir="${src}" source="1.5" target="1.5" destdir="${build-classes}" debug="true" debuglevel="source,lines" includes="**/marauroa/**" excludes="${exclude.python};${exclude.junit};${exclude.web}" includeantruntime="false">
<compilerarg line="-encoding utf-8"/>
<classpath refid="compile-classpath" />
</javac>
<copy todir="${build-classes}/marauroa/server/">
<fileset dir="${src}/marauroa/server">
<include name="*.sql"/>
<include name="*.properties"/>
</fileset>
</copy>
<ant target="compile-js" />
<mkdir dir="${build-classes}/js" />
<copy todir="${build-classes}/js">
<fileset dir="src/js">
<include name="*"/>
</fileset>
</copy>
</target>
<!-- Compiles the client-only library -->
<target name="compile-client">
<delete dir="${build-client}" quiet="true" />
<mkdir dir="${build-client}"/>
<!-- Compile it -->
<javac srcdir="${src}" source="1.5" target="1.5" destdir="${build-client}" debug="true" debuglevel="source,lines" includeantruntime="false">
<compilerarg line="-encoding utf-8"/>
<include name="marauroa/client/**"/>
<include name="marauroa/common/**"/>
<classpath>
<pathelement path="${log4j_jar}"/>
<pathelement path="${jnlp_jar}"/>
</classpath>
</javac>
</target>
<!-- Compiles the client-only library -->
<target name="compile-js">
<java jar="buildtools/closure-compiler/compiler.jar" fork="true" failonerror="true" maxmemory="128m">
<arg value="--js"/>
<arg value="src/js/marauroa.js"/>
<arg value="--js"/>
<arg value="src/js/inflate.js"/>
<arg value="--js"/>
<arg value="src/js/encoding.js"/>
<arg value="--js"/>
<arg value="src/js/deserializer.js"/>
<arg value="--js"/>
<arg value="src/js/client-framework.js"/>
<arg value="--js"/>
<arg value="src/js/message-factory.js"/>
<arg value="--js"/>
<arg value="src/js/rpfactory.js"/>
<arg value="--js"/>
<arg value="src/js/perception.js"/>
<arg value="--js_output_file"/>
<arg value="${build-classes}/js/marauroa.compiled.js"/>
<arg value="--compilation_level"/>
<arg value="SIMPLE_OPTIMIZATIONS"/>
</java>
</target>
<!-- Generate Java docs -->
<target name="docs" depends="compile">
<javadoc packagenames="marauroa.*"
defaultexcludes="yes"
destdir="${docs}"
author="true"
version="true"
use="true"
windowtitle="Marauroa API Documentation Version: ${version}">
<classpath refid="compile-classpath" />
<packageset dir="src" defaultexcludes="yes" />
</javadoc>
</target>
<!-- Create jar file for Marauroa -->
<target name="jar-all" depends="compile">
<jar jarfile="${build-archive}/${jarname}" basedir="${build-classes}/">
<manifest>
<attribute name="Main-Class" value="marauroa.server.marauroad"/>
</manifest>
</jar>
<copy tofile="${build-archive}/marauroa.jar" file="${build-archive}/${jarname}"/>
</target>
<!-- Create jar file for Marauroa -->
<target name="jar-client" depends="compile-client">
<jar jarfile="${build-archive}/${jarname_client}" basedir="${build-client}/" />
</target>
<target name="jar" depends="jar-all, jar-client" />
<!-- Prepare the tarball for releases -->
<target name="dist_binary" depends="jar">
<replaceregexp file="${extras}/marauroad.bat"
match="set LOCALCLASSPATH=.*"
replace="set LOCALCLASSPATH=.;marauroa-${version}.jar;${jython_jar};${h2_jar};${connectorJ_jar};${log4j_jar};${servlet_jar};${socketio_jar};${jetty_client_jar};${jetty_continuation_jar};${jetty_http_jar};${jetty_io_jar};${jetty_security_jar};${jetty_server_jar};${jetty_servlet_jar};${jetty_util_jar};${jetty_webapp_jar};${jetty_websocket_jar};${jetty_xml_jar}"
byline="true"/>
<replaceregexp file="${extras}/marauroad"
match="export LOCALCLASSPATH=.*"
replace="export LOCALCLASSPATH=.:libs/marauroa-${version}.jar:${jython_jar}:${h2_jar}:${connectorJ_jar}:${log4j_jar}:${servlet_jar}:${socketio_jar}:${jetty_client_jar}:${jetty_continuation_jar}:${jetty_http_jar}:${jetty_io_jar}:${jetty_security_jar}:${jetty_server_jar}:${jetty_servlet_jar}:${jetty_util_jar}:${jetty_webapp_jar}:${jetty_websocket_jar}:${jetty_xml_jar}"
byline="true"/>
<mkdir dir="marauroa-${version}"/>
<mkdir dir="marauroa-${version}/libs"/>
<copy todir="marauroa-${version}" file="${extras}/marauroad.bat"/>
<copy todir="marauroa-${version}" file="${extras}/marauroad"/>
<copy todir="marauroa-${version}" file="${build-archive}/${jarname}"/>
<copy todir="marauroa-${version}" file="${build-archive}/${jarname_client}"/>
<copy todir="marauroa-${version}/libs">
<fileset dir="${libdir}">
<exclude name="jnlp.jar" />
<exclude name="junit-4.4jar" />
</fileset>
</copy>
<copy todir="marauroa-${version}" file="AUTHORS.txt"/>
<copy todir="marauroa-${version}" file="CHANGES.txt"/>
<copy todir="marauroa-${version}" file="LICENSE.txt"/>
<copy todir="marauroa-${version}" file="README.md"/>
<zip destfile="${dist}/marauroa-${version}.zip" basedir="marauroa-${version}"/>
<delete dir="marauroa-${version}"/>
</target>
<target name="dist_docs" depends="docs">
<mkdir dir="marauroa-${version}"/>
<copy todir="marauroa-${version}/${docs}">
<fileset dir="${docs}"/>
</copy>
<copy todir="marauroa-${version}" file="AUTHORS.txt"/>
<copy todir="marauroa-${version}" file="CHANGES.txt"/>
<copy todir="marauroa-${version}" file="LICENSE.txt"/>
<copy todir="marauroa-${version}" file="README.md"/>
<zip destfile="${dist}/marauroa-${version}-docs.zip" basedir="marauroa-${version}"/>
<delete dir="marauroa-${version}"/>
</target>
<target name="dist_source" depends="docs">
<mkdir dir="marauroa-${version}"/>
<copy todir="marauroa-${version}/src">
<fileset dir="src"/>
</copy>
<copy todir="marauroa-${version}/tests">
<fileset dir="tests"/>
</copy>
<copy todir="marauroa-${version}/functional_tests">
<fileset dir="functional_tests"/>
</copy>
<copy todir="marauroa-${version}/extras">
<fileset dir="extras"/>
</copy>
<copy todir="marauroa-${version}/libs">
<fileset dir="libs"/>
</copy>
<copy todir="marauroa-${version}" file="build.xml"/>
<copy todir="marauroa-${version}" file="build.ant.properties"/>
<copy todir="marauroa-${version}" file="AUTHORS.txt"/>
<copy todir="marauroa-${version}" file="CHANGES.txt"/>
<copy todir="marauroa-${version}" file="LICENSE.txt"/>
<copy todir="marauroa-${version}" file="README.md"/>
<tar destfile="${dist}/marauroa-${version}-src.tar.gz" compression="gzip">
<tarfileset dir="marauroa-${version}" prefix="marauroa-${version}">
<exclude name="**/CVS/**"/>
</tarfileset>
</tar>
<delete dir="marauroa-${version}"/>
</target>
<!-- builds the whole project for releasing -->
<target name="dist" depends="dist_binary, dist_docs, dist_source"/>
<!-- testing targets -->
<target name="compile-tests" depends="compile">
<javac srcdir="${src-test}" source="1.5" target="1.5" destdir="${build-tests}" debug="true" debuglevel="source,lines" includes="**/marauroa/**" excludes="${exclude.python};${exclude.junit}" includeantruntime="false">
<compilerarg line="-encoding utf-8"/>
<classpath refid="compile-tests-classpath" />
</javac>
<javac srcdir="functional_tests" source="1.5" target="1.5" destdir="${build-tests}" debug="true" debuglevel="source,lines" includes="**/marauroa/**" excludes="${exclude.python};${exclude.junit}" includeantruntime="false">
<compilerarg line="-encoding utf-8"/>
<classpath refid="compile-tests-classpath" />
</javac>
<copy todir="${build-tests}">
<fileset dir="${src-test}">
<include name="**/*.*" />
<exclude name="**/*.java" />
<exclude name="**/*.ini" />
</fileset>
</copy>
<copy file="${test-server-ini}" tofile="./server.ini" />
</target>
<target name="test" depends="compile-tests">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="buildtools/jacoco/jacocoant.jar"/>
</taskdef>
<jacoco:coverage destfile="build/jacoco.exec" append="false">
<junit printsummary="yes" fork="yes" forkmode="once" haltonerror="true" haltonfailure="true">
<jvmarg value="-Djava.awt.headless=true"/>
<classpath refid="run-tests-classpath" />
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${build-tests-report}">
<fileset dir="${src-test}">
<include name="**/*Test.java"/>
<include name="**/Test*.java"/>
</fileset>
<fileset dir="functional_tests">
<include name="**/*Test.java"/>
<include name="**/Test*.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="build/jacoco.exec" />
</executiondata>
<structure name="${ant.project.name}">
<classfiles>
<fileset dir="${build-classes}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src}" />
</sourcefiles>
</structure>
<xml destfile="${build-coverage}/jacoco.xml" />
</jacoco:report>
</target>
</project>