source: proiecte/HadoopJUnit/hadoop-0.20.1/build.xml

Last change on this file was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 71.6 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4   Licensed to the Apache Software Foundation (ASF) under one or more
5   contributor license agreements.  See the NOTICE file distributed with
6   this work for additional information regarding copyright ownership.
7   The ASF licenses this file to You under the Apache License, Version 2.0
8   (the "License"); you may not use this file except in compliance with
9   the License.  You may obtain a copy of the License at
10
11       http://www.apache.org/licenses/LICENSE-2.0
12
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18-->
19
20<project name="Hadoop" default="compile" 
21   xmlns:ivy="antlib:org.apache.ivy.ant"> 
22
23  <!-- Load all the default properties, and any the user wants    -->
24  <!-- to contribute (without having to type -D or edit this file -->
25  <property file="${user.home}/build.properties" />
26  <property file="${basedir}/build.properties" />
27 
28  <property name="Name" value="Hadoop"/>
29  <property name="name" value="hadoop"/>
30  <property name="version" value="0.20.2-dev"/>
31  <property name="final.name" value="${name}-${version}"/>
32  <property name="year" value="2009"/>
33
34  <property name="src.dir" value="${basedir}/src"/>     
35  <property name="core.src.dir" value="${src.dir}/core"/>
36  <property name="mapred.src.dir" value="${src.dir}/mapred"/> 
37  <property name="hdfs.src.dir" value="${src.dir}/hdfs"/>
38  <property name="native.src.dir" value="${basedir}/src/native"/>
39  <property name="examples.dir" value="${basedir}/src/examples"/>
40  <property name="anttasks.dir" value="${basedir}/src/ant"/>
41  <property name="lib.dir" value="${basedir}/lib"/>
42  <property name="conf.dir" value="${basedir}/conf"/>
43  <property name="contrib.dir" value="${basedir}/src/contrib"/>
44  <property name="docs.src" value="${basedir}/src/docs"/>
45  <property name="src.docs.cn" value="${basedir}/src/docs/cn"/>
46  <property name="changes.src" value="${docs.src}/changes"/>
47  <property name="c++.src" value="${basedir}/src/c++"/>
48  <property name="c++.utils.src" value="${c++.src}/utils"/>
49  <property name="c++.pipes.src" value="${c++.src}/pipes"/>
50  <property name="c++.examples.pipes.src" value="${examples.dir}/pipes"/>
51  <property name="c++.libhdfs.src" value="${c++.src}/libhdfs"/>
52  <property name="librecordio.src" value="${c++.src}/librecordio"/>
53  <property name="tools.src" value="${basedir}/src/tools"/>
54
55  <property name="xercescroot" value=""/> 
56  <property name="build.dir" value="${basedir}/build"/>
57  <property name="build.classes" value="${build.dir}/classes"/>
58  <property name="build.src" value="${build.dir}/src"/>
59  <property name="build.tools" value="${build.dir}/tools"/>
60  <property name="build.webapps" value="${build.dir}/webapps"/>
61  <property name="build.examples" value="${build.dir}/examples"/>
62  <property name="build.anttasks" value="${build.dir}/ant"/>
63  <property name="build.librecordio" value="${build.dir}/librecordio"/>
64  <!-- convert spaces to _ so that mac os doesn't break things -->
65  <exec executable="sed" inputstring="${os.name}" 
66        outputproperty="nonspace.os">
67     <arg value="s/ /_/g"/>
68  </exec>
69  <property name="build.platform" 
70            value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
71  <property name="jvm.arch" 
72            value="${sun.arch.data.model}"/>
73  <property name="build.native" value="${build.dir}/native/${build.platform}"/>
74  <property name="build.c++" value="${build.dir}/c++-build/${build.platform}"/>
75  <property name="build.c++.utils" value="${build.c++}/utils"/>
76  <property name="build.c++.pipes" value="${build.c++}/pipes"/>
77  <property name="build.c++.libhdfs" value="${build.c++}/libhdfs"/>
78  <property name="build.c++.examples.pipes" 
79            value="${build.c++}/examples/pipes"/>
80  <property name="build.docs" value="${build.dir}/docs"/>
81  <property name="build.docs.cn" value="${build.dir}/docs/cn"/>
82  <property name="build.javadoc" value="${build.docs}/api"/>
83  <property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
84  <property name="build.encoding" value="ISO-8859-1"/>
85  <property name="install.c++" value="${build.dir}/c++/${build.platform}"/>
86  <property name="install.c++.examples" 
87            value="${build.dir}/c++-examples/${build.platform}"/>
88
89  <property name="test.src.dir" value="${basedir}/src/test"/>
90  <property name="test.lib.dir" value="${basedir}/src/test/lib"/>
91  <property name="test.build.dir" value="${build.dir}/test"/>
92  <property name="test.generated.dir" value="${test.build.dir}/src"/>
93  <property name="test.build.data" value="${test.build.dir}/data"/>
94  <property name="test.cache.data" value="${test.build.dir}/cache"/>
95  <property name="test.debug.data" value="${test.build.dir}/debug"/>
96  <property name="test.log.dir" value="${test.build.dir}/logs"/>
97  <property name="test.build.classes" value="${test.build.dir}/classes"/>
98  <property name="test.build.testjar" value="${test.build.dir}/testjar"/>
99  <property name="test.build.testshell" value="${test.build.dir}/testshell"/>
100  <property name="test.build.extraconf" value="${test.build.dir}/extraconf"/>
101  <property name="test.build.javadoc" value="${test.build.dir}/docs/api"/>
102  <property name="test.build.javadoc.dev" value="${test.build.dir}/docs/dev-api"/>
103  <property name="test.include" value="Test*"/>
104  <property name="test.classpath.id" value="test.classpath"/>
105  <property name="test.output" value="no"/>
106  <property name="test.timeout" value="900000"/>
107  <property name="test.junit.output.format" value="plain"/>
108  <property name="test.junit.fork.mode" value="perTest" />
109  <property name="test.junit.printsummary" value="yes" />
110  <property name="test.junit.haltonfailure" value="no" />
111  <property name="test.junit.maxmemory" value="512m" />
112
113  <property name="test.libhdfs.conf.dir" value="${c++.libhdfs.src}/tests/conf"/>
114  <property name="test.libhdfs.dir" value="${test.build.dir}/libhdfs"/>
115
116  <property name="librecordio.test.dir" value="${test.build.dir}/librecordio"/>
117  <property name="web.src.dir" value="${basedir}/src/web"/>
118  <property name="src.webapps" value="${basedir}/src/webapps"/>
119
120  <property name="javadoc.link.java"
121            value="http://java.sun.com/javase/6/docs/api/"/>
122  <property name="javadoc.packages" value="org.apache.hadoop.*"/>
123
124  <property name="dist.dir" value="${build.dir}/${final.name}"/>
125
126  <property name="javac.debug" value="on"/>
127  <property name="javac.optimize" value="on"/>
128  <property name="javac.deprecation" value="off"/>
129  <property name="javac.version" value="1.6"/>
130  <property name="javac.args" value=""/>
131  <property name="javac.args.warnings" value="-Xlint:unchecked"/>
132
133  <property name="clover.db.dir" location="${build.dir}/test/clover/db"/>
134  <property name="clover.report.dir" location="${build.dir}/test/clover/reports"/>
135
136  <property name="rat.reporting.classname" value="rat.Report"/>
137
138  <property name="jdiff.build.dir" value="${build.docs}/jdiff"/>
139  <property name="jdiff.xml.dir" value="${lib.dir}/jdiff"/>
140  <property name="jdiff.stable" value="0.19.2"/>
141  <property name="jdiff.stable.javadoc" 
142            value="http://hadoop.apache.org/core/docs/r${jdiff.stable}/api/"/>
143
144  <property name="scratch.dir" value="${user.home}/tmp"/>
145  <property name="svn.cmd" value="svn"/>
146  <property name="grep.cmd" value="grep"/>
147  <property name="patch.cmd" value="patch"/>
148  <property name="make.cmd" value="make"/>
149
150  <!-- IVY properteis set here -->
151  <property name="ivy.dir" location="ivy" />
152  <loadproperties srcfile="${ivy.dir}/libraries.properties"/>
153  <property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
154  <property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
155  <property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
156  <property name="ivy.org" value="org.apache.hadoop"/>
157  <property name="build.dir" location="build" />
158  <property name="dist.dir" value="${build.dir}/${final.name}"/>
159  <property name="build.ivy.dir" location="${build.dir}/ivy" />
160  <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
161  <property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/>
162  <property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
163  <property name="build.ivy.maven.dir" location="${build.ivy.dir}/maven" />
164  <property name="build.ivy.maven.pom" location="${build.ivy.maven.dir}/hadoop-core-${hadoop.version}.pom" />
165  <property name="build.ivy.maven.jar" location="${build.ivy.maven.dir}/hadoop-core-${hadoop.version}.jar" />
166
167  <!--this is the naming policy for artifacts we want pulled down-->
168  <property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>
169
170  <!--this is how artifacts that get built are named-->
171  <property name="ivy.publish.pattern" value="hadoop-[revision]-core.[ext]"/>
172  <property name="hadoop.jar" location="${build.dir}/hadoop-${hadoop.version}-core.jar" />
173
174  <!-- jdiff.home property set -->
175  <property name="jdiff.home" value="${build.ivy.lib.dir}/${ant.project.name}/jdiff"/>
176  <property name="jdiff.jar" value="${jdiff.home}/jdiff-${jdiff.version}.jar"/>
177  <property name="xerces.jar" value="${jdiff.home}/xerces-${xerces.version}.jar"/>
178
179  <property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
180  <available property="clover.present" file="${clover.jar}" />
181
182  <!-- check if clover reports should be generated -->
183  <condition property="clover.enabled">
184    <and>
185        <isset property="run.clover"/>
186        <isset property="clover.present"/>
187    </and>
188  </condition>
189
190  <!-- the normal classpath -->
191  <path id="classpath">
192    <pathelement location="${build.classes}"/>
193    <fileset dir="${lib.dir}">
194      <include name="**/*.jar" />
195      <exclude name="**/excluded/" />
196    </fileset>
197    <pathelement location="${conf.dir}"/>
198    <path refid="ivy-common.classpath"/>
199  </path>
200
201  <!-- the unit test classpath: uses test.src.dir for configuration -->
202  <path id="test.classpath">
203    <pathelement location="${test.build.extraconf}"/>
204    <pathelement location="${test.build.classes}" />
205    <pathelement location="${test.src.dir}"/>
206    <pathelement location="${build.dir}"/>
207    <pathelement location="${build.examples}"/>
208    <pathelement location="${build.tools}"/>
209    <pathelement path="${clover.jar}"/>
210    <fileset dir="${test.lib.dir}">
211      <include name="**/*.jar" />
212      <exclude name="**/excluded/" />
213    </fileset>
214    <path refid="classpath"/>
215  </path>
216
217  <!-- the cluster test classpath: uses conf.dir for configuration -->
218  <path id="test.cluster.classpath">
219    <path refid="classpath"/>
220    <pathelement location="${test.build.classes}" />
221    <pathelement location="${test.src.dir}"/>
222    <pathelement location="${build.dir}"/>
223  </path>
224
225  <!-- properties dependent on the items defined above. -->
226  <!--<available classname="${rat.reporting.classname}" classpathref="classpath" property="rat.present" value="true"/> -->
227
228  <!-- ====================================================== -->
229  <!-- Macro definitions                                      -->
230  <!-- ====================================================== -->
231  <macrodef name="macro_tar" description="Worker Macro for tar">
232    <attribute name="param.destfile"/>
233    <element name="param.listofitems"/>
234    <sequential>
235      <tar compression="gzip" longfile="gnu"
236      destfile="@{param.destfile}">
237      <param.listofitems/>
238      </tar>
239    </sequential>
240  </macrodef>
241
242  <!-- ====================================================== -->
243  <!-- Stuff needed by all targets                            -->
244  <!-- ====================================================== -->
245  <target name="init" depends="ivy-retrieve-common">
246    <mkdir dir="${build.dir}"/>
247    <mkdir dir="${build.classes}"/>
248    <mkdir dir="${build.tools}"/>
249    <mkdir dir="${build.src}"/>
250    <mkdir dir="${build.webapps}/task/WEB-INF"/>
251    <mkdir dir="${build.webapps}/job/WEB-INF"/>
252    <mkdir dir="${build.webapps}/hdfs/WEB-INF"/>
253    <mkdir dir="${build.webapps}/datanode/WEB-INF"/>
254    <mkdir dir="${build.webapps}/secondary/WEB-INF"/>
255    <mkdir dir="${build.examples}"/>
256    <mkdir dir="${build.anttasks}"/>
257    <mkdir dir="${build.dir}/c++"/>
258 
259    <mkdir dir="${test.build.dir}"/>
260    <mkdir dir="${test.build.classes}"/>
261    <mkdir dir="${test.build.testjar}"/>
262    <mkdir dir="${test.build.testshell}"/>
263    <mkdir dir="${test.build.extraconf}"/>
264    <tempfile property="touch.temp.file" destDir="${java.io.tmpdir}"/>
265    <touch millis="0" file="${touch.temp.file}">
266      <fileset dir="${conf.dir}" includes="**/*.template"/>
267      <fileset dir="${contrib.dir}" includes="**/*.template"/>
268    </touch>
269    <delete file="${touch.temp.file}"/>
270    <!-- copy all of the jsp and static files -->
271    <copy todir="${build.webapps}">
272      <fileset dir="${src.webapps}">
273        <exclude name="**/*.jsp" />
274      </fileset>
275    </copy>
276
277    <copy todir="${conf.dir}" verbose="true">
278      <fileset dir="${conf.dir}" includes="**/*.template"/>
279      <mapper type="glob" from="*.template" to="*"/>
280    </copy>
281
282    <copy todir="${contrib.dir}" verbose="true">
283      <fileset dir="${contrib.dir}" includes="**/*.template"/>
284      <mapper type="glob" from="*.template" to="*"/>
285    </copy>
286
287    <exec executable="sh">
288       <arg line="src/saveVersion.sh ${version}"/>
289    </exec>
290       
291   <exec executable="sh">
292       <arg line="src/fixFontsPath.sh ${src.docs.cn}"/>
293   </exec>
294  </target>
295
296  <!-- ====================================================== -->
297  <!-- Compile the Java files                                 -->
298  <!-- ====================================================== -->
299  <target name="record-parser" depends="init" if="javacc.home">
300      <javacc
301          target="${core.src.dir}/org/apache/hadoop/record/compiler/generated/rcc.jj"
302          outputdirectory="${core.src.dir}/org/apache/hadoop/record/compiler/generated"
303          javacchome="${javacc.home}" />
304  </target>
305 
306  <target name="compile-rcc-compiler" depends="init, record-parser">
307    <javac 
308        encoding="${build.encoding}" 
309        srcdir="${core.src.dir}"
310        includes="org/apache/hadoop/record/compiler/**/*.java"
311        destdir="${build.classes}"
312        debug="${javac.debug}"
313        optimize="${javac.optimize}"
314        target="${javac.version}"
315        source="${javac.version}"
316        deprecation="${javac.deprecation}">
317        <compilerarg line="${javac.args}"/>
318        <classpath refid="classpath"/>
319    </javac>
320   
321    <taskdef name="recordcc" classname="org.apache.hadoop.record.compiler.ant.RccTask">
322      <classpath refid="classpath" />
323    </taskdef>
324  </target>
325 
326  <target name="compile-core-classes" depends="init, compile-rcc-compiler">
327     <taskdef classname="org.apache.jasper.JspC" name="jsp-compile" >
328        <classpath refid="test.classpath"/>
329     </taskdef>
330    <!-- Compile Java files (excluding JSPs) checking warnings -->
331    <javac 
332     encoding="${build.encoding}" 
333     srcdir="${core.src.dir}"   
334     includes="org/apache/hadoop/**/*.java"
335     destdir="${build.classes}"
336     debug="${javac.debug}"
337     optimize="${javac.optimize}"
338     target="${javac.version}"
339     source="${javac.version}"
340     deprecation="${javac.deprecation}">
341      <compilerarg line="${javac.args} ${javac.args.warnings}" />
342      <classpath refid="classpath"/>
343    </javac>
344
345    <copy todir="${build.classes}">
346      <fileset dir="${core.src.dir}" includes="**/*.properties"/>
347      <fileset dir="${core.src.dir}" includes="core-default.xml"/>
348    </copy>
349     
350  </target>
351
352  <target name="compile-mapred-classes" depends="compile-core-classes">
353    <jsp-compile
354     uriroot="${src.webapps}/task"
355     outputdir="${build.src}"
356     package="org.apache.hadoop.mapred"
357     webxml="${build.webapps}/task/WEB-INF/web.xml">
358    </jsp-compile>
359
360    <jsp-compile
361     uriroot="${src.webapps}/job"
362     outputdir="${build.src}"
363     package="org.apache.hadoop.mapred"
364     webxml="${build.webapps}/job/WEB-INF/web.xml">
365    </jsp-compile>
366
367    <!-- Compile Java files (excluding JSPs) checking warnings -->
368    <javac 
369     encoding="${build.encoding}" 
370     srcdir="${mapred.src.dir};${build.src}" 
371     includes="org/apache/hadoop/**/*.java"
372     destdir="${build.classes}"
373     debug="${javac.debug}"
374     optimize="${javac.optimize}"
375     target="${javac.version}"
376     source="${javac.version}"
377     deprecation="${javac.deprecation}">
378      <compilerarg line="${javac.args} ${javac.args.warnings}" />
379      <classpath refid="classpath"/>
380    </javac>   
381   
382    <copy todir="${build.classes}">
383      <fileset dir="${mapred.src.dir}" includes="**/*.properties"/>
384      <fileset dir="${mapred.src.dir}" includes="mapred-default.xml"/>
385    </copy>
386  </target>
387
388  <target name="compile-hdfs-classes" depends="compile-core-classes">
389    <jsp-compile
390     uriroot="${src.webapps}/hdfs"
391     outputdir="${build.src}"
392     package="org.apache.hadoop.hdfs.server.namenode"
393     webxml="${build.webapps}/hdfs/WEB-INF/web.xml">
394    </jsp-compile>
395
396    <jsp-compile
397     uriroot="${src.webapps}/datanode"
398     outputdir="${build.src}"
399     package="org.apache.hadoop.hdfs.server.datanode"
400     webxml="${build.webapps}/datanode/WEB-INF/web.xml">
401    </jsp-compile>
402
403    <!-- Compile Java files (excluding JSPs) checking warnings -->
404    <javac 
405     encoding="${build.encoding}" 
406     srcdir="${hdfs.src.dir};${build.src}" 
407     includes="org/apache/hadoop/**/*.java"
408     destdir="${build.classes}"
409     debug="${javac.debug}"
410     optimize="${javac.optimize}"
411     target="${javac.version}"
412     source="${javac.version}"
413     deprecation="${javac.deprecation}">
414      <compilerarg line="${javac.args} ${javac.args.warnings}" />
415      <classpath refid="classpath"/>
416    </javac>   
417
418    <copy todir="${build.classes}">
419     <fileset dir="${hdfs.src.dir}" includes="**/*.properties"/>
420     <fileset dir="${hdfs.src.dir}" includes="hdfs-default.xml"/>
421    </copy>
422  </target>
423
424  <target name="compile-tools" depends="init">
425    <javac 
426     encoding="${build.encoding}" 
427     srcdir="${tools.src}"
428     includes="org/apache/hadoop/**/*.java"
429     destdir="${build.tools}"
430     debug="${javac.debug}"
431     optimize="${javac.optimize}"
432     target="${javac.version}"
433     source="${javac.version}"
434     deprecation="${javac.deprecation}">
435      <compilerarg line="${javac.args} ${javac.args.warnings}" />
436      <classpath refid="classpath"/>
437    </javac>   
438       
439    <copy todir="${build.tools}">
440      <fileset 
441        dir="${tools.src}" 
442        includes="**/*.properties"
443      />
444    </copy>
445  </target>
446
447  <target name="compile-native">
448    <antcall target="compile-core-native">
449      <param name="compile.native" value="true"/>
450    </antcall> 
451  </target>
452
453  <target name="compile-core-native" depends="compile-core-classes"
454          if="compile.native">
455       
456    <mkdir dir="${build.native}/lib"/>
457    <mkdir dir="${build.native}/src/org/apache/hadoop/io/compress/zlib"/>
458
459        <javah
460          classpath="${build.classes}"
461          destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
462      force="yes"
463          verbose="yes"
464          >
465          <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor" />
466      <class name="org.apache.hadoop.io.compress.zlib.ZlibDecompressor" />
467        </javah>
468
469        <exec dir="${build.native}" executable="sh" failonerror="true">
470          <env key="OS_NAME" value="${os.name}"/>
471          <env key="OS_ARCH" value="${os.arch}"/>
472          <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
473          <env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/>
474          <arg line="${native.src.dir}/configure"/>
475    </exec>
476
477    <exec dir="${build.native}" executable="${make.cmd}" failonerror="true">
478      <env key="OS_NAME" value="${os.name}"/>
479      <env key="OS_ARCH" value="${os.arch}"/>
480          <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
481          <env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/>
482    </exec>
483
484        <exec dir="${build.native}" executable="sh" failonerror="true">
485          <arg line="${build.native}/libtool --mode=install cp ${build.native}/lib/libhadoop.la ${build.native}/lib"/>
486    </exec>
487
488  </target>
489
490  <target name="compile-core"
491          depends="clover,compile-core-classes,compile-mapred-classes,
492        compile-hdfs-classes,compile-core-native,compile-c++" 
493        description="Compile core only">
494  </target>
495
496  <target name="compile-contrib" depends="compile-core,compile-c++-libhdfs">
497     <subant target="compile">
498        <property name="version" value="${version}"/>
499        <fileset file="${contrib.dir}/build.xml"/>
500     </subant>         
501  </target>
502 
503  <target name="compile" depends="compile-core, compile-contrib, compile-ant-tasks, compile-tools" description="Compile core, contrib">
504  </target>
505
506  <target name="compile-examples" 
507          depends="compile-core,compile-tools,compile-c++-examples">
508    <javac 
509     encoding="${build.encoding}" 
510     srcdir="${examples.dir}"
511     includes="org/apache/hadoop/**/*.java"
512     destdir="${build.examples}"
513     debug="${javac.debug}"
514     optimize="${javac.optimize}"
515     target="${javac.version}"
516     source="${javac.version}"
517     deprecation="${javac.deprecation}">
518      <compilerarg line="${javac.args} ${javac.args.warnings}" />
519      <classpath>
520        <path refid="classpath"/>
521        <pathelement location="${build.tools}"/>
522      </classpath>
523    </javac>   
524  </target>
525
526  <!-- ================================================================== -->
527  <!-- Make hadoop.jar                                                     -->
528  <!-- ================================================================== -->
529  <!--                                                                    -->
530  <!-- ================================================================== -->
531  <target name="jar" depends="compile-core" description="Make hadoop.jar">
532    <tar compression="gzip" destfile="${build.classes}/bin.tgz">
533      <tarfileset dir="bin" mode="755"/>
534    </tar>
535    <jar jarfile="${build.dir}/${final.name}-core.jar"
536         basedir="${build.classes}">
537      <manifest>
538        <section name="org/apache/hadoop">
539          <attribute name="Implementation-Title" value="Hadoop"/>
540          <attribute name="Implementation-Version" value="${version}"/>
541          <attribute name="Implementation-Vendor" value="Apache"/>
542        </section>
543      </manifest>
544      <fileset file="${conf.dir}/commons-logging.properties"/>
545      <fileset file="${conf.dir}/log4j.properties"/>
546      <fileset file="${conf.dir}/hadoop-metrics.properties"/>
547      <zipfileset dir="${build.webapps}" prefix="webapps"/>
548    </jar>
549  </target>
550
551  <!-- ================================================================== -->
552  <!-- Make the Hadoop examples jar.                                      -->
553  <!-- ================================================================== -->
554  <!--                                                                    -->
555  <!-- ================================================================== -->
556  <target name="examples" depends="jar, compile-examples" description="Make the Hadoop examples jar.">
557    <jar jarfile="${build.dir}/${final.name}-examples.jar"
558         basedir="${build.examples}">
559      <manifest>
560        <attribute name="Main-Class" 
561                   value="org/apache/hadoop/examples/ExampleDriver"/>
562      </manifest>
563    </jar>
564  </target>
565
566  <target name="tools-jar" depends="jar, compile-tools" 
567          description="Make the Hadoop tools jar.">
568    <jar jarfile="${build.dir}/${final.name}-tools.jar"
569         basedir="${build.tools}">
570      <manifest>
571        <attribute name="Main-Class" 
572                   value="org/apache/hadoop/examples/ExampleDriver"/>
573      </manifest>
574    </jar>
575  </target>
576
577  <!-- ================================================================== -->
578  <!-- Make the Hadoop metrics jar. (for use outside Hadoop)              -->
579  <!-- ================================================================== -->
580  <!--                                                                    -->
581  <!-- ================================================================== -->
582  <target name="metrics.jar" depends="compile-core" description="Make the Hadoop metrics jar. (for use outside Hadoop)">
583    <jar jarfile="${build.dir}/hadoop-metrics-${version}.jar"
584         basedir="${build.classes}">
585      <include name="**/metrics/**" />
586      <exclude name="**/package.html" />
587    </jar>
588  </target>
589
590  <target name="generate-test-records" depends="compile-rcc-compiler">
591    <recordcc destdir="${test.generated.dir}">
592      <fileset dir="${test.src.dir}"
593                 includes="**/*.jr" />
594    </recordcc>
595  </target>
596 
597  <!-- ================================================================== -->
598  <!-- Compile test code                                                  --> 
599  <!-- ================================================================== -->
600  <target name="compile-core-test" depends="compile-examples, compile-tools, generate-test-records">
601    <javac 
602     encoding="${build.encoding}" 
603     srcdir="${test.generated.dir}"
604     includes="org/apache/hadoop/**/*.java"
605     destdir="${test.build.classes}"
606     debug="${javac.debug}"
607     optimize="${javac.optimize}"
608     target="${javac.version}"
609     source="${javac.version}"
610     deprecation="${javac.deprecation}">
611      <compilerarg line="${javac.args}" />
612      <classpath refid="test.classpath"/>
613    </javac>
614    <javac 
615     encoding="${build.encoding}" 
616     srcdir="${test.src.dir}"
617     includes="org/apache/hadoop/**/*.java"
618     destdir="${test.build.classes}"
619     debug="${javac.debug}"
620     optimize="${javac.optimize}"
621     target="${javac.version}"
622     source="${javac.version}"
623     deprecation="${javac.deprecation}">
624      <compilerarg line="${javac.args} ${javac.args.warnings}" />
625      <classpath refid="test.classpath"/>
626    </javac> 
627    <javac
628     encoding="${build.encoding}"
629     srcdir="${test.src.dir}/testjar"
630     includes="*.java"
631     destdir="${test.build.testjar}"
632     debug="${javac.debug}"
633     optimize="${javac.optimize}"
634     target="${javac.version}"
635     source="${javac.version}"
636     deprecation="${javac.deprecation}">
637      <compilerarg line="${javac.args} ${javac.args.warnings}" />
638      <classpath refid="test.classpath"/>
639    </javac>                                 
640    <delete file="${test.build.testjar}/testjob.jar"/> 
641    <jar jarfile="${test.build.testjar}/testjob.jar"
642     basedir="${test.build.testjar}">
643    </jar>
644    <javac 
645     encoding="${build.encoding}"
646     srcdir="${test.src.dir}/testshell"
647     includes="*.java"
648     destdir="${test.build.testshell}"
649     debug="${javac.debug}"
650     optimize="${javac.optimize}"
651     target="${javac.version}"
652     source="${javac.version}"
653     deprecation="${javac.deprecation}">
654      <compilerarg line="${javac.args} ${javac.args.warnings}"/>
655      <classpath refid="test.classpath"/>
656     </javac>
657     <delete file="${test.build.testshell}/testshell.jar"/>
658     <jar jarfile="${test.build.testshell}/testshell.jar"
659      basedir="${test.build.testshell}">
660     </jar>
661                                                             
662    <delete dir="${test.cache.data}"/>
663    <mkdir dir="${test.cache.data}"/>
664    <delete dir="${test.debug.data}"/>
665    <mkdir dir="${test.debug.data}"/>
666    <copy file="${test.src.dir}/org/apache/hadoop/mapred/testscript.txt" todir="${test.debug.data}"/>
667    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.txt" todir="${test.cache.data}"/>
668    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.jar" todir="${test.cache.data}"/>
669    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.zip" todir="${test.cache.data}"/>
670    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.tar" todir="${test.cache.data}"/>
671    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.tgz" todir="${test.cache.data}"/>
672    <copy file="${test.src.dir}/org/apache/hadoop/mapred/test.tar.gz" todir="${test.cache.data}"/>
673    <copy file="${test.src.dir}/org/apache/hadoop/hdfs/hadoop-14-dfs-dir.tgz" todir="${test.cache.data}"/>
674    <copy file="${test.src.dir}/org/apache/hadoop/hdfs/hadoop-dfs-dir.txt" todir="${test.cache.data}"/>
675    <copy file="${test.src.dir}/org/apache/hadoop/cli/testConf.xml" todir="${test.cache.data}"/>
676    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data15bytes" todir="${test.cache.data}"/>
677    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data30bytes" todir="${test.cache.data}"/>
678    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data60bytes" todir="${test.cache.data}"/>
679    <copy file="${test.src.dir}/org/apache/hadoop/cli/clitest_data/data120bytes" todir="${test.cache.data}"/>
680  </target>
681
682  <!-- ================================================================== -->
683  <!-- Make hadoop-test.jar                                               -->
684  <!-- ================================================================== -->
685  <!--                                                                    -->
686  <!-- ================================================================== -->
687  <target name="jar-test" depends="compile-core-test" description="Make hadoop-test.jar">
688    <jar jarfile="${build.dir}/${final.name}-test.jar"
689         basedir="${test.build.classes}">
690         <manifest>
691           <attribute name="Main-Class"
692                      value="org/apache/hadoop/test/AllTestDriver"/>
693          <section name="org/apache/hadoop">
694            <attribute name="Implementation-Title" value="Hadoop"/>
695            <attribute name="Implementation-Version" value="${version}"/>
696            <attribute name="Implementation-Vendor" value="Apache"/>
697          </section>
698         </manifest>
699    </jar>
700  </target>
701
702  <!-- ================================================================== -->
703  <!-- Run unit tests                                                     --> 
704  <!-- ================================================================== -->
705  <target name="test-core" depends="jar-test" description="Run core unit tests">
706
707    <delete dir="${test.build.data}"/>
708    <mkdir dir="${test.build.data}"/>
709    <delete dir="${test.log.dir}"/>
710    <mkdir dir="${test.log.dir}"/>
711        <copy file="${test.src.dir}/hadoop-policy.xml" 
712          todir="${test.build.extraconf}" />
713    <junit showoutput="${test.output}"
714      printsummary="${test.junit.printsummary}"
715      haltonfailure="${test.junit.haltonfailure}"
716      fork="yes"
717      forkmode="${test.junit.fork.mode}"
718      maxmemory="${test.junit.maxmemory}"
719      dir="${basedir}" timeout="${test.timeout}"
720      errorProperty="tests.failed" failureProperty="tests.failed">
721      <sysproperty key="test.build.data" value="${test.build.data}"/>
722      <sysproperty key="test.cache.data" value="${test.cache.data}"/>           
723      <sysproperty key="test.debug.data" value="${test.debug.data}"/>
724      <sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
725      <sysproperty key="test.src.dir" value="${test.src.dir}"/>
726      <sysproperty key="test.build.extraconf" value="${test.build.extraconf}" />
727      <sysproperty key="hadoop.policy.file" value="hadoop-policy.xml"/>
728      <sysproperty key="java.library.path"
729       value="${build.native}/lib:${lib.dir}/native/${build.platform}"/>
730      <sysproperty key="install.c++.examples" value="${install.c++.examples}"/>
731      <!-- set io.compression.codec.lzo.class in the child jvm only if it is set -->
732          <syspropertyset dynamic="no">
733                  <propertyref name="io.compression.codec.lzo.class"/>
734          </syspropertyset>
735      <!-- set compile.c++ in the child jvm only if it is set -->
736      <syspropertyset dynamic="no">
737         <propertyref name="compile.c++"/>
738      </syspropertyset>
739      <classpath refid="${test.classpath.id}"/>
740      <formatter type="${test.junit.output.format}" />
741      <batchtest todir="${test.build.dir}" unless="testcase">
742        <fileset dir="${test.src.dir}"
743                 includes="**/${test.include}.java"
744                 excludes="**/${test.exclude}.java" />
745      </batchtest>
746      <batchtest todir="${test.build.dir}" if="testcase">
747        <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
748      </batchtest>
749    </junit>
750    <fail if="tests.failed">Tests failed!</fail>
751  </target>   
752
753  <target name="test-contrib" depends="compile, compile-core-test" description="Run contrib unit tests">
754    <subant target="test">
755       <property name="version" value="${version}"/>
756       <fileset file="${contrib.dir}/build.xml"/>
757    </subant> 
758  </target>
759         
760  <target name="test" depends="test-core, test-contrib" description="Run core, contrib unit tests">
761  </target>
762
763  <!-- Run all unit tests, not just Test*, and use non-test configuration. -->
764  <target name="test-cluster" description="Run all unit tests, not just Test*, and use non-test configuration.">
765    <antcall target="test">
766      <param name="test.include" value="*"/>
767      <param name="test.classpath.id" value="test.cluster.classpath"/>
768    </antcall>
769  </target>
770
771  <target name="nightly" depends="test, tar">
772  </target>
773       
774  <!-- ================================================================== -->
775  <!-- Run optional third-party tool targets                              --> 
776  <!-- ================================================================== -->
777  <target name="checkstyle" depends="ivy-retrieve-checkstyle,check-for-checkstyle" if="checkstyle.present" description="Run optional third-party tool targets">
778       <taskdef resource="checkstyletask.properties">
779         <classpath refid="checkstyle-classpath"/>
780       </taskdef>
781 
782        <mkdir dir="${test.build.dir}"/>
783       
784        <checkstyle config="${test.src.dir}/checkstyle.xml"
785                failOnViolation="false">
786      <fileset dir="${core.src.dir}" includes="**/*.java" excludes="**/generated/**"/>
787      <fileset dir="${mapred.src.dir}" includes="**/*.java" excludes="**/generated/**"/>
788      <fileset dir="${hdfs.src.dir}" includes="**/*.java" excludes="**/generated/**"/>                 
789      <formatter type="xml" toFile="${test.build.dir}/checkstyle-errors.xml"/>
790        </checkstyle>
791       
792        <xslt style="${test.src.dir}/checkstyle-noframes-sorted.xsl"
793        in="${test.build.dir}/checkstyle-errors.xml"
794        out="${test.build.dir}/checkstyle-errors.html"/>
795  </target>
796       
797  <target name="check-for-checkstyle">
798    <available property="checkstyle.present" resource="checkstyletask.properties">
799       <classpath refid="checkstyle-classpath"/>
800    </available>       
801  </target>
802
803 <property name="findbugs.home" value=""/>
804  <target name="findbugs" depends="check-for-findbugs, tar" if="findbugs.present" description="Run findbugs if present">
805    <property name="findbugs.out.dir" value="${test.build.dir}/findbugs"/>
806    <property name="findbugs.exclude.file" value="${test.src.dir}/findbugsExcludeFile.xml"/>
807    <property name="findbugs.report.htmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.html"/>
808    <property name="findbugs.report.xmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.xml"/>
809    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
810        classpath="${findbugs.home}/lib/findbugs-ant.jar" />
811
812        <mkdir dir="${findbugs.out.dir}"/>
813
814    <findbugs home="${findbugs.home}" output="xml:withMessages"
815        outputFile="${findbugs.report.xmlfile}" effort="max"
816        excludeFilter="${findbugs.exclude.file}" jvmargs="-Xmx512M">
817      <auxClasspath>
818        <fileset dir="${lib.dir}">
819          <include name="**/*.jar"/>
820        </fileset>
821        <fileset dir="${build.ivy.lib.dir}/${ant.project.name}/common">
822          <include name="**/*.jar"/>
823        </fileset>
824      </auxClasspath>
825      <sourcePath path="${core.src.dir}"/>
826      <sourcePath path="${mapred.src.dir}"/>
827      <sourcePath path="${hdfs.src.dir}"/>
828      <sourcePath path="${examples.dir}" />
829      <sourcePath path="${tools.src}" />
830      <sourcePath path="${basedir}/src/contrib/streaming/src/java" />
831      <class location="${basedir}/build/${final.name}-core.jar" />
832      <class location="${basedir}/build/${final.name}-examples.jar" />
833      <class location="${basedir}/build/${final.name}-tools.jar" />
834      <class location="${basedir}/build/contrib/streaming/${final.name}-streaming.jar" />
835    </findbugs>
836
837        <xslt style="${findbugs.home}/src/xsl/default.xsl"
838        in="${findbugs.report.xmlfile}"
839        out="${findbugs.report.htmlfile}"/>
840  </target>
841       
842  <target name="check-for-findbugs">
843    <available property="findbugs.present"
844        file="${findbugs.home}/lib/findbugs.jar" />
845  </target>
846
847
848  <!-- ================================================================== -->
849  <!-- Documentation                                                      -->
850  <!-- ================================================================== -->
851 
852  <target name="docs" depends="forrest.check" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
853    <exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
854          failonerror="true">
855      <env key="JAVA_HOME" value="${java5.home}"/>
856    </exec>
857    <copy todir="${build.docs}">
858      <fileset dir="${docs.src}/build/site/" />
859    </copy>
860    <copy file="${docs.src}/releasenotes.html" todir="${build.docs}"/>
861    <style basedir="${core.src.dir}" destdir="${build.docs}"
862           includes="core-default.xml" style="conf/configuration.xsl"/>
863    <style basedir="${hdfs.src.dir}" destdir="${build.docs}"
864           includes="hdfs-default.xml" style="conf/configuration.xsl"/>
865    <style basedir="${mapred.src.dir}" destdir="${build.docs}"
866           includes="mapred-default.xml" style="conf/configuration.xsl"/>
867    <antcall target="changes-to-html"/>
868    <antcall target="cn-docs"/>
869  </target>
870
871  <target name="cn-docs" depends="forrest.check, init" 
872       description="Generate forrest-based Chinese documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." 
873        if="forrest.home">
874    <exec dir="${src.docs.cn}" executable="${forrest.home}/bin/forrest" failonerror="true">
875      <env key="LANG" value="en_US.utf8"/>
876      <env key="JAVA_HOME" value="${java5.home}"/>
877    </exec>
878    <copy todir="${build.docs.cn}">
879      <fileset dir="${src.docs.cn}/build/site/" />
880    </copy>
881    <style basedir="${core.src.dir}" destdir="${build.docs.cn}"
882           includes="core-default.xml" style="conf/configuration.xsl"/>
883    <style basedir="${hdfs.src.dir}" destdir="${build.docs.cn}"
884           includes="hdfs-default.xml" style="conf/configuration.xsl"/>
885    <style basedir="${mapred.src.dir}" destdir="${build.docs.cn}"
886           includes="mapred-default.xml" style="conf/configuration.xsl"/>
887    <antcall target="changes-to-html"/>
888  </target>
889
890  <target name="forrest.check" unless="forrest.home" depends="java5.check">
891    <fail message="'forrest.home' is not defined. Please pass -Dforrest.home=&lt;base of Apache Forrest installation&gt; to Ant on the command-line." />
892  </target>
893
894  <target name="java5.check" unless="java5.home">
895    <fail message="'java5.home' is not defined.  Forrest requires Java 5.  Please pass -Djava5.home=&lt;base of Java 5 distribution&gt; to Ant on the command-line." />
896  </target>
897       
898  <target name="javadoc-dev" description="Generate javadoc for hadoop developers">
899    <mkdir dir="${build.javadoc.dev}"/>
900    <javadoc
901      overview="${core.src.dir}/overview.html"
902      packagenames="org.apache.hadoop.*"
903      destdir="${build.javadoc.dev}"
904      author="true"
905      version="true"
906      use="true"
907      windowtitle="${Name} ${version} API"
908      doctitle="${Name} ${version} Developer API"
909      bottom="Copyright &amp;copy; ${year} The Apache Software Foundation"
910      >
911        <packageset dir="${core.src.dir}"/>
912        <packageset dir="${mapred.src.dir}"/>
913        <packageset dir="${hdfs.src.dir}"/>             
914        <packageset dir="${examples.dir}"/>
915
916        <packageset dir="src/contrib/streaming/src/java"/>
917        <packageset dir="src/contrib/data_join/src/java"/>
918        <packageset dir="src/contrib/index/src/java"/>
919
920        <link href="${javadoc.link.java}"/>
921
922        <classpath >
923          <path refid="classpath" />
924          <fileset dir="src/contrib/">
925            <include name="*/lib/*.jar" />
926          </fileset>
927          <pathelement path="${java.class.path}"/>
928        </classpath>
929
930        <group title="Core" packages="org.apache.*"/>
931        <group title="Examples" packages="org.apache.hadoop.examples*"/>
932
933       <group title="contrib: Streaming" packages="org.apache.hadoop.streaming*"/>
934       <group title="contrib: DataJoin" packages="org.apache.hadoop.contrib.utils.join*"/>
935       <group title="contrib: Index" packages="org.apache.hadoop.contrib.index*"/>
936
937    </javadoc>
938  </target>     
939
940  <target name="javadoc" depends="compile, ivy-retrieve-javadoc" description="Generate javadoc">
941    <mkdir dir="${build.javadoc}"/>
942    <javadoc
943      overview="${core.src.dir}/overview.html"
944      packagenames="org.apache.hadoop.*"
945      destdir="${build.javadoc}"
946      author="true"
947      version="true"
948      use="true"
949      windowtitle="${Name} ${version} API"
950      doctitle="${Name} ${version} API"
951      bottom="Copyright &amp;copy; ${year} The Apache Software Foundation"
952      >
953        <packageset dir="${core.src.dir}"/>
954        <packageset dir="${mapred.src.dir}"/>
955        <packageset dir="${examples.dir}"/>
956
957        <packageset dir="src/contrib/streaming/src/java"/>
958        <packageset dir="src/contrib/data_join/src/java"/>
959        <packageset dir="src/contrib/index/src/java"/>
960        <packageset dir="src/contrib/failmon/src/java/"/> 
961       
962        <link href="${javadoc.link.java}"/>
963
964        <classpath >
965          <path refid="classpath" />
966          <fileset dir="src/contrib/">
967            <include name="*/lib/*.jar" />
968          </fileset>
969          <path refid="javadoc-classpath"/>
970          <pathelement path="${java.class.path}"/>
971          <pathelement location="${build.tools}"/>
972        </classpath>
973
974        <group title="Core" packages="org.apache.*"/>
975        <group title="Examples" packages="org.apache.hadoop.examples*"/>
976
977       <group title="contrib: Streaming" packages="org.apache.hadoop.streaming*"/>
978       <group title="contrib: DataJoin" packages="org.apache.hadoop.contrib.utils.join*"/>
979       <group title="contrib: Index" packages="org.apache.hadoop.contrib.index*"/>
980       <group title="contrib: FailMon" packages="org.apache.hadoop.contrib.failmon*"/>
981    </javadoc>
982  </target>     
983
984  <target name="api-xml" depends="ivy-retrieve-jdiff,javadoc,write-null">
985    <javadoc>
986       <doclet name="jdiff.JDiff"
987               path="${jdiff.jar}:${xerces.jar}">
988         <param name="-apidir" value="${jdiff.xml.dir}"/>
989         <param name="-apiname" value="hadoop ${version}"/>
990       </doclet>
991       <packageset dir="src/core"/>
992       <packageset dir="src/mapred"/>
993       <packageset dir="src/tools"/>
994       <classpath >
995         <path refid="classpath" />
996         <path refid="jdiff-classpath" />
997         <pathelement path="${java.class.path}"/>
998       </classpath>
999    </javadoc>
1000  </target>
1001       
1002  <target name="write-null">
1003        <exec executable="touch">
1004           <arg value="${jdiff.home}/Null.java"/>
1005        </exec>
1006  </target> 
1007
1008  <target name="api-report" depends="ivy-retrieve-jdiff,api-xml">
1009    <mkdir dir="${jdiff.build.dir}"/>
1010    <javadoc sourcepath="src/core,src/hdfs,src,mapred,src/tools"
1011             destdir="${jdiff.build.dir}"
1012             sourceFiles="${jdiff.home}/Null.java">
1013       <doclet name="jdiff.JDiff"
1014               path="${jdiff.jar}:${xerces.jar}">
1015         <param name="-oldapi" value="hadoop ${jdiff.stable}"/>
1016         <param name="-newapi" value="hadoop ${version}"/>
1017         <param name="-oldapidir" value="${jdiff.xml.dir}"/>
1018         <param name="-newapidir" value="${jdiff.xml.dir}"/>
1019         <param name="-javadocold" value="${jdiff.stable.javadoc}"/>
1020         <param name="-javadocnew" value="../../api/"/>
1021         <param name="-stats"/>
1022       </doclet>
1023       <classpath >
1024         <path refid="classpath" />
1025         <path refid="jdiff-classpath"/>
1026         <pathelement path="${java.class.path}"/>
1027       </classpath>
1028    </javadoc>
1029  </target>
1030       
1031  <target name="changes-to-html" description="Convert CHANGES.txt into an html file">
1032    <mkdir dir="${build.docs}"/>
1033    <exec executable="perl" input="CHANGES.txt" output="${build.docs}/changes.html" failonerror="true">
1034      <arg value="${changes.src}/changes2html.pl"/>
1035    </exec>
1036    <copy todir="${build.docs}">
1037      <fileset dir="${changes.src}" includes="*.css"/>
1038    </copy>
1039  </target>
1040
1041  <!-- ================================================================== -->
1042  <!-- D I S T R I B U T I O N                                            -->
1043  <!-- ================================================================== -->
1044  <!--                                                                    -->
1045  <!-- ================================================================== -->
1046  <target name="package" depends="compile, jar, javadoc, docs, cn-docs, api-report, examples, tools-jar, jar-test, ant-tasks, package-librecordio"
1047          description="Build distribution">
1048    <mkdir dir="${dist.dir}"/>
1049    <mkdir dir="${dist.dir}/lib"/>
1050    <mkdir dir="${dist.dir}/contrib"/>
1051    <mkdir dir="${dist.dir}/bin"/>
1052    <mkdir dir="${dist.dir}/docs"/>
1053    <mkdir dir="${dist.dir}/docs/api"/>
1054    <mkdir dir="${dist.dir}/docs/jdiff"/>
1055
1056    <copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
1057      <fileset dir="${common.ivy.lib.dir}"/>
1058    </copy>
1059
1060    <copy todir="${dist.dir}/lib" includeEmptyDirs="false">
1061      <fileset dir="lib">
1062        <exclude name="**/native/**"/>
1063      </fileset>
1064    </copy>
1065
1066        <exec dir="${dist.dir}" executable="sh" failonerror="true">
1067          <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
1068          <env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
1069          <env key="DIST_LIB_DIR" value="${dist.dir}/lib/native"/>
1070          <arg line="${native.src.dir}/packageNativeHadoop.sh"/>
1071    </exec>
1072
1073    <subant target="package">
1074      <!--Pass down the version in case its needed again and the target
1075      distribution directory so contribs know where to install to.-->
1076      <property name="version" value="${version}"/>
1077      <property name="dist.dir" value="${dist.dir}"/>
1078      <fileset file="${contrib.dir}/build.xml"/>
1079    </subant>   
1080
1081    <copy todir="${dist.dir}/webapps">
1082      <fileset dir="${build.webapps}"/>
1083    </copy>
1084
1085    <copy todir="${dist.dir}"> 
1086      <fileset file="${build.dir}/${final.name}-*.jar"/>
1087    </copy>
1088   
1089    <copy todir="${dist.dir}/bin">
1090      <fileset dir="bin"/>
1091    </copy>
1092
1093    <copy todir="${dist.dir}/conf">
1094      <fileset dir="${conf.dir}" excludes="**/*.template"/>
1095    </copy>
1096
1097    <copy todir="${dist.dir}/docs">
1098      <fileset dir="${build.docs}"/>
1099    </copy>
1100
1101    <copy file="ivy.xml" tofile="${dist.dir}/ivy.xml"/>
1102
1103    <copy todir="${dist.dir}/ivy">
1104      <fileset dir="ivy"/>
1105    </copy>
1106
1107    <copy todir="${dist.dir}">
1108      <fileset dir=".">
1109        <include name="*.txt" />
1110      </fileset>
1111    </copy>
1112
1113    <copy todir="${dist.dir}/src" includeEmptyDirs="true">
1114      <fileset dir="src" excludes="**/*.template **/docs/build/**/*"/>
1115    </copy>
1116       
1117    <copy todir="${dist.dir}/c++" includeEmptyDirs="false">
1118      <fileset dir="${build.dir}/c++"/>
1119    </copy>
1120
1121    <copy todir="${dist.dir}/" file="build.xml"/>
1122
1123    <chmod perm="ugo+x" type="file" parallel="false">
1124        <fileset dir="${dist.dir}/bin"/>
1125        <fileset dir="${dist.dir}/src/contrib/">
1126          <include name="*/bin/*" />
1127        </fileset>
1128        <fileset dir="${dist.dir}/src/contrib/ec2/bin/image"/>
1129    </chmod>
1130    <chmod perm="ugo+x" type="file">
1131        <fileset dir="${dist.dir}/src/c++/pipes/debug"/>
1132    </chmod>
1133
1134  </target>
1135
1136  <!-- ================================================================== -->
1137  <!-- Make release tarball                                               -->
1138  <!-- ================================================================== -->
1139  <target name="tar" depends="package" description="Make release tarball">
1140    <macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
1141      <param.listofitems>
1142        <tarfileset dir="${build.dir}" mode="664">
1143          <exclude name="${final.name}/bin/*" />
1144          <exclude name="${final.name}/contrib/*/bin/*" />
1145          <exclude name="${final.name}/src/contrib/ec2/bin/*" />
1146          <exclude name="${final.name}/src/contrib/ec2/bin/image/*" />
1147          <include name="${final.name}/**" />
1148        </tarfileset>
1149        <tarfileset dir="${build.dir}" mode="755">
1150          <include name="${final.name}/bin/*" />
1151          <include name="${final.name}/contrib/*/bin/*" />
1152          <include name="${final.name}/src/contrib/ec2/bin/*" />
1153          <include name="${final.name}/src/contrib/ec2/bin/image/*" />
1154        </tarfileset>
1155      </param.listofitems>
1156    </macro_tar>
1157  </target>
1158
1159  <target name="bin-package" depends="compile, jar, examples, tools-jar, jar-test, ant-tasks, package-librecordio" 
1160                description="assembles artifacts for binary target">
1161    <mkdir dir="${dist.dir}"/>
1162    <mkdir dir="${dist.dir}/lib"/>
1163    <mkdir dir="${dist.dir}/contrib"/>
1164    <mkdir dir="${dist.dir}/bin"/>
1165
1166    <copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
1167      <fileset dir="${common.ivy.lib.dir}"/>
1168    </copy>
1169
1170    <copy todir="${dist.dir}/lib" includeEmptyDirs="false">
1171      <fileset dir="lib">
1172        <exclude name="**/native/**"/>
1173      </fileset>
1174    </copy>
1175
1176        <exec dir="${dist.dir}" executable="sh" failonerror="true">
1177          <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
1178          <env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
1179          <env key="DIST_LIB_DIR" value="${dist.dir}/lib/native"/>
1180          <arg line="${native.src.dir}/packageNativeHadoop.sh"/>
1181    </exec>
1182
1183    <subant target="package">
1184      <!--Pass down the version in case its needed again and the target
1185      distribution directory so contribs know where to install to.-->
1186      <property name="version" value="${version}"/>
1187      <property name="dist.dir" value="${dist.dir}"/>
1188      <fileset file="${contrib.dir}/build.xml"/>
1189    </subant>   
1190
1191    <copy todir="${dist.dir}/webapps">
1192      <fileset dir="${build.webapps}"/>
1193    </copy>
1194
1195    <copy todir="${dist.dir}"> 
1196      <fileset file="${build.dir}/${final.name}-*.jar"/>
1197    </copy>
1198   
1199    <copy todir="${dist.dir}/bin">
1200      <fileset dir="bin"/>
1201    </copy>
1202
1203    <copy todir="${dist.dir}/conf">
1204      <fileset dir="${conf.dir}" excludes="**/*.template"/>
1205    </copy>
1206
1207    <copy file="ivy.xml" tofile="${dist.dir}/ivy.xml"/>
1208
1209    <copy todir="${dist.dir}/ivy">
1210      <fileset dir="ivy"/>
1211    </copy>
1212
1213    <copy todir="${dist.dir}">
1214      <fileset dir=".">
1215        <include name="*.txt" />
1216      </fileset>
1217    </copy>
1218       
1219    <copy todir="${dist.dir}/c++" includeEmptyDirs="false">
1220      <fileset dir="${build.dir}/c++"/>
1221    </copy>
1222
1223    <copy todir="${dist.dir}/" file="build.xml"/>
1224
1225    <chmod perm="ugo+x" type="file" parallel="false">
1226        <fileset dir="${dist.dir}/bin"/>
1227    </chmod>
1228  </target>
1229
1230  <target name="binary" depends="bin-package" description="Make tarball without source and documentation">
1231    <macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
1232      <param.listofitems>
1233        <tarfileset dir="${build.dir}" mode="664">
1234          <exclude name="${final.name}/bin/*" />
1235          <exclude name="${final.name}/src/**" />
1236          <exclude name="${final.name}/docs/**" />
1237          <include name="${final.name}/**" />
1238        </tarfileset>
1239        <tarfileset dir="${build.dir}" mode="755">
1240          <include name="${final.name}/bin/*" />
1241        </tarfileset>
1242      </param.listofitems>
1243    </macro_tar>
1244  </target>
1245
1246  <!-- ================================================================== -->
1247  <!-- Perform audit activities for the release                           -->
1248  <!-- ================================================================== -->
1249  <target name="releaseaudit" depends="package,ivy-retrieve-releaseaudit" description="Release Audit activities">
1250    <fail unless="rat.present" message="Failed to load class [${rat.reporting.classname}]."/>
1251    <java classname="${rat.reporting.classname}" fork="true">
1252      <classpath refid="releaseaudit-classpath"/>
1253      <arg value="${build.dir}/${final.name}"/>
1254    </java>
1255  </target>
1256
1257  <!-- ================================================================== -->
1258  <!-- Clean.  Delete the build files, and their directories              -->
1259  <!-- ================================================================== -->
1260  <target name="clean" depends="clean-contrib" description="Clean.  Delete the build files, and their directories">
1261    <delete dir="${build.dir}"/>
1262    <delete dir="${docs.src}/build"/>
1263    <delete dir="${src.docs.cn}/build"/>
1264  </target>
1265
1266  <!-- ================================================================== -->
1267  <!-- Clean contrib target. For now, must be called explicitly           -->
1268  <!-- Using subant instead of ant as a workaround for 30569              -->
1269  <!-- ================================================================== -->
1270  <target name="clean-contrib">
1271     <subant target="clean">       
1272        <fileset file="src/contrib/build.xml"/>
1273     </subant>         
1274  </target>
1275       
1276 <target name="test-c++-libhdfs" depends="compile-c++-libhdfs, compile-core" if="islibhdfs">
1277    <delete dir="${test.libhdfs.dir}"/>
1278    <mkdir dir="${test.libhdfs.dir}"/>
1279    <mkdir dir="${test.libhdfs.dir}/logs"/>
1280    <mkdir dir="${test.libhdfs.dir}/hdfs/name"/>
1281
1282    <exec dir="${build.c++.libhdfs}" executable="${make.cmd}" failonerror="true">
1283        <env key="OS_NAME" value="${os.name}"/>
1284        <env key="OS_ARCH" value="${os.arch}"/>
1285        <env key="JVM_ARCH" value="${jvm.arch}"/>
1286        <env key="LIBHDFS_BUILD_DIR" value="${build.c++.libhdfs}"/>
1287        <env key="HADOOP_HOME" value="${basedir}"/>
1288        <env key="HADOOP_CONF_DIR" value="${test.libhdfs.conf.dir}"/>
1289        <env key="HADOOP_LOG_DIR" value="${test.libhdfs.dir}/logs"/>
1290        <env key="LIBHDFS_SRC_DIR" value="${c++.libhdfs.src}"/>
1291        <env key="LIBHDFS_INSTALL_DIR" value="${install.c++}/lib"/> 
1292        <env key="LIB_DIR" value="${common.ivy.lib.dir}"/>
1293                <arg value="test"/>
1294    </exec>
1295  </target>
1296
1297<!-- ================================================================== -->
1298<!-- librecordio targets.                                               -->
1299<!-- ================================================================== -->             
1300
1301  <target name="compile-librecordio" depends="init" if="librecordio" >
1302     <mkdir dir="${build.librecordio}"/>
1303     <exec dir="${librecordio.src}" executable="${make.cmd}" failonerror="true">
1304        <env key="XERCESCROOT" value="${xercescroot}"/>
1305        <env key="LIBRECORDIO_BUILD_DIR" value="${build.librecordio}"/>
1306     </exec>
1307  </target>
1308       
1309  <target name="test-librecordio" depends="compile-librecordio, compile-core" if="librecordio">
1310    <delete dir="${librecordio.test.dir}"/>
1311    <mkdir dir="${librecordio.test.dir}"/>
1312    <exec dir="${librecordio.src}/test" executable="${make.cmd}" failonerror="true">
1313        <env key="HADOOP_HOME" value="${basedir}"/>
1314        <env key="XERCESCROOT" value="${xercescroot}"/>
1315        <env key="LIBRECORDIO_BUILD_DIR" value="${build.librecordio}"/>         
1316        <env key="LIBRECORDIO_TEST_DIR" value="${librecordio.test.dir}"/>
1317                <arg value="all"/>             
1318    </exec>
1319  </target>
1320
1321  <target name="package-librecordio" depends="compile-librecordio" if="librecordio">
1322    <mkdir dir="${dist.dir}/librecordio"/> 
1323    <copy todir="${dist.dir}/librecordio">
1324       <fileset dir="${build.librecordio}" casesensitive="yes" followsymlinks="false">
1325          <exclude name="**/tests/**"/>
1326          <exclude name="*.so"/> 
1327          <exclude name="*.o"/>
1328       </fileset>
1329    </copy>
1330    <chmod perm="ugo+x" type="file">
1331       <fileset dir="${dist.dir}/librecordio"/>
1332    </chmod>
1333  </target>
1334 
1335  <target name="create-c++-configure" depends="init" if="compile.c++">
1336    <exec executable="autoreconf" dir="${c++.utils.src}" searchpath="yes" 
1337          failonerror="yes">
1338       <arg value="-if"/>
1339    </exec>
1340    <exec executable="autoreconf" dir="${c++.pipes.src}" searchpath="yes" 
1341          failonerror="yes">
1342       <arg value="-if"/>
1343    </exec>
1344    <exec executable="autoreconf" dir="${c++.examples.pipes.src}" 
1345          searchpath="yes" failonerror="yes">
1346       <arg value="-if"/>
1347    </exec>
1348    <antcall target="create-c++-configure-libhdfs"/>
1349  </target>
1350   
1351  <target name="create-c++-configure-libhdfs" depends="check-c++-libhdfs" if="islibhdfs">
1352    <exec executable="autoreconf" dir="${c++.libhdfs.src}" 
1353          searchpath="yes" failonerror="yes">
1354       <arg value="-if"/>
1355    </exec>
1356  </target>
1357
1358  <target name="check-c++-makefiles" depends="init" if="compile.c++">
1359    <condition property="need.c++.utils.makefile">
1360       <not> <available file="${build.c++.utils}/Makefile"/> </not>
1361    </condition>
1362    <condition property="need.c++.pipes.makefile">
1363       <not> <available file="${build.c++.pipes}/Makefile"/> </not>
1364    </condition>
1365    <condition property="need.c++.examples.pipes.makefile">
1366       <not> <available file="${build.c++.examples.pipes}/Makefile"/> </not>
1367    </condition>
1368  </target>
1369
1370  <target name="check-c++-libhdfs">
1371    <condition property="islibhdfs">
1372      <and>
1373        <isset property="compile.c++"/>
1374        <isset property="libhdfs"/>
1375      </and>
1376    </condition>
1377  </target>
1378
1379  <target name="check-c++-makefile-libhdfs" depends="init,check-c++-libhdfs" if="islibhdfs">
1380    <condition property="need.c++.libhdfs.makefile">
1381       <not> <available file="${build.c++.libhdfs}/Makefile"/> </not>
1382    </condition>
1383  </target>
1384
1385  <target name="create-c++-libhdfs-makefile" depends="check-c++-makefile-libhdfs" 
1386                                           if="need.c++.libhdfs.makefile">
1387    <mkdir dir="${build.c++.libhdfs}"/>
1388    <chmod file="${c++.libhdfs.src}/configure" perm="ugo+x"/>
1389    <exec executable="${c++.libhdfs.src}/configure" dir="${build.c++.libhdfs}"
1390          failonerror="yes">
1391      <env key="ac_cv_func_malloc_0_nonnull" value="yes"/>
1392      <env key="JVM_ARCH" value="${jvm.arch}"/>
1393      <arg value="--prefix=${install.c++}"/>
1394    </exec>
1395  </target>
1396
1397  <target name="create-c++-utils-makefile" depends="check-c++-makefiles" 
1398                                           if="need.c++.utils.makefile">
1399    <mkdir dir="${build.c++.utils}"/>
1400    <exec executable="${c++.utils.src}/configure" dir="${build.c++.utils}"
1401          failonerror="yes">
1402      <arg value="--prefix=${install.c++}"/>
1403    </exec>
1404  </target>
1405
1406  <target name="compile-c++-utils" depends="create-c++-utils-makefile"
1407                                   if="compile.c++">
1408    <exec executable="${make.cmd}" dir="${build.c++.utils}" searchpath="yes" 
1409          failonerror="yes">
1410      <arg  value="install"/>
1411    </exec>
1412  </target>
1413
1414  <target name="create-c++-pipes-makefile" depends="check-c++-makefiles" 
1415                                           if="need.c++.pipes.makefile">
1416    <mkdir dir="${build.c++.pipes}"/>
1417    <exec executable="${c++.pipes.src}/configure" dir="${build.c++.pipes}"
1418          failonerror="yes">
1419      <arg value="--prefix=${install.c++}"/>
1420    </exec>
1421  </target>
1422
1423  <target name="compile-c++-pipes" 
1424          depends="create-c++-pipes-makefile,compile-c++-utils"
1425          if="compile.c++">
1426    <exec executable="${make.cmd}" dir="${build.c++.pipes}" searchpath="yes" 
1427          failonerror="yes">
1428      <arg value="install"/>
1429    </exec>
1430  </target>
1431
1432  <target name="compile-c++" 
1433          depends="compile-c++-pipes"/>
1434
1435  <target name="create-c++-examples-pipes-makefile" 
1436          depends="check-c++-makefiles" 
1437          if="need.c++.examples.pipes.makefile">
1438    <mkdir dir="${build.c++.examples.pipes}"/>
1439    <exec executable="${c++.examples.pipes.src}/configure" 
1440          dir="${build.c++.examples.pipes}"
1441          failonerror="yes">
1442      <arg value="--prefix=${install.c++.examples}"/>
1443      <arg value="--with-hadoop-utils=${install.c++}"/>
1444      <arg value="--with-hadoop-pipes=${install.c++}"/>
1445    </exec>
1446  </target>
1447
1448  <target name="compile-c++-examples-pipes" 
1449          depends="create-c++-examples-pipes-makefile,compile-c++-pipes"
1450          if="compile.c++">
1451    <exec executable="${make.cmd}" dir="${build.c++.examples.pipes}" searchpath="yes" 
1452          failonerror="yes">
1453      <arg  value="install"/>
1454    </exec>
1455  </target>
1456
1457  <target name="compile-c++-examples" 
1458          depends="compile-c++-examples-pipes"/>
1459
1460  <target name="compile-c++-libhdfs" depends="create-c++-libhdfs-makefile" if="islibhdfs">
1461    <exec executable="${make.cmd}" dir="${build.c++.libhdfs}" searchpath="yes"
1462          failonerror="yes">
1463      <env key="ac_cv_func_malloc_0_nonnull" value="yes"/>
1464      <env key="JVM_ARCH" value="${jvm.arch}"/>
1465      <arg value="install"/>
1466    </exec>
1467  </target>
1468
1469
1470
1471  <target name="compile-ant-tasks" depends="compile-core">
1472    <javac
1473        encoding="${build.encoding}"
1474        srcdir="${anttasks.dir}"
1475        includes="org/apache/hadoop/ant/**/*.java"
1476        destdir="${build.anttasks}"
1477        debug="${javac.debug}"
1478        optimize="${javac.optimize}"
1479        target="${javac.version}"
1480        source="${javac.version}"
1481        deprecation="${javac.deprecation}">
1482        <compilerarg line="${javac.args}"/>
1483        <classpath refid="classpath"/>
1484    </javac>
1485  </target>
1486
1487  <target name="ant-tasks" depends="jar, compile-ant-tasks">
1488    <copy file="${anttasks.dir}/org/apache/hadoop/ant/antlib.xml"
1489          todir="${build.anttasks}/org/apache/hadoop/ant"/>
1490    <jar destfile="${build.dir}/${final.name}-ant.jar">
1491      <fileset dir="${build.anttasks}"/>
1492    </jar>
1493  </target>
1494
1495
1496
1497 <target name="clover" depends="clover.setup, clover.info" description="Instrument the Unit tests using Clover.  To use, specify -Dclover.home=&lt;base of clover installation&gt; -Drun.clover=true on the command line."/>
1498
1499<target name="clover.setup" if="clover.enabled">
1500   <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
1501   <mkdir dir="${clover.db.dir}"/>
1502   <clover-setup initString="${clover.db.dir}/hadoop_coverage.db">
1503     <fileset dir="src" includes="core/**/* tools/**/* hdfs/**/* mapred/**/*"/>
1504   </clover-setup>
1505</target>
1506
1507<target name="clover.info" unless="clover.present">
1508  <echo>
1509     Clover not found. Code coverage reports disabled.
1510  </echo>
1511</target>
1512
1513<target name="clover.check">
1514  <fail unless="clover.present">
1515  ##################################################################
1516   Clover not found.
1517   Please specify -Dclover.home=&lt;base of clover installation&gt;
1518   on the command line.
1519  ##################################################################
1520  </fail>
1521</target>
1522
1523<target name="generate-clover-reports" depends="clover.check, clover">
1524  <mkdir dir="${clover.report.dir}"/>
1525  <clover-report>
1526     <current outfile="${clover.report.dir}" title="${final.name}">
1527     <format type="html"/>
1528     </current>
1529  </clover-report>
1530  <clover-report>
1531     <current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
1532     <format type="xml"/>
1533     </current>
1534  </clover-report>
1535</target>
1536
1537<target name="findbugs.check" depends="check-for-findbugs" unless="findbugs.present">
1538  <fail message="'findbugs.home' is not defined. Please pass -Dfindbugs.home=&lt;base of Findbugs installation&gt; to Ant on the command-line." />
1539</target>
1540
1541<target name="patch.check" unless="patch.file">
1542  <fail message="'patch.file' is not defined. Please pass -Dpatch.file=&lt;location of patch file&gt; to Ant on the command-line." />
1543</target>
1544
1545<target name="test-patch" depends="patch.check,findbugs.check,forrest.check">
1546  <exec executable="bash" failonerror="true">
1547    <arg value="${basedir}/src/test/bin/test-patch.sh"/>
1548    <arg value="DEVELOPER"/>
1549    <arg value="${patch.file}"/>
1550    <arg value="${scratch.dir}"/>
1551    <arg value="${svn.cmd}"/>
1552    <arg value="${grep.cmd}"/>
1553    <arg value="${patch.cmd}"/>
1554    <arg value="${findbugs.home}"/>
1555    <arg value="${forrest.home}"/>
1556    <arg value="${basedir}"/>
1557    <arg value="${java5.home}"/>
1558  </exec>
1559</target>
1560
1561<target name="hudson-test-patch" depends="findbugs.check,forrest.check">
1562  <exec executable="bash" failonerror="true">
1563    <arg value="${basedir}/src/test/bin/test-patch.sh"/>
1564    <arg value="HUDSON"/>
1565    <arg value="${scratch.dir}"/>
1566    <arg value="${support.dir}"/>
1567    <arg value="${ps.cmd}"/>
1568    <arg value="${wget.cmd}"/>
1569    <arg value="${jiracli.cmd}"/>
1570    <arg value="${svn.cmd}"/>
1571    <arg value="${grep.cmd}"/>
1572    <arg value="${patch.cmd}"/>
1573    <arg value="${findbugs.home}"/>
1574    <arg value="${forrest.home}"/>
1575    <arg value="${eclipse.home}"/>
1576    <arg value="${python.home}"/>
1577    <arg value="${basedir}"/>
1578    <arg value="${trigger.url}"/>
1579    <arg value="${jira.passwd}"/>
1580    <arg value="${java5.home}"/>
1581  </exec>
1582</target>
1583       
1584  <target name="eclipse-files" depends="init"
1585          description="Generate files for Eclipse">
1586    <pathconvert property="eclipse.project">
1587      <path path="${basedir}"/>
1588      <regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes"/>
1589    </pathconvert>
1590    <copy todir="." overwrite="true">
1591      <fileset dir=".eclipse.templates">
1592        <exclude name="**/README.txt"/>
1593      </fileset>
1594      <filterset>
1595        <filter token="PROJECT" value="${eclipse.project}"/>
1596      </filterset>
1597    </copy>
1598  </target>
1599
1600  <target name="ivy-init-dirs">
1601    <mkdir dir="${build.ivy.dir}" />
1602    <mkdir dir="${build.ivy.lib.dir}" />
1603    <mkdir dir="${build.ivy.report.dir}" />
1604    <mkdir dir="${build.ivy.maven.dir}" />
1605  </target>
1606
1607  <target name="ivy-probe-antlib" >
1608    <condition property="ivy.found">
1609      <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
1610    </condition>
1611  </target>
1612
1613  <target name="ivy-download" description="To download ivy" unless="offline">
1614    <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
1615  </target>
1616
1617  <!--
1618  To avoid Ivy leaking things across big projects, always load Ivy in the same classloader.
1619  Also note how we skip loading Ivy if it is already there, just to make sure all is well.
1620  -->
1621  <target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found">
1622    <typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
1623      loaderRef="ivyLoader">
1624      <classpath>
1625        <pathelement location="${ivy.jar}"/>
1626      </classpath>
1627    </typedef>
1628    <fail >
1629      <condition >
1630        <not>
1631          <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
1632        </not>
1633      </condition>
1634      You need Apache Ivy 2.0 or later from http://ant.apache.org/
1635      It could not be loaded from ${ivy_repo_url}
1636    </fail>
1637  </target>
1638
1639
1640  <target name="ivy-init" depends="ivy-init-antlib" >
1641
1642    <!--Configure Ivy by reading in the settings file
1643        If anyone has already read in a settings file into this settings ID, it gets priority
1644    -->
1645    <ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override='false'/>
1646  </target>
1647
1648  <target name="ivy-resolve" depends="ivy-init">
1649    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings"/>
1650  </target>
1651
1652  <target name="ivy-resolve-javadoc" depends="ivy-init">
1653    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc"/>
1654  </target>
1655
1656  <target name="ivy-resolve-releaseaudit" depends="ivy-init">
1657    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="releaseaudit"/>
1658  </target>
1659
1660  <target name="ivy-resolve-test" depends="ivy-init">
1661    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="test" />
1662  </target>
1663
1664  <target name="ivy-resolve-common" depends="ivy-init">
1665    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common" />
1666  </target>
1667
1668  <target name="ivy-resolve-jdiff" depends="ivy-init">
1669    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="jdiff" />
1670  </target>
1671
1672  <target name="ivy-resolve-checkstyle" depends="ivy-init">
1673    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="checkstyle"/>
1674  </target>
1675
1676  <target name="ivy-retrieve" depends="ivy-resolve"
1677    description="Retrieve Ivy-managed artifacts">
1678    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1679      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1680  </target>
1681
1682  <target name="ivy-retrieve-checkstyle" depends="ivy-resolve-checkstyle"
1683    description="Retrieve Ivy-managed artifacts for the checkstyle configurations">
1684    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1685      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1686    <ivy:cachepath pathid="checkstyle-classpath" conf="checkstyle"/>
1687  </target>
1688
1689  <target name="ivy-retrieve-jdiff" depends="ivy-resolve-jdiff"
1690    description="Retrieve Ivy-managed artifacts for the javadoc configurations">
1691    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1692      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1693    <ivy:cachepath pathid="jdiff-classpath" conf="jdiff"/>
1694  </target>
1695
1696  <target name="ivy-retrieve-javadoc" depends="ivy-resolve-javadoc"
1697    description="Retrieve Ivy-managed artifacts for the javadoc configurations">
1698    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1699      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1700    <ivy:cachepath pathid="javadoc-classpath" conf="javadoc"/>
1701  </target>
1702
1703  <target name="ivy-retrieve-test" depends="ivy-resolve-test"
1704    description="Retrieve Ivy-managed artifacts for the test configurations">
1705    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1706      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1707    <ivy:cachepath pathid="test.classpath" conf="test"/>
1708  </target>
1709
1710  <target name="ivy-retrieve-common" depends="ivy-resolve-common"
1711    description="Retrieve Ivy-managed artifacts for the compile configurations">
1712    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1713      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
1714    <ivy:cachepath pathid="ivy-common.classpath" conf="common"/>
1715  </target>
1716
1717  <target name="ivy-retrieve-releaseaudit" depends="ivy-resolve-releaseaudit"
1718    description="Retrieve Ivy-managed artifacts for the compile configurations">
1719    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
1720      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" />
1721    <ivy:cachepath pathid="releaseaudit-classpath" conf="releaseaudit"/>
1722    <available classname="${rat.reporting.classname}" 
1723      classpathref="releaseaudit-classpath" property="rat.present" value="true"/>
1724  </target>
1725
1726  <target name="ivy-report" depends="ivy-resolve-releaseaudit"
1727    description="Generate">
1728    <ivy:report todir="${build.ivy.report.dir}" settingsRef="${ant.project.name}.ivy.settings"/>
1729    <echo>
1730      Reports generated:${build.ivy.report.dir}
1731    </echo>
1732  </target>
1733
1734  <target name="assert-hadoop-jar-exists" depends="ivy-init">
1735    <fail>
1736      <condition >
1737        <not>
1738          <available file="${hadoop.jar}" />
1739        </not>
1740      </condition>
1741      Not found: ${hadoop.jar}
1742      Please run the target "jar" in the main build file
1743    </fail>
1744
1745  </target>
1746
1747  <target name="ready-to-publish" depends="jar,assert-hadoop-jar-exists,ivy-resolve"/>
1748
1749  <target name="ivy-publish-local" depends="ready-to-publish,ivy-resolve">
1750    <ivy:publish
1751      settingsRef="${ant.project.name}.ivy.settings"
1752      resolver="local"
1753      pubrevision="${hadoop.version}"
1754      overwrite="true"
1755      artifactspattern="${build.dir}/${ivy.publish.pattern}" />
1756  </target>
1757
1758
1759  <!-- this is here for curiosity, to see how well the makepom task works
1760  Answer: it depends whether you want transitive dependencies excluded or not
1761  -->
1762  <target name="makepom" depends="ivy-resolve">
1763    <ivy:makepom settingsRef="${ant.project.name}.ivy.settings"
1764      ivyfile="ivy.xml"
1765      pomfile="${build.ivy.maven.dir}/generated.pom">
1766      <ivy:mapping conf="default" scope="default"/>
1767      <ivy:mapping conf="master" scope="master"/>
1768      <ivy:mapping conf="runtime" scope="runtime"/>
1769    </ivy:makepom>
1770  </target>
1771
1772
1773  <target name="copy-jar-to-maven" depends="ready-to-publish">
1774    <copy file="${hadoop.jar}"
1775      tofile="${build.ivy.maven.jar}"/>
1776    <checksum file="${build.ivy.maven.jar}" algorithm="md5"/>
1777  </target>
1778
1779  <target name="copypom" depends="ivy-init-dirs">
1780
1781   <presetdef name="expandingcopy" >
1782    <copy overwrite="true">
1783      <filterchain>
1784        <expandproperties/>
1785      </filterchain>
1786    </copy>
1787   </presetdef>
1788
1789   <expandingcopy file="ivy/hadoop-core.pom"
1790      tofile="${build.ivy.maven.pom}"/>
1791   <checksum file="${build.ivy.maven.pom}" algorithm="md5"/>
1792  </target>
1793
1794  <target name="maven-artifacts" depends="copy-jar-to-maven,copypom" />
1795
1796  <target name="published" depends="ivy-publish-local,maven-artifacts">
1797
1798  </target>
1799
1800</project>
Note: See TracBrowser for help on using the repository browser.