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="${public.lib.dir}/scala-compiler-${scalac.version}.jar"/>
12 <property name="scala-library.jar" value="${public.lib.dir}/scala-library-${scalac.version}.jar"/>
13 <property name="scala-reflect.jar" value="${public.lib.dir}/scala-reflect-${scalac.version}.jar"/>
15 <path id="main-classpath">
16 <fileset dir="${public.lib.dir}">
17 <include name="*.jar" />
19 <fileset dir="${private.lib.dir}">
20 <include name="*.jar" />
22 <pathelement path="${classes.dir}" />
25 <!-- set the scala classpath -->
26 <path id="scala.classpath">
27 <pathelement location="${scala-compiler.jar}"/>
28 <pathelement location="${scala-library.jar}"/>
29 <pathelement location="${scala-reflect.jar}"/>
30 <path refid="main-classpath" />
31 <pathelement path="${classes.dir}" />
34 <taskdef resource="scala/tools/ant/antlib.xml">
35 <classpath refid="scala.classpath"/>
38 <!-- set the build number based on environment variable, otherwise blank -->
39 <property environment="env" description="System environment variables (including those set by Hudson)"/>
40 <condition property="curr.release.snapshot" value="${curr.release}-snapshot-${env.BUILD_NUMBER}" else="${curr.release}">
42 <isset property="env.BUILD_NUMBER" />
44 <equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
49 <path id="contrib-classpath">
50 <pathelement path="${resources.dir}" />
51 <fileset dir="${dist.dir}">
52 <include name="${name}-${curr.release}.jar" />
54 <fileset dir="${public.lib.dir}">
55 <include name="*.jar" />
57 <path refid="test-classpath" />
60 <path id="test-classpath">
61 <pathelement path="${resources.dir}" />
62 <pathelement path="${env.VOLD_TEST_JARS}" />
63 <path refid="main-classpath" />
64 <pathelement path="${testclasses.dir}" />
67 <path id="contrib-test-classpath">
68 <path refid="main-classpath" />
69 <path refid="contrib-classpath" />
70 <fileset dir="${dist.dir}">
71 <include name="${name}-contrib-${curr.release}.jar" />
73 <pathelement path="${testclasses.dir}" />
76 <macrodef name="replace-dir">
77 <attribute name="dir" />
79 <delete dir="@{dir}" />
80 <mkdir dir="@{dir}" />
84 <target name="all" depends="clean, jar, test, contrib-jar, srcjar" description="Build all artifacts." />
86 <target name="clean" description="Delete generated files.">
87 <delete dir="${dist.dir}" />
89 <replace-dir dir="${javadoc.dir}" />
92 <target name="build" description="Compile main source tree java files">
93 <replace-dir dir="${classes.dir}" />
94 <!-- copy non-java files to classes dir to load from classpath -->
95 <copy todir="${classes.dir}">
96 <fileset dir="${java.dir}">
97 <exclude name="**/*.java" />
98 <exclude name="**/*.html" />
99 <exclude name="**/*.scala" />
100 <exclude name="**/log4j.properties" />
103 <replace-dir dir="META-INF" />
104 <echo message="creating manifest"/>
105 <manifest file="META-INF/MANIFEST.MF">
106 <attribute name="Voldemort-Implementation-Version" value="${curr.release}" />
107 <attribute name="Implementation-Title" value="Voldemort" />
108 <attribute name="Implementation-Version" value="${curr.release}" />
109 <attribute name="Implementation-Vendor" value="LinkedIn" />
111 <!-- place to put log4j.properties -->
112 <replace-dir dir="${resources.dir}"/>
113 <copy file="${java.dir}/log4j.properties" todir="${resources.dir}"/>
114 <!-- regular java files compiled with javac task -->
115 <javac destdir="${classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
116 <src path="${java.dir}" />
117 <classpath refid="main-classpath" />
119 <!-- compile scala files with the scalac task -->
120 <scalac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="scala.classpath">
121 <include name="**/*.scala"/>
124 <fileset dir="${private.lib.dir}" />
125 <fileset dir="${public.lib.dir}" />
129 <target name="buildtest" description="Compile test classes">
130 <replace-dir dir="${testclasses.dir}" />
131 <copy todir="${testclasses.dir}">
132 <fileset dir="${commontestsrc.dir}">
133 <exclude name="**/*.java" />
134 <exclude name="**/*.html" />
137 <copy todir="${testclasses.dir}">
138 <fileset dir="${unittestsrc.dir}">
139 <exclude name="**/*.java" />
140 <exclude name="**/*.html" />
143 <javac destdir="${testclasses.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
144 <src path="${unittestsrc.dir}" />
145 <src path="${inttestsrc.dir}" />
146 <src path="${commontestsrc.dir}" />
147 <src path="${longtestsrc.dir}" />
148 <classpath refid="main-classpath" />
152 <target name="test" depends="build, buildtest" description="Build test jar file">
153 <jar destfile="${dist.dir}/${name}-test-${curr.release}.jar">
154 <fileset dir="${testclasses.dir}" />
159 Use protoc version 2.3.0 to recompile by hand:
160 https://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.3.0.tar.gz&can=2&q=
162 Below, '<DASH/>' means '-'. This was done to nest double-dashes within xml comment.
164 <target name="protobuff" description="Generate source files from .proto files">
165 <pathconvert property="proto.sources" pathsep=" ">
166 <path id="proto-files">
167 <fileset dir="${protobuff.dir}" />
171 <property name="proto.path" location="${protobuff.dir}"/>
172 <property name="javaout.path" location="${java.dir}"/>
173 <property name="pythonout.path" location="${python.proto.dir}"/>
174 <exec executable="protoc" failonerror="true">
175 <arg value="<DASH/><DASH/>proto_path=${proto.path}"/>
176 <arg value=""<DASH/><DASH/>java_out=${javaout.path}"/>
177 <arg value=""<DASH/><DASH/>python_out=${pythonout.path}"/>
178 <arg line="${proto.sources}"/>
183 <target name="jar" depends="build" description="Build server jar file">
184 <jar destfile="${dist.dir}/${name}-${curr.release}.jar" manifest="META-INF/MANIFEST.MF">
185 <fileset dir="${classes.dir}">
186 <include name="**/*.*" />
188 <!-- include xsds -->
189 <fileset dir="${java.dir}">
190 <include name="**/*.xsd" />
194 <include name="META-INF/MANIFEST.MF" />
199 <target name="srcjar" description="Build source jar file">
200 <mkdir dir="${dist.dir}" />
201 <jar destfile="${dist.dir}/${name}-${curr.release}-src.jar">
202 <fileset dir="${java.dir}">
203 <include name="**/*.java" />
208 <target name="alljar" depends="build, contrib-build" description="Build a jar file that includes all contrib code.">
209 <jar destfile="${dist.dir}/${name}-${curr.release}-all.jar">
210 <fileset dir="${classes.dir}">
211 <include name="**/*.*" />
213 <fileset dir="${contrib.classes.dir}">
214 <include name="**/*.*" />
216 <!-- include xsds -->
217 <fileset dir="${java.dir}">
218 <include name="**/*.xsd" />
223 <target name="war" depends="build" description="Build server war file">
224 <war destfile="${dist.dir}/${name}.war" webxml="web.xml" basedir="${classes.dir}">
225 <classes dir="${classes.dir}"/>
226 <lib dir="${public.lib.dir}">
227 <exclude name="${public.lib.dir}/servlet-api*.jar"/>
228 <exclude name="${public.lib.dir}/src/**"/>
230 <lib dir="${private.lib.dir}">
231 <exclude name="${private.lib.dir}/servlet-api*.jar"/>
232 <exclude name="${private.lib.dir}/src/**"/>
237 <target name="contrib-build" depends="build, buildtest" description="Compile contrib packages (java and test) ">
238 <replace-dir dir="${contrib.classes.dir}" />
239 <javac destdir="${contrib.classes.dir}" target="${javac.version}" source="${javac.version}" debug="true" deprecation="false" failonerror="true" includeantruntime="false">
240 <src path="${contrib.root.dir}" />
241 <classpath refid="main-classpath" />
242 <classpath refid="contrib-classpath" />
244 <copy todir="${contrib.classes.dir}">
245 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
249 <target name="contrib-jar" depends="contrib-build" description="Build contrib jar file">
250 <jar destfile="${dist.dir}/${name}-contrib-${curr.release}.jar">
251 <fileset dir="${contrib.classes.dir}">
252 <include name="**/*.*" />
257 <target name="contrib-srcjar" description="Build contrib source jar file">
258 <mkdir dir="${dist.dir}" />
259 <jar destfile="${dist.dir}/${name}-contrib-${curr.release}-src.jar">
260 <fileset dir="${contrib.root.dir}/**/java">
261 <include name="**/*.java" />
266 <target name="contrib-junit" depends="contrib-jar" description="Run contrib junit tests except EC2 and Krati tests.">
267 <replace-dir dir="${contribtestreport.dir}" />
268 <replace-dir dir="${contribtesthtml.dir}" />
269 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
270 <classpath refid="contrib-test-classpath" />
271 <formatter type="xml" />
272 <batchtest fork="yes" todir="${contribtestreport.dir}">
273 <fileset dir="${contrib.classes.dir}">
274 <include name="**/*Test.class" />
275 <exclude name="**/*PerformanceTest.class" />
276 <exclude name="**/*RemoteTest.class" />
277 <exclude name="**/Ec2*Test.class" />
278 <exclude name="**/Krati*Test.class" />
279 <exclude name="**/HadoopStoreBuilder*Test.class" />
283 <junitreport todir="${contribtesthtml.dir}">
284 <fileset dir="${contribtestreport.dir}">
285 <include name="TEST-*.xml" />
287 <report todir="${contribtesthtml.dir}" format="frames" />
291 <target name="ec2testing-junit" depends="all" description="Run EC2 testing contrib junit tests.">
292 <copy todir="${testclasses.dir}">
293 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
295 <replace-dir dir="${contribtestreport.dir}" />
296 <replace-dir dir="${contribtesthtml.dir}" />
297 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
299 <propertyref prefix="ec2" />
301 <classpath refid="contrib-test-classpath" />
302 <formatter type="xml" />
303 <batchtest fork="yes" todir="${contribtestreport.dir}">
304 <fileset dir="${contrib.classes.dir}">
305 <include name="**/Ec2SmokeTest.class" />
309 <junitreport todir="${contribtesthtml.dir}">
310 <fileset dir="${contribtestreport.dir}">
311 <include name="TEST-*.xml" />
313 <report todir="${contribtesthtml.dir}" format="frames" />
317 <target name="ec2testing-gossip" depends="contrib-jar" description="Run gossip tests on EC2.">
318 <copy todir="${testclasses.dir}">
319 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
321 <replace-dir dir="${contribtestreport.dir}" />
322 <replace-dir dir="${contribtesthtml.dir}" />
323 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
325 <propertyref prefix="ec2" />
326 <propertyref prefix="log4j" />
327 <propertyref prefix="gossip" />
329 <classpath refid="contrib-test-classpath" />
330 <formatter type="xml" />
331 <batchtest fork="yes" todir="${contribtestreport.dir}">
332 <fileset dir="${contrib.classes.dir}">
333 <include name="**/Ec2GossipTest.class" />
337 <junitreport todir="${contribtesthtml.dir}">
338 <fileset dir="${contribtestreport.dir}">
339 <include name="TEST-*.xml" />
341 <report todir="${contribtesthtml.dir}" format="frames" />
345 <target name="ec2testing-rebalancing" depends="contrib-jar" description="Run rebalancing tests on EC2.">
346 <copy todir="${testclasses.dir}">
347 <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
349 <replace-dir dir="${contribtestreport.dir}" />
350 <replace-dir dir="${contribtesthtml.dir}" />
351 <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
353 <propertyref prefix="ec2" />
354 <propertyref prefix="log4j" />
355 <propertyref prefix="rebalancing" />
357 <classpath refid="contrib-test-classpath" />
358 <formatter type="xml" />
359 <batchtest fork="yes" todir="${contribtestreport.dir}">
360 <fileset dir="${contrib.classes.dir}">
361 <include name="**/Ec2RebalancingTest.class" />
365 <junitreport todir="${contribtesthtml.dir}">
366 <fileset dir="${contribtestreport.dir}">
367 <include name="TEST-*.xml" />
369 <report todir="${contribtesthtml.dir}" format="frames" />
373 <macrodef name="create-release-artifacts">
374 <attribute name="version" />
376 <antcall target="all"/>
377 <zip destfile="${dist.dir}/${name}-@{version}.zip">
378 <zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
379 <zipfileset dir="." prefix="voldemort-@{version}" includes="**">
380 <exclude name="${dist.dir}/*classes/"/>
381 <exclude name="bin/*"/>
382 <exclude name="build/*"/>
383 <exclude name=".git*/**"/>
384 <exclude name=".gradle*/**"/>
387 <tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
388 <tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
389 <tarfileset dir="." prefix="voldemort-@{version}" includes="**">
390 <exclude name="${dist.dir}/*classes/"/>
391 <exclude name="${dist.dir}/*.zip"/>
392 <exclude name="bin/*"/>
393 <exclude name="build/*"/>
394 <exclude name=".git*/**"/>
395 <exclude name=".gradle*/**"/>
401 <target name="snapshot" description="Create a release-snapshot zip file with everything pre-built.">
402 <create-release-artifacts version="${curr.release.snapshot}" />
405 <target name="release" description="Create a release zip file with everything pre-built.">
406 <create-release-artifacts version="${curr.release}" />
409 <target name="hadoop-benchmark-jar" depends="build, contrib-build"
410 description="Build a jar file that includes all contrib code plus the necessary jars for running the hadoop benchmark.">
411 <jar destfile="${dist.dir}/hadoop-benchmark.jar">
412 <fileset dir="${classes.dir}">
413 <include name="**/*.*" />
415 <fileset dir="${contrib.classes.dir}">
416 <include name="**/*.*" />
418 <!-- include xsds -->
419 <fileset dir="${java.dir}">
420 <include name="**/*.xsd" />
423 <include name="lib/jdom*.jar"/>
424 <include name="lib/google-collect*.jar"/>
425 <include name="lib/commons-lang*.jar"/>
430 <target name="junit" depends="build, buildtest" description="Run junit tests.">
431 <replace-dir dir="${testreport.dir}" />
432 <replace-dir dir="${testhtml.dir}" />
433 <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
434 <classpath refid="test-classpath" />
435 <formatter type="xml" />
436 <batchtest fork="yes" todir="${testreport.dir}">
437 <fileset dir="${unittestsrc.dir}">
438 <include name="**/*Test.java" />
439 <exclude name="**/Abstract*.java" />
443 <junitreport todir="${testhtml.dir}">
444 <fileset dir="${testreport.dir}">
445 <include name="TEST-*.xml" />
447 <report todir="${testhtml.dir}" format="frames" />
451 <target name="junit-long" depends="build, buildtest, junit" description="Run long junit tests that uses larger data sets than normal junit tests.">
452 <replace-dir dir="${longtestreport.dir}" />
453 <replace-dir dir="${longtesthtml.dir}" />
454 <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
455 <classpath refid="test-classpath" />
456 <formatter type="xml" />
457 <batchtest todir="${longtestreport.dir}">
458 <fileset dir="${longtestsrc.dir}">
459 <include name="**/*Test.java" />
463 <junitreport todir="${longtesthtml.dir}">
464 <fileset dir="${longtestreport.dir}">
465 <include name="TEST-*.xml" />
467 <report todir="${longtesthtml.dir}" format="frames" />
471 <target name="junit-rebalance" depends="build, buildtest" description="Run junit tests only for rebalance.">
472 <replace-dir dir="${testreport.dir}" />
473 <replace-dir dir="${testhtml.dir}" />
474 <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
475 <classpath refid="test-classpath" />
476 <formatter type="xml" />
477 <batchtest fork="yes" todir="${testreport.dir}">
478 <fileset dir="${unittestsrc.dir}">
479 <include name="**/*Rebalance*Test.java" />
480 <exclude name="**/Abstract*.java" />
484 <junitreport todir="${testhtml.dir}">
485 <fileset dir="${testreport.dir}">
486 <include name="TEST-*.xml" />
488 <report todir="${testhtml.dir}" format="frames" />
492 <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.">
493 <replace-dir dir="${longtestreport.dir}" />
494 <replace-dir dir="${longtesthtml.dir}" />
495 <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
496 <classpath refid="test-classpath" />
497 <formatter type="xml" />
498 <batchtest todir="${longtestreport.dir}">
499 <fileset dir="${longtestsrc.dir}">
500 <include name="**/*Rebalance*Test.java" />
504 <junitreport todir="${longtesthtml.dir}">
505 <fileset dir="${longtestreport.dir}">
506 <include name="TEST-*.xml" />
508 <report todir="${longtesthtml.dir}" format="frames" />
512 <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)">
513 <replace-dir dir="${singletestreport.dir}" />
514 <replace-dir dir="${singletesthtml.dir}" />
515 <junit printsummary="on" showoutput="true" maxmemory="4096m">
516 <classpath refid="contrib-test-classpath" />
517 <classpath path="${log4j.properties.dir}" />
518 <formatter type="plain" />
519 <formatter type="xml" />
520 <test name="${test.name}" todir="${singletestreport.dir}"/>
522 <junitreport todir="${singletesthtml.dir}">
523 <fileset dir="${singletestreport.dir}">
524 <include name="TEST-*.xml" />
526 <report todir="${singletesthtml.dir}" format="frames" />
530 <target name="junit-all" depends="junit-long, contrib-junit" description="Run All junit tests including contrib.">
533 <macrodef name="make-javadocs">
534 <attribute name="dir" />
535 <attribute name="packagenames" />
536 <attribute name="javadir" />
538 <replace-dir dir="@{dir}" />
539 <javadoc sourcepath="@{javadir}" destdir="@{dir}" windowtitle="${display.name}" source="${javac.version}" author="true" version="true" use="true" packagenames="@{packagenames}">
540 <doctitle>${display.name}</doctitle>
541 <bottom>${author}</bottom>
542 <classpath refid="main-classpath" />
547 <target name="docs" description="Create complete Javadoc documentation">
548 <make-javadocs dir="${javadoc.dir}/all" packagenames="*" javadir="${java.dir}"/>
549 <make-javadocs dir="${javadoc.dir}/client" packagenames="voldemort.versioning.*, voldemort.client.*,voldemort.serialization.*" javadir="${java.dir}"/>
552 <target name="redeploy" depends="war, deploy">
555 <taskdef file="tomcat-tasks.properties">
557 <path location="${private.lib.dir}/catalina-ant.jar" />
561 <target name="list" description="List Tomcat applications">
562 <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
565 <target name="deploy" description="Deploy application" depends="war">
566 <deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${tomcat.context}" update="true" war="file:${dist.dir}/${name}.war" />
569 <target name="undeploy" description="Undeploy application">
570 <undeploy url="${tomcat.manager.url}"
571 username="${tomcat.manager.username}"
572 password="${tomcat.manager.password}"
573 path="${tomcat.context}"/>