3 <project name="voldemort" basedir="." default="all">
4 <property file="gradle.properties" />
6 <property name="name" value="voldemort" />
7 <property name="display.name" value="Voldemort" />
8 <property name="author" value="Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu" />
9 <property environment="env" />
10 <!-- Files needed for building scala files with ant -->
11 <property name="scala-compiler.jar" value="${scala.home}/lib/scala-compiler-${scalac.version}.jar"/>
12 <property name="scala-library.jar" value="${scala.home}/lib/scala-library-${scalac.version}.jar"/>
13 <property name="scala-reflect.jar" value="${scala.home}/lib/scala-reflect-${scalac.version}.jar"/>
15 <path id="main-classpath">
16 <fileset dir="${lib.dir}">
17 <include name="*.jar" />
19 <pathelement path="${classes.dir}" />
22 <!-- set the scala classpath -->
23 <path id="scala.classpath">
24 <pathelement location="${scala-compiler.jar}"/>
25 <pathelement location="${scala-library.jar}"/>
26 <pathelement location="${scala-reflect.jar}"/>
27 <fileset dir="${lib.dir}">
28 <include name="*.jar" />
30 <pathelement path="${classes.dir}" />
32 <taskdef resource="scala/tools/ant/antlib.xml">
33 <classpath refid="scala.classpath"/>
36 <!-- set the build number based on environment variable, otherwise blank -->
37 <property environment="env" description="System environment variables (including those set by Hudson)"/>
38 <condition property="curr.release.snapshot" value="${curr.release}-snapshot-${env.BUILD_NUMBER}" else="${curr.release}">
40 <isset property="env.BUILD_NUMBER" />
42 <equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
47 <path id="contrib-classpath">
48 <pathelement path="${resources.dir}" />
49 <fileset dir="${dist.dir}">
50 <include name="${name}-${curr.release}.jar" />
52 <fileset dir="${contrib.root.dir}">
53 <include name="**/*.jar" />
55 <path refid="test-classpath" />
58 <path id="test-classpath">
59 <pathelement path="${resources.dir}" />
60 <pathelement path="${env.VOLD_TEST_JARS}" />
61 <path refid="main-classpath" />
62 <pathelement path="${testclasses.dir}" />
65 <path id="contrib-test-classpath">
66 <path refid="main-classpath" />
67 <path refid="contrib-classpath" />
68 <fileset dir="${dist.dir}">
69 <include name="${name}-contrib-${curr.release}.jar" />
71 <pathelement path="${testclasses.dir}" />
74 <macrodef name="replace-dir">
75 <attribute name="dir" />
77 <delete dir="@{dir}" />
78 <mkdir dir="@{dir}" />
82 <target name="all" depends="clean, jar, test, contrib-jar, srcjar" description="Build all artifacts." />
84 <target name="clean" description="Delete generated files.">
85 <delete dir="${dist.dir}" />
86 <replace-dir dir="${javadoc.dir}" />
89 <target name="build" description="Compile main source tree java files">
90 <replace-dir dir="${classes.dir}" />
91 <!-- copy non-java files to classes dir to load from classpath -->
92 <copy todir="${classes.dir}">
93 <fileset dir="${java.dir}">
94 <exclude name="**/*.java" />
95 <exclude name="**/*.html" />
96 <exclude name="**/*.scala" />
97 <exclude name="**/log4j.properties" />
100 <replace-dir dir="META-INF" />
101 <echo message="creating manifest"/>
102 <manifest file="META-INF/MANIFEST.MF">
103 <attribute name="Voldemort-Implementation-Version" value="${curr.release}" />
104 <attribute name="Implementation-Title" value="Voldemort" />
105 <attribute name="Implementation-Version" value="${curr.release}" />
106 <attribute name="Implementation-Vendor" value="LinkedIn" />
108 <!-- place to put log4j.properties -->
109 <replace-dir dir="${resources.dir}"/>
110 <copy file="${java.dir}/log4j.properties" todir="${resources.dir}"/>
111 <!-- regular java files compiled with javac task -->
112 <javac destdir="${classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
113 <src path="${java.dir}" />
114 <classpath refid="main-classpath" />
116 <!-- compile scala files with the scalac task -->
117 <scalac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="scala.classpath">
118 <include name="**/*.scala"/>
122 <target name="buildtest" description="Compile test classes">
123 <replace-dir dir="${testclasses.dir}" />
124 <copy todir="${testclasses.dir}">
125 <fileset dir="${commontestsrc.dir}">
126 <exclude name="**/*.java" />
127 <exclude name="**/*.html" />
130 <copy todir="${testclasses.dir}">
131 <fileset dir="${unittestsrc.dir}">
132 <exclude name="**/*.java" />
133 <exclude name="**/*.html" />
136 <javac destdir="${testclasses.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
137 <src path="${unittestsrc.dir}" />
138 <src path="${inttestsrc.dir}" />
139 <src path="${commontestsrc.dir}" />
140 <src path="${longtestsrc.dir}" />
141 <classpath refid="main-classpath" />
145 <target name="test" depends="build, buildtest" description="Build test jar file">
146 <jar destfile="${dist.dir}/${name}-test-${curr.release}.jar">
147 <fileset dir="${testclasses.dir}" />
152 Use protoc version 2.3.0 to recompile by hand:
153 https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.3.0.tar.gz&can=2&q=
155 Below, '<DASH/>' means '-'. This was done to nest double-dashes within xml comment.
157 <target name="protobuff" description="Generate source files from .proto files">
158 <pathconvert property="proto.sources" pathsep=" ">
159 <path id="proto-files">
160 <fileset dir="${protobuff.dir}" />
164 <property name="proto.path" location="${protobuff.dir}"/>
165 <property name="javaout.path" location="${java.dir}"/>
166 <property name="pythonout.path" location="${python.proto.dir}"/>
167 <exec executable="protoc" failonerror="true">
168 <arg value="<DASH/><DASH/>proto_path=${proto.path}"/>
169 <arg value=""<DASH/><DASH/>java_out=${javaout.path}"/>
170 <arg value=""<DASH/><DASH/>python_out=${pythonout.path}"/>
171 <arg line="${proto.sources}"/>
176 <target name="jar" depends="build" description="Build server jar file">
177 <jar destfile="${dist.dir}/${name}-${curr.release}.jar" manifest="META-INF/MANIFEST.MF">
178 <fileset dir="${classes.dir}">
179 <include name="**/*.*" />
181 <!-- include xsds -->
182 <fileset dir="${java.dir}">
183 <include name="**/*.xsd" />
187 <include name="META-INF/MANIFEST.MF" />
192 <target name="srcjar" description="Build source jar file">
193 <mkdir dir="${dist.dir}" />
194 <jar destfile="${dist.dir}/${name}-${curr.release}-src.jar">
195 <fileset dir="${java.dir}">
196 <include name="**/*.java" />
201 <target name="alljar" depends="build, contrib-build" description="Build a jar file that includes all contrib code.">
202 <jar destfile="${dist.dir}/${name}-${curr.release}-all.jar">
203 <fileset dir="${classes.dir}">
204 <include name="**/*.*" />
206 <fileset dir="${contrib.classes.dir}">
207 <include name="**/*.*" />
209 <!-- include xsds -->
210 <fileset dir="${java.dir}">
211 <include name="**/*.xsd" />
216 <target name="war" depends="build" description="Build server war file">
217 <war destfile="${dist.dir}/${name}.war" webxml="web.xml" basedir="${classes.dir}">
218 <classes dir="${classes.dir}"/>
219 <lib dir="${lib.dir}">
220 <exclude name="${lib.dir}/servlet-api*.jar"/>
221 <exclude name="${lib.dir}/src/**"/>
226 <target name="contrib-build" depends="build, buildtest" description="Compile contrib packages (java and test) ">
227 <replace-dir dir="${contrib.classes.dir}" />
228 <javac destdir="${contrib.classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
229 <src path="${contrib.root.dir}" />
230 <classpath refid="main-classpath" />
231 <classpath refid="contrib-classpath" />
233 <copy todir="${contrib.classes.dir}">
234 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
238 <target name="contrib-jar" depends="contrib-build" description="Build contrib jar file">
239 <jar destfile="${dist.dir}/${name}-contrib-${curr.release}.jar">
240 <fileset dir="${contrib.classes.dir}">
241 <include name="**/*.*" />
246 <target name="contrib-srcjar" description="Build contrib source jar file">
247 <mkdir dir="${dist.dir}" />
248 <jar destfile="${dist.dir}/${name}-contrib-${curr.release}-src.jar">
249 <fileset dir="${contrib.root.dir}/**/java">
250 <include name="**/*.java" />
255 <target name="contrib-junit" depends="contrib-jar" description="Run contrib junit tests except EC2 and Krati tests.">
256 <replace-dir dir="${contribtestreport.dir}" />
257 <replace-dir dir="${contribtesthtml.dir}" />
258 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
259 <classpath refid="contrib-test-classpath" />
260 <formatter type="xml" />
261 <batchtest fork="yes" todir="${contribtestreport.dir}">
262 <fileset dir="${contrib.classes.dir}">
263 <include name="**/*Test.class" />
264 <exclude name="**/*PerformanceTest.class" />
265 <exclude name="**/*RemoteTest.class" />
266 <exclude name="**/Ec2*Test.class" />
267 <exclude name="**/Krati*Test.class" />
268 <exclude name="**/HadoopStoreBuilder*Test.class" />
272 <junitreport todir="${contribtesthtml.dir}">
273 <fileset dir="${contribtestreport.dir}">
274 <include name="TEST-*.xml" />
276 <report todir="${contribtesthtml.dir}" format="frames" />
280 <target name="ec2testing-junit" depends="all" description="Run EC2 testing contrib junit tests.">
281 <copy todir="${testclasses.dir}">
282 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
284 <replace-dir dir="${contribtestreport.dir}" />
285 <replace-dir dir="${contribtesthtml.dir}" />
286 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
288 <propertyref prefix="ec2" />
290 <classpath refid="contrib-test-classpath" />
291 <formatter type="xml" />
292 <batchtest fork="yes" todir="${contribtestreport.dir}">
293 <fileset dir="${contrib.classes.dir}">
294 <include name="**/Ec2SmokeTest.class" />
298 <junitreport todir="${contribtesthtml.dir}">
299 <fileset dir="${contribtestreport.dir}">
300 <include name="TEST-*.xml" />
302 <report todir="${contribtesthtml.dir}" format="frames" />
306 <target name="ec2testing-gossip" depends="contrib-jar" description="Run gossip tests on EC2.">
307 <copy todir="${testclasses.dir}">
308 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
310 <replace-dir dir="${contribtestreport.dir}" />
311 <replace-dir dir="${contribtesthtml.dir}" />
312 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
314 <propertyref prefix="ec2" />
315 <propertyref prefix="log4j" />
316 <propertyref prefix="gossip" />
318 <classpath refid="contrib-test-classpath" />
319 <formatter type="xml" />
320 <batchtest fork="yes" todir="${contribtestreport.dir}">
321 <fileset dir="${contrib.classes.dir}">
322 <include name="**/Ec2GossipTest.class" />
326 <junitreport todir="${contribtesthtml.dir}">
327 <fileset dir="${contribtestreport.dir}">
328 <include name="TEST-*.xml" />
330 <report todir="${contribtesthtml.dir}" format="frames" />
334 <target name="ec2testing-rebalancing" depends="contrib-jar" description="Run rebalancing tests on EC2.">
335 <copy todir="${testclasses.dir}">
336 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
338 <replace-dir dir="${contribtestreport.dir}" />
339 <replace-dir dir="${contribtesthtml.dir}" />
340 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
342 <propertyref prefix="ec2" />
343 <propertyref prefix="log4j" />
344 <propertyref prefix="rebalancing" />
346 <classpath refid="contrib-test-classpath" />
347 <formatter type="xml" />
348 <batchtest fork="yes" todir="${contribtestreport.dir}">
349 <fileset dir="${contrib.classes.dir}">
350 <include name="**/Ec2RebalancingTest.class" />
354 <junitreport todir="${contribtesthtml.dir}">
355 <fileset dir="${contribtestreport.dir}">
356 <include name="TEST-*.xml" />
358 <report todir="${contribtesthtml.dir}" format="frames" />
362 <macrodef name="create-release-artifacts">
363 <attribute name="version" />
365 <antcall target="all"/>
366 <zip destfile="${dist.dir}/${name}-@{version}.zip">
367 <zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
368 <zipfileset dir="." prefix="voldemort-@{version}" includes="**">
369 <exclude name="${dist.dir}/*classes/"/>
370 <exclude name="bin/*"/>
371 <exclude name="build/*"/>
372 <exclude name=".git*/**"/>
373 <exclude name=".gradle*/**"/>
376 <tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
377 <tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
378 <tarfileset dir="." prefix="voldemort-@{version}" includes="**">
379 <exclude name="${dist.dir}/*classes/"/>
380 <exclude name="${dist.dir}/*.zip"/>
381 <exclude name="bin/*"/>
382 <exclude name="build/*"/>
383 <exclude name=".git*/**"/>
384 <exclude name=".gradle*/**"/>
390 <target name="snapshot" description="Create a release-snapshot zip file with everything pre-built.">
391 <create-release-artifacts version="${curr.release.snapshot}" />
394 <target name="release" description="Create a release zip file with everything pre-built.">
395 <create-release-artifacts version="${curr.release}" />
398 <target name="hadoop-benchmark-jar" depends="build, contrib-build"
399 description="Build a jar file that includes all contrib code plus the necessary jars for running the hadoop benchmark.">
400 <jar destfile="${dist.dir}/hadoop-benchmark.jar">
401 <fileset dir="${classes.dir}">
402 <include name="**/*.*" />
404 <fileset dir="${contrib.classes.dir}">
405 <include name="**/*.*" />
407 <!-- include xsds -->
408 <fileset dir="${java.dir}">
409 <include name="**/*.xsd" />
412 <include name="lib/jdom*.jar"/>
413 <include name="lib/google-collect*.jar"/>
414 <include name="lib/commons-lang*.jar"/>
419 <target name="junit" depends="build, buildtest" description="Run junit tests.">
420 <replace-dir dir="${testreport.dir}" />
421 <replace-dir dir="${testhtml.dir}" />
422 <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
423 <classpath refid="test-classpath" />
424 <formatter type="xml" />
425 <batchtest fork="yes" todir="${testreport.dir}">
426 <fileset dir="${unittestsrc.dir}">
427 <include name="**/*Test.java" />
428 <exclude name="**/Abstract*.java" />
432 <junitreport todir="${testhtml.dir}">
433 <fileset dir="${testreport.dir}">
434 <include name="TEST-*.xml" />
436 <report todir="${testhtml.dir}" format="frames" />
440 <target name="junit-long" depends="build, buildtest, junit" description="Run long junit tests that uses larger data sets than normal junit tests.">
441 <replace-dir dir="${longtestreport.dir}" />
442 <replace-dir dir="${longtesthtml.dir}" />
443 <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
444 <classpath refid="test-classpath" />
445 <formatter type="xml" />
446 <batchtest todir="${longtestreport.dir}">
447 <fileset dir="${longtestsrc.dir}">
448 <include name="**/*Test.java" />
452 <junitreport todir="${longtesthtml.dir}">
453 <fileset dir="${longtestreport.dir}">
454 <include name="TEST-*.xml" />
456 <report todir="${longtesthtml.dir}" format="frames" />
460 <target name="junit-rebalance" depends="build, buildtest" description="Run junit tests only for rebalance.">
461 <replace-dir dir="${testreport.dir}" />
462 <replace-dir dir="${testhtml.dir}" />
463 <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
464 <classpath refid="test-classpath" />
465 <formatter type="xml" />
466 <batchtest fork="yes" todir="${testreport.dir}">
467 <fileset dir="${unittestsrc.dir}">
468 <include name="**/*Rebalance*Test.java" />
469 <exclude name="**/Abstract*.java" />
473 <junitreport todir="${testhtml.dir}">
474 <fileset dir="${testreport.dir}">
475 <include name="TEST-*.xml" />
477 <report todir="${testhtml.dir}" format="frames" />
481 <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.">
482 <replace-dir dir="${longtestreport.dir}" />
483 <replace-dir dir="${longtesthtml.dir}" />
484 <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
485 <classpath refid="test-classpath" />
486 <formatter type="xml" />
487 <batchtest todir="${longtestreport.dir}">
488 <fileset dir="${longtestsrc.dir}">
489 <include name="**/*Rebalance*Test.java" />
493 <junitreport todir="${longtesthtml.dir}">
494 <fileset dir="${longtestreport.dir}">
495 <include name="TEST-*.xml" />
497 <report todir="${longtesthtml.dir}" format="frames" />
501 <target name="junit-test" 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)">
502 <replace-dir dir="${singletestreport.dir}" />
503 <replace-dir dir="${singletesthtml.dir}" />
504 <junit printsummary="on" showoutput="true" maxmemory="4096m">
505 <classpath refid="contrib-test-classpath" />
506 <classpath path="${log4j.properties.dir}" />
507 <formatter type="plain" />
508 <formatter type="xml" />
509 <test name="${test.name}" todir="${singletestreport.dir}"/>
511 <junitreport todir="${singletesthtml.dir}">
512 <fileset dir="${singletestreport.dir}">
513 <include name="TEST-*.xml" />
515 <report todir="${singletesthtml.dir}" format="frames" />
519 <target name="junit-all" depends="junit-long, contrib-junit" description="Run All junit tests including contrib.">
522 <macrodef name="make-javadocs">
523 <attribute name="dir" />
524 <attribute name="packagenames" />
525 <attribute name="javadir" />
527 <replace-dir dir="@{dir}" />
528 <javadoc sourcepath="@{javadir}" destdir="@{dir}" windowtitle="${display.name}" source="${javac.version}" author="true" version="true" use="true" packagenames="@{packagenames}">
529 <doctitle>${display.name}</doctitle>
530 <bottom>${author}</bottom>
531 <classpath refid="main-classpath" />
536 <target name="docs" description="Create complete Javadoc documentation">
537 <make-javadocs dir="${javadoc.dir}/all" packagenames="*" javadir="${java.dir}"/>
538 <make-javadocs dir="${javadoc.dir}/client" packagenames="voldemort.versioning.*, voldemort.client.*,voldemort.serialization.*" javadir="${java.dir}"/>
541 <target name="redeploy" depends="war, deploy">
544 <taskdef file="tomcat-tasks.properties">
546 <path location="${lib.dir}/catalina-ant.jar" />
550 <target name="list" description="List Tomcat applications">
551 <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
554 <target name="deploy" description="Deploy application" depends="war">
555 <deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${tomcat.context}" update="true" war="file:${dist.dir}/${name}.war" />
558 <target name="undeploy" description="Undeploy application">
559 <undeploy url="${tomcat.manager.url}"
560 username="${tomcat.manager.username}"
561 password="${tomcat.manager.password}"
562 path="${tomcat.context}"/>