forked from MobilityFirst/GNS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
486 lines (433 loc) · 20.2 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<?xml version="1.0" encoding="UTF-8"?>
<project
name="Build file for GNS"
basedir="."
default="jar" >
<property name="src.dir" value="src"/>
<property name="test.dir" value="test" />
<property name="build.dir" value="build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.test.classes.dir" value="${build.dir}/test/classes"/>
<property name="build.test.dir" value="${build.dir}/test"/>
<property name="build.jar.dir" value="${build.dir}/jars"/>
<property name="lib.dir" value="lib"/>
<property name="dist.dir" value="dist"/>
<property name="jars.dir" value="jars"/>
<property name="conf.dir" value="conf"/>
<property name="scripts.dir" value="scripts"/>
<property name="db-props-file" location="edu/umass/cs/gnsclient/console/console.properties" />
<!-- Properties -->
<property file="build.properties" />
<path id="classpath.base">
<pathelement location="${build.dir}"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${conf.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<tstamp/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="compile" depends="init, buildnumber" description="compile java files">
<javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="true" debuglevel="lines,vars,source"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="classpath.base"/>
</javac>
</target>
<target name="server_jarbuild" depends="compile" description="generate jar files">
<mkdir dir="${build.jar.dir}"/>
<jar destfile="${build.jar.dir}/gnsserver-${VERSION}-${RELEASE}.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="edu.umass.cs.gns.httpserver.GnsHttpServer"/>
<attribute name="Class-Path" value="."/>
<attribute name="Build-Version" value="${version.code}" />
</manifest>
<fileset dir="${build.classes.dir}"
includes="**/*.class"
excludes="edu/umass/cs/gnsclient/**"
/>
<fileset dir="${conf.dir}" includes="trustStore/**, keystore/**" />
<fileset dir="${conf.dir}" includes="**" />
<zipgroupfileset dir="${lib.dir}"
includes="**/*.jar"
excludes="android.jar, hamcrest*.jar, junit*.jar"/>
</jar>
</target>
<fileset id="client.includes" dir="${build.classes.dir}"
includes="**/*.class"/>
<fileset id="console.properties" dir="${src.dir}">
<include name="edu/umass/cs/gnsclient/console/console.properties" />
</fileset>
<fileset id="client.keystore" dir="${conf.dir}" includes="trustStore/**, keystore/**" />
<!-- gigapaxos below could probably be nio-->
<zipfileset id="client.lib" dir="${lib.dir}"
includes="derby.jar, jline*.jar, commons-cli*.jar, commons-lang*.jar, gigapaxos*.jar"
/>
<target name="client_jarbuild" depends="compile" description="generate jar files">
<mkdir dir="${build.jar.dir}"/>
<jar jarfile="${build.jar.dir}/gnsclient-${VERSION}-${RELEASE}.jar">
<manifest>
<attribute name="Built-By" value="Westy"/>
<attribute name="Implementation-Vendor"
value="University of Massachusetts" />
<attribute name="Implementation-Title" value="GNS" />
<attribute name="Implementation-Version"
value="${VERSION}-${RELEASE}" />
<attribute name="Class-Path" value="."/>
<!-- <attribute name="Class-Path" value="${jar.classpath}"/>-->
<attribute name="Build-Version" value="${version.code}" />
</manifest>
<fileset refid="client.includes"/>
<fileset refid="client.keystore" />
<zipgroupfileset refid="client.lib" />
</jar>
</target>
<target name="client_console_jarbuild" depends="compile">
<mkdir dir="${build.jar.dir}"/>
<jar jarfile="${build.jar.dir}/gns-cli-${VERSION}-${RELEASE}.jar">
<manifest>
<attribute name="Built-By" value="Westy" />
<!-- Information about the program itself -->
<attribute name="Implementation-Vendor"
value="University of Massachusetts" />
<attribute name="Implementation-Title" value="GNS CLI" />
<attribute name="Implementation-Version"
value="${VERSION}-${RELEASE}" />
<attribute name="Main-Class" value="edu.umass.cs.gnsclient.console.CommandLineInterface" />
<attribute name="Build-Version" value="${version.code}" />
</manifest>
<fileset refid="client.includes"/>
<fileset refid="client.keystore" />
<fileset refid="console.properties" />
<zipgroupfileset refid="client.lib" />
</jar>
</target>
<target name="clean" description="remove generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${jars.dir}"/>
</target>
<target name="doc" description="generate javadoc">
<mkdir dir="${build.dir}/doc"/>
<javadoc packagenames="edu.umass.cs.*"
sourcepath="${src.dir}"
destdir="${build.dir}/doc"
additionalparam="-Xdoclint:none"
author="true"
version="true"
use="true"
public="true"
windowtitle="GNS API (specification ${VERSION}-${RELEASE})">
<doctitle>
<![CDATA[<h1>GNS API (specification ${VERSION}-${RELEASE})</h1>]]>
</doctitle>
<bottom>
<![CDATA[<i>Copyright © 2014-2016 University of Massachusetts - All Rights Reserved.</i>]]>
</bottom>
<classpath refid="classpath.base"/>
</javadoc>
<mkdir dir="${dist.dir}/doc"/>
<copy todir="${dist.dir}/doc">
<fileset dir="${build.dir}/doc" includes="**"/>
</copy>
</target>
<target name="jar" depends="server_jarbuild, client_jarbuild, client_console_jarbuild">
<!-- copy jars into dist/jars -->
<mkdir dir="${dist.dir}/jars"/>
<copy todir="${dist.dir}/jars">
<fileset dir="${build.jar.dir}" includes="*.jar"/>
</copy>
<!-- make a copy of the latest server and put it in GNS.jar-->
<copy file="${dist.dir}/jars/gnsserver-${VERSION}-${RELEASE}.jar" tofile="${dist.dir}/jars/GNS.jar" />
<!-- make a copy of the latest client and put it in GNSClient.jar-->
<copy file="${dist.dir}/jars/gnsclient-${VERSION}-${RELEASE}.jar" tofile="${dist.dir}/jars/GNSClient.jar" />
<copy file="${dist.dir}/jars/gns-cli-${VERSION}-${RELEASE}.jar" tofile="${dist.dir}/jars/GNS-CLI.jar" />
<!-- make a symlink of the latest server and put it in GNS.jar-->
<!-- <symlink link="${dist.dir}/jars/GNS.jar" resource="${dist.dir}/jars/gnsserver-${VERSION}-${RELEASE}.jar"/>-->
<!-- make a symlink of the latest server and put it in GNSClient.jar-->
<!-- <symlink link="${dist.dir}/jars/GNSClient.jar" resource="${dist.dir}/jars/gnsclient-${VERSION}-${RELEASE}.jar"/>-->
<!-- copy jars into top level jars directory -->
<mkdir dir="${jars.dir}"/>
<copy todir="${jars.dir}">
<fileset dir="${build.jar.dir}" includes="*.jar"/>
</copy>
<!-- make a copy of the latest server and put it in GNS.jar-->
<copy file="${jars.dir}/gnsserver-${VERSION}-${RELEASE}.jar" tofile="${jars.dir}/GNS.jar" />
<!-- make a copy of the latest client and put it in GNSClient.jar-->
<copy file="${jars.dir}/gnsclient-${VERSION}-${RELEASE}.jar" tofile="${jars.dir}/GNSClient.jar" />
<copy file="${jars.dir}/gns-cli-${VERSION}-${RELEASE}.jar" tofile="${jars.dir}/GNS-CLI.jar" />
<!-- make a symlink of the latest server and put it in GNS.jar-->
<!-- <symlink link="${jars.dir}/GNS.jar" resource="${jars.dir}/gnsserver-${VERSION}-${RELEASE}.jar"/>-->
<!-- make a symlink of the latest server and put it in GNSClient.jar-->
<!-- <symlink link="${jars.dir}/GNSClient.jar" resource="${jars.dir}/gnsclient-${VERSION}-${RELEASE}.jar"/>-->
<!-- copy all of conf into dist/conf -->
<mkdir dir="${dist.dir}/conf"/>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" includes="**" />
</copy>
<!-- copy scripts into dist/scripts -->
<mkdir dir="${dist.dir}/scripts"/>
<copy todir="${dist.dir}/scripts">
<fileset dir="${scripts.dir}"
excludes="paxos_logs, reconfiguration_DB, log, derby.log"/>
</copy>
<!-- make scripts executable-->
<chmod perm="ug+x">
<fileset dir="${dist.dir}/scripts">
<exclude name="*.properties"/>
</fileset>
</chmod>
</target>
<path id="classpath.test">
<pathelement location="${build.classes.dir}"/>
<pathelement location="${lib.dir}/junit-4.11.jar"/>
<pathelement location="${lib.dir}/hamcrest-all-1.3.jar"/>
<pathelement location="${lib.dir}/android.jar"/>
<pathelement location="${lib.dir}/jline-1.0.jar"/>
<pathelement location="${lib.dir}/commons-lang3-3.3.1.jar"/>
<pathelement location="${lib.dir}/commons-cli-1.1.jar"/>
<pathelement location="${lib.dir}/derby.jar"/>
<pathelement location="${lib.dir}/log4j-1.2.16.jar"/>
<pathelement location="${lib.dir}/gigapaxos-1.0.jar"/>
<pathelement location="${lib.dir}/context-client-GNS.jar"/>
<pathelement location="${lib.dir}/mongo-java-driver-2.12.1.jar"/>
<pathelement location="${conf.dir}"/>
<pathelement location="${db-props-file}" />
</path>
<target name="ensure-test-name" unless="test">
<fail message="You must run this target with -Dtest=TestName"/>
</target>
<target name="compiletest" depends="compile" description="Compile all the test files">
<mkdir dir="${build.test.dir}" />
<mkdir dir="${build.test.classes.dir}" />
<javac srcdir="${test.dir}"
destdir="${build.test.classes.dir}"
debug="on"
includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="runtest" description="Runs the test you specify on the command line with -Dtest="
depends="compiletest, ensure-test-name">
<!-- Allows us to pass in some standard args from command line using things like -Dalias=fred/>-->
<property name="alias" value=""/>
<property name="password" value=""/>
<property name="count" value=""/>
<property name="gigapaxosConfig" value="conf/gigapaxos.client.local.properties"/>
<property name="java.util.logging.config.file" value="conf/logging.gns.junit.properties"/>
<junit printsummary="withOutAndErr" fork="yes" showoutput="yes">
<jvmarg value="-ea"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=qwerty"/>
<jvmarg value="-Djavax.net.ssl.trustStore=conf/trustStore/node100.jks"/>
<jvmarg value="-Dalias=${alias}"/>
<jvmarg value="-Dpassword=${password}"/>
<jvmarg value="-Dcount=${count}"/>
<jvmarg value="-DgigapaxosConfig=${gigapaxosConfig}"/>
<jvmarg value="-Djava.util.logging.config.file=${java.util.logging.config.file}"/>
<!-- add this if you want SSL debugging enabled -->
<!-- <jvmarg value="-Djavax.net.debug=ssl"/>-->
<classpath>
<pathelement location="${build.test.classes.dir}"/>
</classpath>
<!-- Make sure these libraries are included -->
<classpath refid="classpath.test" />
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset dir="${test.dir}">
<include name="**/${test}.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="batchTest" depends="compiletest">
<!-- Allows us to pass this in from the command line using -DgigapaxosConfig=filename/> -->
<property name="gigapaxosConfig" value="conf/gigapaxos.client.local.properties"/>
<junit>
<jvmarg value="-ea"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=qwerty"/>
<jvmarg value="-Djavax.net.ssl.trustStore=conf/trustStore/node100.jks"/>
<jvmarg value="-Dalias=${alias}"/>
<jvmarg value="-Dpassword=${password}"/>
<jvmarg value="-Dcount=${count}"/>
<jvmarg value="-DgigapaxosConfig=${gigapaxosConfig}"/>
<jvmarg value="-Djava.util.logging.config.file=conf/logging.gns.junit.properties"/>
<classpath>
<pathelement location="${build.test.classes.dir}"/>
</classpath>
<!-- Make sure these libraries are included -->
<classpath refid="classpath.test" />
<batchtest>
<fileset dir="${test.dir}">
<include name="**/*Test*.java"/>
<exclude name="edu/umass/cs/gnsclient/client/integrationtests/**" />
</fileset>
</batchtest>
<formatter type="plain" usefile="false"/>
<!--<formatter type="brief" usefile="false"/> -->
</junit>
</target>
<target name="test" description="Runs the default integration test against a 3 node server"
depends="jar, compiletest">
<junit printsummary="yes" fork="yes" haltonfailure="on" showoutput="yes">
<test name="edu.umass.cs.gnsclient.client.integrationtests.ServerIntegrationTest"/>
<formatter type="plain" usefile="false"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=qwerty"/>
<jvmarg value="-Djavax.net.ssl.trustStore=conf/trustStore/node100.jks"/>
<jvmarg value="-DstartServer=true"/>
<jvmarg value="-DgigapaxosConfig=conf/gigapaxos.server.local.properties"/>
<jvmarg value="-Djava.util.logging.config.file=conf/logging.gns.anttest.properties"/>
<jvmarg value="-Dserver.command=scripts/3nodeslocal/reset_and_restart.sh"/>
<classpath>
<pathelement location="${build.test.classes.dir}"/>
</classpath>
<!-- Make sure these libraries are included -->
<classpath refid="classpath.test" />
</junit>
</target>
<target name="testAlwaysFail" description="This test always fails. Use for debugging what happens when tests fail."
depends="jar, compiletest">
<junit printsummary="yes" fork="yes" haltonfailure="on" showoutput="yes">
<test name="edu.umass.cs.gnsclient.client.AlwaysFail"/>
<formatter type="plain" usefile="false"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djava.util.logging.config.file=conf/logging.gns.anttest.properties"/>
<classpath>
<pathelement location="${build.test.classes.dir}"/>
</classpath>
<!-- Make sure these libraries are included -->
<classpath refid="classpath.test" />
</junit>
</target>
<target name="test1" description="Runs the default integration test against a single node server"
depends="jar, compiletest">
<junit printsummary="yes" fork="yes" haltonfailure="on" showoutput="yes">
<test name="edu.umass.cs.gnsclient.client.integrationtests.ServerIntegrationTest"/>
<formatter type="plain" usefile="false"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djavax.net.ssl.trustStorePassword=qwerty"/>
<jvmarg value="-Djavax.net.ssl.trustStore=conf/trustStore/node100.jks"/>
<jvmarg value="-DstartServer=true"/>
<jvmarg value="-DgigapaxosConfig=conf/gigapaxos.server.singleNode.local.properties"/>
<jvmarg value="-Djava.util.logging.config.file=conf/logging.gns.anttest.properties"/>
<jvmarg value="-Dserver.command=scripts/singlenodetests/reset_and_restart.sh"/>
<classpath>
<pathelement location="${build.test.classes.dir}"/>
</classpath>
<!-- Make sure these libraries are included -->
<classpath refid="classpath.test" />
</junit>
</target>
<target name="all" depends="clean,jar"
description="build all files"/>
<target name="buildnumber" description="Generates version number and sets it in properties file.">
<buildnumber file="build.number" />
<property name="version.code" value="${VERSION}_${RELEASE}_build${build.number}" />
<echo>Version: ${version.code}</echo>
</target>
<!-- Msocket jar build -->
<!-- Documentation -->
<target name="msocketdoc" depends="compile" description="Builds the Javadoc">
<javadoc packagenames="edu.umass.cs.msocket.*"
sourcepath="${src.dir}"
destdir="${build.dir}/docs/api"
author="true"
version="true"
use="true"
public="true"
windowtitle="mSocket library API (specification ${VERSION}-${RELEASE})">
<doctitle>
<![CDATA[<h1>mSocket library API (specification ${VERSION}-${RELEASE})</h1>]]>
</doctitle>
<bottom>
<![CDATA[<i>Copyright © 2013-2014 University of Massachusetts - All Rights Reserved.</i>]]>
</bottom>
<classpath refid="classpath.base" />
</javadoc>
</target>
<!-- Release -->
<!--<target name="msocket-jars"
depends="msocket-jar,msocket-nodoc-jar,msocket-proxy-console-jar,msocketdocdoc"
description="Build both mSocket and proxy jars" />-->
<target name="msocket-jar"
depends="clean,compile,msocketdoc"
description="Builds the mSocket Jar">
<mkdir dir="${build.jar.dir}"/>
<jar jarfile="${build.jar.dir}/msocket-${VERSION}-${RELEASE}.jar">
<!-- including gns client -->
<fileset refid="client.includes"/>
<fileset refid="client.keystore" />
<zipgroupfileset refid="client.lib" />
<!-- include log4j, to be removed at some point -->
<zipgroupfileset dir="${lib.dir}" includes="log4j*.jar" />
<!-- including msocket core code -->
<fileset dir="${build.classes.dir}">
<include name="edu/umass/cs/msocket/**" />
<exclude name="edu/umass/cs/msocket/docs/**" />
<exclude name="edu/umass/cs/msocket/proxy/**" />
<exclude name="edu/umass/cs/msocket/watchdog/**" />
</fileset>
<!-- including context service messages -->
<fileset dir="${build.classes.dir}" includes="edu/umass/cs/contextservice/messages/*.class"/>
<!-- including config files -->
<fileset dir="${conf.dir}/msocketFiles">
<include name="topLevelDomainNames.txt" />
</fileset>
<fileset dir="${conf.dir}/msocketFiles">
<include name="contextServiceNodeSetup.txt" />
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor"
value="University of Massachusetts" />
<attribute name="Implementation-Title" value="MSocket Library" />
<attribute name="Implementation-Version"
value="${VERSION}-${RELEASE}" />
<attribute name="Build-Version" value="${version.code}" />
</manifest>
</jar>
</target>
<target name="msocket-proxy-console-jar"
depends="clean,compile,msocketdoc"
description="Builds the mSocket proxy console Jar">
<mkdir dir="${build.jar.dir}"/>
<jar jarfile="${build.jar.dir}/msocket-proxy-console-${VERSION}-${RELEASE}.jar">
<!-- including gns client -->
<fileset refid="client.includes"/>
<fileset refid="client.keystore" />
<zipgroupfileset refid="client.lib" />
<!-- include log4j, to be removed at some point -->
<zipgroupfileset dir="${lib.dir}" includes="log4j*.jar" />
<!-- including msocket core code -->
<fileset dir="${build.classes.dir}">
<include name="edu/umass/cs/msocket/**" />
</fileset>
<!-- including context service messages -->
<fileset dir="${build.classes.dir}" includes="edu/umass/cs/contextservice/messages/*.class"/>
<!-- including config files -->
<fileset dir="${conf.dir}/msocketFiles">
<include name="topLevelDomainNames.txt" />
</fileset>
<fileset dir="${conf.dir}/msocketFiles">
<include name="contextServiceNodeSetup.txt" />
</fileset>
<fileset dir="${src.dir}">
<include name="edu/umass/cs/msocket/proxy/console/console.ini" />
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor"
value="University of Massachusetts" />
<attribute name="Implementation-Title" value="MSocket Library" />
<attribute name="Implementation-Version"
value="${VERSION}-${RELEASE}" />
<attribute name="Build-Version" value="${version.code}" />
</manifest>
</jar>
</target>
</project>