forked from voldemort/voldemort
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
537 lines (490 loc) · 20.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
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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
<?xml version="1.0"?>
<project name="voldemort" basedir="." default="all">
<property file="build.properties" />
<property name="name" value="voldemort" />
<property name="display.name" value="Voldemort" />
<property name="author" value="Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu" />
<property environment="env" />
<path id="main-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${classes.dir}" />
</path>
<!-- set the build number based on environment variable, otherwise blank -->
<property environment="env" description="System environment variables (including those set by Hudson)"/>
<condition property="curr.release.snapshot" value="${curr.release}-snapshot-${env.BUILD_NUMBER}" else="${curr.release}">
<and>
<isset property="env.BUILD_NUMBER" />
<not>
<equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
</not>
</and>
</condition>
<path id="contrib-classpath">
<pathelement path="${resources.dir}" />
<fileset dir="${dist.dir}">
<include name="${name}-${curr.release}.jar" />
</fileset>
<fileset dir="${contrib.root.dir}">
<include name="**/*.jar" />
</fileset>
<path refid="test-classpath" />
</path>
<path id="test-classpath">
<pathelement path="${resources.dir}" />
<pathelement path="${env.VOLD_TEST_JARS}" />
<path refid="main-classpath" />
<pathelement path="${testclasses.dir}" />
</path>
<path id="contrib-test-classpath">
<path refid="main-classpath" />
<path refid="contrib-classpath" />
<fileset dir="${dist.dir}">
<include name="${name}-contrib-${curr.release}.jar" />
</fileset>
<pathelement path="${testclasses.dir}" />
</path>
<macrodef name="replace-dir">
<attribute name="dir" />
<sequential>
<delete dir="@{dir}" />
<mkdir dir="@{dir}" />
</sequential>
</macrodef>
<target name="all" depends="clean, jar, test, contrib-jar, srcjar" description="Build all artifacts." />
<target name="clean" description="Delete generated files.">
<delete dir="${dist.dir}" />
<replace-dir dir="${javadoc.dir}" />
</target>
<target name="build" description="Compile main source tree java files">
<replace-dir dir="${classes.dir}" />
<!-- copy non-java files to classes dir to load from classpath -->
<copy todir="${classes.dir}">
<fileset dir="${java.dir}">
<exclude name="**/*.java" />
<exclude name="**/*.html" />
<exclude name="**/log4j.properties" />
</fileset>
</copy>
<replace-dir dir="META-INF" />
<echo message="creating manifest"/>
<manifest file="META-INF/MANIFEST.MF">
<attribute name="Voldemort-Implementation-Version" value="${curr.release}" />
<attribute name="Implementation-Title" value="Voldemort" />
<attribute name="Implementation-Version" value="${curr.release}" />
<attribute name="Implementation-Vendor" value="LinkedIn" />
</manifest>
<!-- place to put log4j.properties -->
<replace-dir dir="${resources.dir}"/>
<copy file="${java.dir}/log4j.properties" todir="${resources.dir}"/>
<javac destdir="${classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
<src path="${java.dir}" />
<classpath refid="main-classpath" />
</javac>
</target>
<target name="buildtest" description="Compile test classes">
<replace-dir dir="${testclasses.dir}" />
<copy todir="${testclasses.dir}">
<fileset dir="${commontestsrc.dir}">
<exclude name="**/*.java" />
<exclude name="**/*.html" />
</fileset>
</copy>
<copy todir="${testclasses.dir}">
<fileset dir="${unittestsrc.dir}">
<exclude name="**/*.java" />
<exclude name="**/*.html" />
</fileset>
</copy>
<javac destdir="${testclasses.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
<src path="${unittestsrc.dir}" />
<src path="${inttestsrc.dir}" />
<src path="${commontestsrc.dir}" />
<src path="${longtestsrc.dir}" />
<classpath refid="main-classpath" />
</javac>
</target>
<target name="test" depends="build, buildtest" description="Build test jar file">
<jar destfile="${dist.dir}/${name}-test-${curr.release}.jar">
<fileset dir="${testclasses.dir}" />
</jar>
</target>
<!--
Use protoc version 2.3.0 to recompile by hand:
https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.3.0.tar.gz&can=2&q=
Below, '<DASH/>' means '-'. This was done to nest double-dashes within xml comment.
<target name="protobuff" description="Generate source files from .proto files">
<pathconvert property="proto.sources" pathsep=" ">
<path id="proto-files">
<fileset dir="${protobuff.dir}" />
</path>
</pathconvert>
<property name="proto.path" location="${protobuff.dir}"/>
<property name="javaout.path" location="${java.dir}"/>
<property name="pythonout.path" location="${python.proto.dir}"/>
<exec executable="protoc" failonerror="true">
<arg value="<DASH/><DASH/>proto_path=${proto.path}"/>
<arg value=""<DASH/><DASH/>java_out=${javaout.path}"/>
<arg value=""<DASH/><DASH/>python_out=${pythonout.path}"/>
<arg line="${proto.sources}"/>
</exec>
</target>
-->
<target name="jar" depends="build" description="Build server jar file">
<jar destfile="${dist.dir}/${name}-${curr.release}.jar" manifest="META-INF/MANIFEST.MF">
<fileset dir="${classes.dir}">
<include name="**/*.*" />
</fileset>
<!-- include xsds -->
<fileset dir="${java.dir}">
<include name="**/*.xsd" />
</fileset>
<fileset dir=".">
<include name="META-INF/MANIFEST.MF" />
</fileset>
</jar>
</target>
<target name="srcjar" description="Build source jar file">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${name}-${curr.release}-src.jar">
<fileset dir="${java.dir}">
<include name="**/*.java" />
</fileset>
</jar>
</target>
<target name="alljar" depends="build, contrib-build" description="Build a jar file that includes all contrib code.">
<jar destfile="${dist.dir}/${name}-${curr.release}-all.jar">
<fileset dir="${classes.dir}">
<include name="**/*.*" />
</fileset>
<fileset dir="${contrib.classes.dir}">
<include name="**/*.*" />
</fileset>
<!-- include xsds -->
<fileset dir="${java.dir}">
<include name="**/*.xsd" />
</fileset>
</jar>
</target>
<target name="war" depends="build" description="Build server war file">
<war destfile="${dist.dir}/${name}.war" webxml="web.xml" basedir="${classes.dir}">
<classes dir="${classes.dir}"/>
<lib dir="${lib.dir}">
<exclude name="${lib.dir}/servlet-api*.jar"/>
<exclude name="${lib.dir}/src/**"/>
</lib>
</war>
</target>
<target name="contrib-build" depends="build, buildtest" description="Compile contrib packages (java and test) ">
<replace-dir dir="${contrib.classes.dir}" />
<javac destdir="${contrib.classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
<src path="${contrib.root.dir}" />
<src path="${contrib.root.dir}" />
<classpath refid="main-classpath" />
<classpath refid="contrib-classpath" />
</javac>
<copy todir="${contrib.classes.dir}">
<fileset dir="${contrib.root.dir}/ec2-testing/resources" />
</copy>
</target>
<target name="contrib-jar" depends="contrib-build" description="Build contrib jar file">
<jar destfile="${dist.dir}/${name}-contrib-${curr.release}.jar">
<fileset dir="${contrib.classes.dir}">
<include name="**/*.*" />
</fileset>
</jar>
</target>
<target name="contrib-srcjar" description="Build contrib source jar file">
<mkdir dir="${dist.dir}" />
<jar destfile="${dist.dir}/${name}-contrib-${curr.release}-src.jar">
<fileset dir="${contrib.root.dir}/**/java">
<include name="**/*.java" />
</fileset>
</jar>
</target>
<target name="contrib-junit" depends="contrib-jar" description="Run contrib junit tests except EC2 and Krati tests.">
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<classpath refid="contrib-test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${contribtestreport.dir}">
<fileset dir="${contrib.classes.dir}">
<include name="**/*Test.class" />
<exclude name="**/*PerformanceTest.class" />
<exclude name="**/*RemoteTest.class" />
<exclude name="**/Ec2*Test.class" />
<exclude name="**/Krati*Test.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${contribtesthtml.dir}">
<fileset dir="${contribtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${contribtesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="ec2testing-junit" depends="all" description="Run EC2 testing contrib junit tests.">
<copy todir="${testclasses.dir}">
<fileset dir="${contrib.root.dir}/ec2-testing/resources" />
</copy>
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<syspropertyset>
<propertyref prefix="ec2" />
</syspropertyset>
<classpath refid="contrib-test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${contribtestreport.dir}">
<fileset dir="${contrib.classes.dir}">
<include name="**/Ec2SmokeTest.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${contribtesthtml.dir}">
<fileset dir="${contribtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${contribtesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="ec2testing-gossip" depends="contrib-jar" description="Run gossip tests on EC2.">
<copy todir="${testclasses.dir}">
<fileset dir="${contrib.root.dir}/ec2-testing/resources" />
</copy>
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<syspropertyset>
<propertyref prefix="ec2" />
<propertyref prefix="log4j" />
<propertyref prefix="gossip" />
</syspropertyset>
<classpath refid="contrib-test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${contribtestreport.dir}">
<fileset dir="${contrib.classes.dir}">
<include name="**/Ec2GossipTest.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${contribtesthtml.dir}">
<fileset dir="${contribtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${contribtesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="ec2testing-rebalancing" depends="contrib-jar" description="Run rebalancing tests on EC2.">
<copy todir="${testclasses.dir}">
<fileset dir="${contrib.root.dir}/ec2-testing/resources" />
</copy>
<replace-dir dir="${contribtestreport.dir}" />
<replace-dir dir="${contribtesthtml.dir}" />
<junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
<syspropertyset>
<propertyref prefix="ec2" />
<propertyref prefix="log4j" />
<propertyref prefix="rebalancing" />
</syspropertyset>
<classpath refid="contrib-test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${contribtestreport.dir}">
<fileset dir="${contrib.classes.dir}">
<include name="**/Ec2RebalancingTest.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${contribtesthtml.dir}">
<fileset dir="${contribtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${contribtesthtml.dir}" format="frames" />
</junitreport>
</target>
<macrodef name="create-release-artifacts">
<attribute name="version" />
<sequential>
<antcall target="all"/>
<zip destfile="${dist.dir}/${name}-@{version}.zip">
<zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
<zipfileset dir="." prefix="voldemort-@{version}" includes="**">
<exclude name="${dist.dir}/*classes/"/>
<exclude name="bin/*"/>
<exclude name=".git*/**"/>
</zipfileset>
</zip>
<tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
<tarfileset dir="." prefix="voldemort-@{version}" includes="**">
<exclude name="${dist.dir}/*classes/"/>
<exclude name="${dist.dir}/*.zip"/>
<exclude name="bin/*"/>
<exclude name=".git*/**"/>
</tarfileset>
</tar>
</sequential>
</macrodef>
<target name="snapshot" description="Create a release-snapshot zip file with everything pre-built.">
<create-release-artifacts version="${curr.release.snapshot}" />
</target>
<target name="release" description="Create a release zip file with everything pre-built.">
<create-release-artifacts version="${curr.release}" />
</target>
<target name="hadoop-benchmark-jar" depends="build, contrib-build"
description="Build a jar file that includes all contrib code plus the necessary jars for running the hadoop benchmark.">
<jar destfile="${dist.dir}/hadoop-benchmark.jar">
<fileset dir="${classes.dir}">
<include name="**/*.*" />
</fileset>
<fileset dir="${contrib.classes.dir}">
<include name="**/*.*" />
</fileset>
<!-- include xsds -->
<fileset dir="${java.dir}">
<include name="**/*.xsd" />
</fileset>
<fileset dir="">
<include name="lib/jdom*.jar"/>
<include name="lib/google-collect*.jar"/>
<include name="lib/commons-lang*.jar"/>
</fileset>
</jar>
</target>
<target name="junit" depends="build, buildtest" description="Run junit tests.">
<replace-dir dir="${testreport.dir}" />
<replace-dir dir="${testhtml.dir}" />
<junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
<classpath refid="test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${testreport.dir}">
<fileset dir="${unittestsrc.dir}">
<include name="**/*Test.java" />
<exclude name="**/Abstract*.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${testhtml.dir}">
<fileset dir="${testreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${testhtml.dir}" format="frames" />
</junitreport>
</target>
<target name="junit-long" depends="build, buildtest, junit" description="Run long junit tests that uses larger data sets than normal junit tests.">
<replace-dir dir="${longtestreport.dir}" />
<replace-dir dir="${longtesthtml.dir}" />
<junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
<classpath refid="test-classpath" />
<formatter type="xml" />
<batchtest todir="${longtestreport.dir}">
<fileset dir="${longtestsrc.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${longtesthtml.dir}">
<fileset dir="${longtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${longtesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="junit-rebalance" depends="build, buildtest" description="Run junit tests only for rebalance.">
<replace-dir dir="${testreport.dir}" />
<replace-dir dir="${testhtml.dir}" />
<junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
<classpath refid="test-classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${testreport.dir}">
<fileset dir="${unittestsrc.dir}">
<include name="**/*Rebalance*Test.java" />
<exclude name="**/Abstract*.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${testhtml.dir}">
<fileset dir="${testreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${testhtml.dir}" format="frames" />
</junitreport>
</target>
<target name="junit-long-rebalance" depends="build, buildtest, junit-rebalance" description="Run long junit rebalance tests that uses larger data sets than normal junit tests.">
<replace-dir dir="${longtestreport.dir}" />
<replace-dir dir="${longtesthtml.dir}" />
<junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
<classpath refid="test-classpath" />
<formatter type="xml" />
<batchtest todir="${longtestreport.dir}">
<fileset dir="${longtestsrc.dir}">
<include name="**/*Rebalance*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${longtesthtml.dir}">
<fileset dir="${longtestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${longtesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="junit-test" depends="build, buildtest, contrib-jar" description="Run single junit test for class ClassName with -Dtest.name=[ClassName] (Note: Use the class name, not the file name with the .java extension)">
<replace-dir dir="${singletestreport.dir}" />
<replace-dir dir="${singletesthtml.dir}" />
<junit printsummary="on" showoutput="true" maxmemory="4096m">
<classpath refid="contrib-test-classpath" />
<classpath path="${log4j.properties.dir}" />
<formatter type="plain" />
<formatter type="xml" />
<test name="${test.name}" todir="${singletestreport.dir}"/>
</junit>
<junitreport todir="${singletesthtml.dir}">
<fileset dir="${singletestreport.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${singletesthtml.dir}" format="frames" />
</junitreport>
</target>
<target name="junit-all" depends="junit-long, contrib-junit" description="Run All junit tests including contrib.">
</target>
<macrodef name="make-javadocs">
<attribute name="dir" />
<attribute name="packagenames" />
<attribute name="javadir" />
<sequential>
<replace-dir dir="@{dir}" />
<javadoc sourcepath="@{javadir}" destdir="@{dir}" windowtitle="${display.name}" source="${javac.version}" author="true" version="true" use="true" packagenames="@{packagenames}">
<doctitle>${display.name}</doctitle>
<bottom>${author}</bottom>
<classpath refid="main-classpath" />
</javadoc>
</sequential>
</macrodef>
<target name="docs" description="Create complete Javadoc documentation">
<make-javadocs dir="${javadoc.dir}/all" packagenames="*" javadir="${java.dir}"/>
<make-javadocs dir="${javadoc.dir}/client" packagenames="voldemort.versioning.*, voldemort.client.*,voldemort.serialization.*" javadir="${java.dir}"/>
</target>
<target name="redeploy" depends="war, deploy">
</target>
<taskdef file="tomcat-tasks.properties">
<classpath>
<path location="${lib.dir}/catalina-ant.jar" />
</classpath>
</taskdef>
<target name="list" description="List Tomcat applications">
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
</target>
<target name="deploy" description="Deploy application" depends="war">
<deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${tomcat.context}" update="true" war="file:${dist.dir}/${name}.war" />
</target>
<target name="undeploy" description="Undeploy application">
<undeploy url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="${tomcat.context}"/>
</target>
</project>