Co-ordinator GetAll fails for some data
[voldemort/jeffpc.git] / build.xml
blob2439291576a9ec95e8f136b0302c3de6cc0f86f3
1 <?xml version="1.0"?>
3 <project name="voldemort" basedir="." default="all">
4   <property file="build.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" />
18     </fileset>
19     <pathelement path="${classes.dir}" />
20   </path>
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" />
29     </fileset>
30     <pathelement path="${classes.dir}" />
31   </path>
32   <taskdef resource="scala/tools/ant/antlib.xml">
33   <classpath refid="scala.classpath"/>
34   </taskdef>
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}">
39        <and>
40           <isset property="env.BUILD_NUMBER" />
41           <not>
42               <equals arg1="" arg2="${env.BUILD_NUMBER}" trim="yes"/>
43           </not>
44        </and>
45   </condition>
47   <path id="contrib-classpath">
48     <pathelement path="${resources.dir}" />
49     <fileset dir="${dist.dir}">
50       <include name="${name}-${curr.release}.jar" />
51     </fileset>
52     <fileset dir="${contrib.root.dir}">
53       <include name="**/*.jar" />
54     </fileset>
55     <path refid="test-classpath" />
56   </path>
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}" />
63   </path>
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" />
70     </fileset>
71     <pathelement path="${testclasses.dir}" />
72   </path>
74   <macrodef name="replace-dir">
75     <attribute name="dir" />
76     <sequential>
77       <delete dir="@{dir}" />
78       <mkdir dir="@{dir}" />
79     </sequential>
80   </macrodef>
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}" />
87   </target>
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" />
98       </fileset>
99     </copy>
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" />
107     </manifest>
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" />
115     </javac>
116     <!-- compile scala files with the scalac task -->
117     <scalac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="scala.classpath">
118     <include name="**/*.scala"/>
119     </scalac>
120   </target>
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" />
128       </fileset>
129     </copy>
130     <copy todir="${testclasses.dir}">
131       <fileset dir="${unittestsrc.dir}">
132         <exclude name="**/*.java" />
133         <exclude name="**/*.html" />
134       </fileset>
135     </copy>
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" />
142     </javac>
143   </target>
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}" />
148     </jar>
149   </target>
151   <!--
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}" />
161       </path>
162     </pathconvert>
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}"/>
172     </exec>
173   </target>
174   -->
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="**/*.*" />
180       </fileset>
181       <!-- include xsds -->
182       <fileset dir="${java.dir}">
183         <include name="**/*.xsd" />
184       </fileset>
185         
186         <fileset dir=".">
187                         <include name="META-INF/MANIFEST.MF" />
188       </fileset>
189     </jar>
190   </target>
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" />
197       </fileset>
198     </jar>
199   </target>
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="**/*.*" />
205       </fileset>
206       <fileset dir="${contrib.classes.dir}">
207         <include name="**/*.*" />
208       </fileset>
209       <!-- include xsds -->
210       <fileset dir="${java.dir}">
211         <include name="**/*.xsd" />
212       </fileset>
213     </jar>
214   </target>
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/**"/>
222       </lib>
223     </war>
224   </target>
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       <src path="${contrib.root.dir}" />
231       <classpath refid="main-classpath" />
232       <classpath refid="contrib-classpath" />
233     </javac>
234     <copy todir="${contrib.classes.dir}">
235       <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
236     </copy>
237   </target>
239   <target name="contrib-jar" depends="contrib-build" description="Build contrib jar file">
240     <jar destfile="${dist.dir}/${name}-contrib-${curr.release}.jar">
241       <fileset dir="${contrib.classes.dir}">
242         <include name="**/*.*" />
243       </fileset>
244     </jar>
245   </target>
247   <target name="contrib-srcjar" description="Build contrib source jar file">
248     <mkdir dir="${dist.dir}" />
249     <jar destfile="${dist.dir}/${name}-contrib-${curr.release}-src.jar">
250       <fileset dir="${contrib.root.dir}/**/java">
251         <include name="**/*.java" />
252       </fileset>
253     </jar>
254   </target>
256   <target name="contrib-junit" depends="contrib-jar" description="Run contrib junit tests except EC2 and Krati tests.">
257     <replace-dir dir="${contribtestreport.dir}" />
258     <replace-dir dir="${contribtesthtml.dir}" />
259     <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
260       <classpath refid="contrib-test-classpath" />
261       <formatter type="xml" />
262       <batchtest fork="yes" todir="${contribtestreport.dir}">
263         <fileset dir="${contrib.classes.dir}">
264           <include name="**/*Test.class" />
265           <exclude name="**/*PerformanceTest.class" />
266           <exclude name="**/*RemoteTest.class" />
267           <exclude name="**/Ec2*Test.class" />
268           <exclude name="**/Krati*Test.class" />
269           <exclude name="**/HadoopStoreBuilder*Test.class" />
270         </fileset>
271       </batchtest>
272     </junit>
273     <junitreport todir="${contribtesthtml.dir}">
274       <fileset dir="${contribtestreport.dir}">
275         <include name="TEST-*.xml" />
276       </fileset>
277       <report todir="${contribtesthtml.dir}" format="frames" />
278     </junitreport>
279   </target>
281   <target name="ec2testing-junit" depends="all" description="Run EC2 testing contrib junit tests.">
282     <copy todir="${testclasses.dir}">
283       <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
284     </copy>
285     <replace-dir dir="${contribtestreport.dir}" />
286     <replace-dir dir="${contribtesthtml.dir}" />
287     <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
288       <syspropertyset>
289         <propertyref prefix="ec2" />
290       </syspropertyset>
291       <classpath refid="contrib-test-classpath" />
292       <formatter type="xml" />
293       <batchtest fork="yes" todir="${contribtestreport.dir}">
294         <fileset dir="${contrib.classes.dir}">
295           <include name="**/Ec2SmokeTest.class" />
296         </fileset>
297       </batchtest>
298     </junit>
299     <junitreport todir="${contribtesthtml.dir}">
300       <fileset dir="${contribtestreport.dir}">
301         <include name="TEST-*.xml" />
302       </fileset>
303       <report todir="${contribtesthtml.dir}" format="frames" />
304     </junitreport>
305   </target>
307   <target name="ec2testing-gossip" depends="contrib-jar" description="Run gossip tests on EC2.">
308     <copy todir="${testclasses.dir}">
309       <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
310     </copy>
311     <replace-dir dir="${contribtestreport.dir}" />
312     <replace-dir dir="${contribtesthtml.dir}" />
313     <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
314       <syspropertyset>
315         <propertyref prefix="ec2" />
316         <propertyref  prefix="log4j" />
317         <propertyref  prefix="gossip" />
318       </syspropertyset>
319       <classpath refid="contrib-test-classpath" />
320       <formatter type="xml" />
321       <batchtest fork="yes" todir="${contribtestreport.dir}">
322         <fileset dir="${contrib.classes.dir}">
323           <include name="**/Ec2GossipTest.class" />
324         </fileset>
325       </batchtest>
326     </junit>
327     <junitreport todir="${contribtesthtml.dir}">
328       <fileset dir="${contribtestreport.dir}">
329         <include name="TEST-*.xml" />
330       </fileset>
331       <report todir="${contribtesthtml.dir}" format="frames" />
332     </junitreport>
333   </target>
335   <target name="ec2testing-rebalancing" depends="contrib-jar" description="Run rebalancing tests on EC2.">
336     <copy todir="${testclasses.dir}">
337       <fileset dir="${contrib.root.dir}/ec2-testing/resources" />
338     </copy>
339     <replace-dir dir="${contribtestreport.dir}" />
340     <replace-dir dir="${contribtesthtml.dir}" />
341     <junit printsummary="yes" maxmemory="2048m" showoutput="true" failureProperty="test.failure">
342       <syspropertyset>
343         <propertyref prefix="ec2" />
344         <propertyref  prefix="log4j" />
345         <propertyref  prefix="rebalancing" />
346       </syspropertyset>
347       <classpath refid="contrib-test-classpath" />
348       <formatter type="xml" />
349       <batchtest fork="yes" todir="${contribtestreport.dir}">
350         <fileset dir="${contrib.classes.dir}">
351           <include name="**/Ec2RebalancingTest.class" />
352         </fileset>
353       </batchtest>
354     </junit>
355     <junitreport todir="${contribtesthtml.dir}">
356       <fileset dir="${contribtestreport.dir}">
357         <include name="TEST-*.xml" />
358       </fileset>
359       <report todir="${contribtesthtml.dir}" format="frames" />
360     </junitreport>
361   </target>
363   <macrodef name="create-release-artifacts">
364     <attribute name="version" />
365     <sequential>
366     <antcall target="all"/>
367     <zip destfile="${dist.dir}/${name}-@{version}.zip">
368       <zipfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
369       <zipfileset dir="." prefix="voldemort-@{version}" includes="**">
370         <exclude name="${dist.dir}/*classes/"/>
371         <exclude name="bin/*"/>
372         <exclude name=".git*/**"/>
373       </zipfileset>
374     </zip>
375     <tar destfile="${dist.dir}/${name}-@{version}.tar.gz" compression="gzip" longfile="gnu">
376       <tarfileset dir="." prefix="voldemort-@{version}" filemode="755" includes="bin/*"/>
377       <tarfileset dir="." prefix="voldemort-@{version}" includes="**">
378         <exclude name="${dist.dir}/*classes/"/>
379         <exclude name="${dist.dir}/*.zip"/>
380         <exclude name="bin/*"/>
381         <exclude name=".git*/**"/>
382       </tarfileset>
383     </tar>
384     </sequential>
385   </macrodef>
387   <target name="snapshot"  description="Create a release-snapshot zip file with everything pre-built.">
388     <create-release-artifacts version="${curr.release.snapshot}" />
389   </target>
391   <target name="release" description="Create a release zip file with everything pre-built.">
392     <create-release-artifacts version="${curr.release}" />
393   </target>
395   <target name="hadoop-benchmark-jar" depends="build, contrib-build"
396     description="Build a jar file that includes all contrib code plus the necessary jars for running the hadoop benchmark.">
397     <jar destfile="${dist.dir}/hadoop-benchmark.jar">
398       <fileset dir="${classes.dir}">
399         <include name="**/*.*" />
400       </fileset>
401       <fileset dir="${contrib.classes.dir}">
402         <include name="**/*.*" />
403       </fileset>
404       <!-- include xsds -->
405       <fileset dir="${java.dir}">
406         <include name="**/*.xsd" />
407       </fileset>
408       <fileset dir="">
409         <include name="lib/jdom*.jar"/>
410         <include name="lib/google-collect*.jar"/>
411         <include name="lib/commons-lang*.jar"/>
412       </fileset>
413     </jar>
414   </target>
416   <target name="junit" depends="build, buildtest" description="Run junit tests.">
417     <replace-dir dir="${testreport.dir}" />
418     <replace-dir dir="${testhtml.dir}" />
419     <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
420       <classpath refid="test-classpath" />
421       <formatter type="xml" />
422       <batchtest fork="yes" todir="${testreport.dir}">
423         <fileset dir="${unittestsrc.dir}">
424           <include name="**/*Test.java" />
425           <exclude name="**/Abstract*.java" />
426         </fileset>
427       </batchtest>
428     </junit>
429     <junitreport todir="${testhtml.dir}">
430       <fileset dir="${testreport.dir}">
431         <include name="TEST-*.xml" />
432       </fileset>
433       <report todir="${testhtml.dir}" format="frames" />
434     </junitreport>
435   </target>
437   <target name="junit-long" depends="build, buildtest, junit" description="Run long junit tests that uses larger data sets than normal junit tests.">
438     <replace-dir dir="${longtestreport.dir}" />
439     <replace-dir dir="${longtesthtml.dir}" />
440     <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
441       <classpath refid="test-classpath" />
442       <formatter type="xml" />
443       <batchtest todir="${longtestreport.dir}">
444         <fileset dir="${longtestsrc.dir}">
445           <include name="**/*Test.java" />
446         </fileset>
447       </batchtest>
448     </junit>
449     <junitreport todir="${longtesthtml.dir}">
450       <fileset dir="${longtestreport.dir}">
451         <include name="TEST-*.xml" />
452       </fileset>
453       <report todir="${longtesthtml.dir}" format="frames" />
454     </junitreport>
455   </target>
457   <target name="junit-rebalance" depends="build, buildtest" description="Run junit tests only for rebalance.">
458     <replace-dir dir="${testreport.dir}" />
459     <replace-dir dir="${testhtml.dir}" />
460     <junit printsummary="yes" showoutput="true" maxmemory="2048m" timeout="1200000">
461       <classpath refid="test-classpath" />
462       <formatter type="xml" />
463       <batchtest fork="yes" todir="${testreport.dir}">
464         <fileset dir="${unittestsrc.dir}">
465           <include name="**/*Rebalance*Test.java" />
466           <exclude name="**/Abstract*.java" />
467         </fileset>
468       </batchtest>
469     </junit>
470     <junitreport todir="${testhtml.dir}">
471       <fileset dir="${testreport.dir}">
472         <include name="TEST-*.xml" />
473       </fileset>
474       <report todir="${testhtml.dir}" format="frames" />
475     </junitreport>
476   </target>
478   <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.">
479     <replace-dir dir="${longtestreport.dir}" />
480     <replace-dir dir="${longtesthtml.dir}" />
481     <junit printsummary="yes" showoutput="true" maxmemory="2048m" fork="yes" timeout="5400000">
482       <classpath refid="test-classpath" />
483       <formatter type="xml" />
484       <batchtest todir="${longtestreport.dir}">
485         <fileset dir="${longtestsrc.dir}">
486           <include name="**/*Rebalance*Test.java" />
487         </fileset>
488       </batchtest>
489     </junit>
490     <junitreport todir="${longtesthtml.dir}">
491       <fileset dir="${longtestreport.dir}">
492         <include name="TEST-*.xml" />
493       </fileset>
494       <report todir="${longtesthtml.dir}" format="frames" />
495     </junitreport>
496   </target>
498   <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)">
499     <replace-dir dir="${singletestreport.dir}" />
500     <replace-dir dir="${singletesthtml.dir}" />
501     <junit printsummary="on" showoutput="true" maxmemory="4096m">
502       <classpath refid="contrib-test-classpath" />
503       <classpath path="${log4j.properties.dir}" />
504       <formatter type="plain" />
505       <formatter type="xml" />
506       <test name="${test.name}"  todir="${singletestreport.dir}"/>
507     </junit>
508     <junitreport todir="${singletesthtml.dir}">
509       <fileset dir="${singletestreport.dir}">
510         <include name="TEST-*.xml" />
511       </fileset>
512       <report todir="${singletesthtml.dir}" format="frames" />
513     </junitreport>
514   </target>
516   <target name="junit-all" depends="junit-long, contrib-junit" description="Run All junit tests including contrib.">
517   </target>
519   <macrodef name="make-javadocs">
520     <attribute name="dir" />
521     <attribute name="packagenames" />
522     <attribute name="javadir" />
523     <sequential>
524       <replace-dir dir="@{dir}" />
525       <javadoc sourcepath="@{javadir}" destdir="@{dir}" windowtitle="${display.name}" source="${javac.version}" author="true" version="true" use="true" packagenames="@{packagenames}">
526         <doctitle>${display.name}</doctitle>
527         <bottom>${author}</bottom>
528         <classpath refid="main-classpath" />
529       </javadoc>
530     </sequential>
531   </macrodef>
533   <target name="docs" description="Create complete Javadoc documentation">
534     <make-javadocs dir="${javadoc.dir}/all" packagenames="*" javadir="${java.dir}"/>
535     <make-javadocs dir="${javadoc.dir}/client" packagenames="voldemort.versioning.*, voldemort.client.*,voldemort.serialization.*" javadir="${java.dir}"/>
536   </target>
538   <target name="redeploy" depends="war, deploy">
539   </target>
541   <taskdef file="tomcat-tasks.properties">
542     <classpath>
543       <path location="${lib.dir}/catalina-ant.jar" />
544     </classpath>
545   </taskdef>
547   <target name="list" description="List Tomcat applications">
548     <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
549   </target>
551   <target name="deploy" description="Deploy application" depends="war">
552     <deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${tomcat.context}" update="true" war="file:${dist.dir}/${name}.war" />
553   </target>
555   <target name="undeploy" description="Undeploy application">
556     <undeploy url="${tomcat.manager.url}"
557                  username="${tomcat.manager.username}"
558                  password="${tomcat.manager.password}"
559                  path="${tomcat.context}"/>
560   </target>
562 </project>