forked from ritaliu2010/hadoop-mapreduce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1642 lines (1436 loc) · 65.8 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Hadoop" default="compile"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property name="Name" value="Hadoop-Mapred"/>
<property name="name" value="hadoop-mapred"/>
<property name="version" value="0.22.0-dev"/>
<property name="hadoop-core.version" value="0.22.0-dev"/>
<property name="hadoop-hdfs.version" value="0.22.0-dev"/>
<property name="final.name" value="${name}-${version}"/>
<property name="test.final.name" value="${name}-test-${version}"/>
<property name="examples.final.name" value="${name}-examples-${version}"/>
<property name="tools.final.name" value="${name}-tools-${version}"/>
<property name="year" value="2009"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="mapred.src.dir" value="${src.dir}/java"/>
<property name="examples.dir" value="${basedir}/src/examples"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="conf.dir" value="${basedir}/conf"/>
<property name="contrib.dir" value="${basedir}/src/contrib"/>
<property name="docs.src" value="${basedir}/src/docs"/>
<property name="changes.src" value="${docs.src}/changes"/>
<property name="c++.src" value="${basedir}/src/c++"/>
<property name="c++.utils.src" value="${c++.src}/utils"/>
<property name="c++.pipes.src" value="${c++.src}/pipes"/>
<property name="c++.examples.pipes.src" value="${examples.dir}/pipes"/>
<property name="librecordio.src" value="${c++.src}/librecordio"/>
<property name="tools.src" value="${basedir}/src/tools"/>
<property name="xercescroot" value=""/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.tools" value="${build.dir}/tools"/>
<property name="build.webapps" value="${build.dir}/webapps"/>
<property name="build.examples" value="${build.dir}/examples"/>
<property name="build.librecordio" value="${build.dir}/librecordio"/>
<!-- convert spaces to _ so that mac os doesn't break things -->
<exec executable="sed" inputstring="${os.name}"
outputproperty="nonspace.os">
<arg value="s/ /_/g"/>
</exec>
<property name="build.platform"
value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
<property name="jvm.arch"
value="${sun.arch.data.model}"/>
<property name="build.native" value="${build.dir}/native/${build.platform}"/>
<property name="build.c++" value="${build.dir}/c++-build/${build.platform}"/>
<property name="build.c++.utils" value="${build.c++}/utils"/>
<property name="build.c++.pipes" value="${build.c++}/pipes"/>
<property name="build.c++.examples.pipes"
value="${build.c++}/examples/pipes"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.javadoc" value="${build.docs}/api"/>
<property name="build.javadoc.timestamp" value="${build.javadoc}/index.html" />
<property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
<property name="build.encoding" value="ISO-8859-1"/>
<property name="install.c++" value="${build.dir}/c++/${build.platform}"/>
<property name="install.c++.examples"
value="${build.dir}/c++-examples/${build.platform}"/>
<property environment="env"/>
<property name="test.src.dir" value="${basedir}/src/test"/>
<property name="test.lib.dir" value="${basedir}/src/test/lib"/>
<property name="test.build.dir" value="${build.dir}/test"/>
<property name="test.generated.dir" value="${test.build.dir}/src"/>
<property name="test.build.data" value="${test.build.dir}/data"/>
<property name="test.cache.data" value="${test.build.dir}/cache"/>
<property name="test.debug.data" value="${test.build.dir}/debug"/>
<property name="test.log.dir" value="${test.build.dir}/logs"/>
<property name="test.build.classes" value="${test.build.dir}/classes"/>
<property name="test.mapred.build.testjar" value="${test.build.dir}/mapred/testjar"/>
<property name="test.mapred.build.testshell" value="${test.build.dir}/mapred/testshell"/>
<property name="test.build.extraconf" value="${test.build.dir}/extraconf"/>
<property name="test.build.javadoc" value="${test.build.dir}/docs/api"/>
<property name="test.build.javadoc.dev" value="${test.build.dir}/docs/dev-api"/>
<property name="test.include" value="Test*"/>
<property name="test.classpath.id" value="test.classpath"/>
<property name="test.output" value="no"/>
<property name="test.timeout" value="900000"/>
<property name="test.junit.output.format" value="plain"/>
<property name="test.junit.fork.mode" value="perTest" />
<property name="test.junit.printsummary" value="yes" />
<property name="test.junit.haltonfailure" value="no" />
<property name="test.junit.maxmemory" value="512m" />
<property name="test.tmp.dir" value="${env.TMP}" />
<property name="test.temp.dir" value="${env.TEMP}" />
<property name="test.tools.input.dir" value="${basedir}/src/test/tools/data" />
<property name="test.mapred.build.classes" value="${test.build.dir}/mapred/classes"/>
<property name="test.mapred.commit.tests.file" value="${test.src.dir}/commit-tests" />
<property name="test.mapred.all.tests.file" value="${test.src.dir}/all-tests" />
<property name="librecordio.test.dir" value="${test.build.dir}/librecordio"/>
<property name="web.src.dir" value="${basedir}/src/web"/>
<property name="src.webapps" value="${basedir}/src/webapps"/>
<property name="javadoc.link.java"
value="http://java.sun.com/javase/6/docs/api/"/>
<property name="javadoc.packages" value="org.apache.hadoop.*"/>
<property name="javadoc.maxmemory" value="512m" />
<property name="dist.dir" value="${build.dir}/${final.name}"/>
<property name="javac.debug" value="on"/>
<property name="javac.optimize" value="on"/>
<property name="javac.deprecation" value="off"/>
<property name="javac.version" value="1.6"/>
<property name="javac.args" value=""/>
<property name="javac.args.warnings" value="-Xlint:unchecked"/>
<property name="clover.db.dir" location="${build.dir}/test/clover/db"/>
<property name="clover.report.dir" location="${build.dir}/test/clover/reports"/>
<property name="rat.reporting.classname" value="rat.Report"/>
<property name="jdiff.build.dir" value="${build.docs}/jdiff"/>
<property name="jdiff.xml.dir" value="${lib.dir}/jdiff"/>
<property name="jdiff.stable" value="0.20.0"/>
<property name="jdiff.stable.javadoc"
value="http://hadoop.apache.org/core/docs/r${jdiff.stable}/api/"/>
<property name="scratch.dir" value="${user.home}/tmp"/>
<property name="svn.cmd" value="svn"/>
<property name="grep.cmd" value="grep"/>
<property name="patch.cmd" value="patch"/>
<property name="make.cmd" value="make"/>
<property name="findbugs.heap.size" value="512M"/>
<!-- task-controller properties set here -->
<!-- Source directory from where configure is run and files are copied
-->
<property name="c++.task-controller.src"
value="${basedir}/src/c++/task-controller" />
<!-- directory where autoconf files + temporary files and src is
stored for compilation -->
<property name="build.c++.task-controller"
value="${build.c++}/task-controller" />
<!-- the default install dir is build directory override it using
-Dtask-controller.install.dir=$HADOOP_HOME/bin -->
<property name="task-controller.install.dir" value="${dist.dir}/bin" />
<!-- end of task-controller properties -->
<!-- IVY properteis set here -->
<property name="ivy.dir" location="ivy" />
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
<property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
<property name="ivy.org" value="org.apache.hadoop"/>
<property name="build.dir" location="build" />
<property name="dist.dir" value="${build.dir}/${final.name}"/>
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/>
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<property name="build.ivy.maven.dir" location="${build.ivy.dir}/maven" />
<property name="build.ivy.maven.pom" location="${build.ivy.maven.dir}/hadoop-mapred-${version}.pom" />
<property name="build.ivy.maven.jar" location="${build.ivy.maven.dir}/hadoop-core-${version}.jar" />
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>
<!--this is how artifacts that get built are named-->
<property name="ivy.publish.pattern" value="hadoop-[revision]-core.[ext]"/>
<property name="hadoop-mapred.jar" location="${build.dir}/${final.name}.jar" />
<!-- jdiff.home property set -->
<property name="jdiff.home" value="${build.ivy.lib.dir}/${ant.project.name}/jdiff"/>
<property name="jdiff.jar" value="${jdiff.home}/jdiff-${jdiff.version}.jar"/>
<property name="xerces.jar" value="${jdiff.home}/xerces-${xerces.version}.jar"/>
<property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
<available property="clover.present" file="${clover.jar}" />
<!-- check if clover reports should be generated -->
<condition property="clover.enabled">
<and>
<isset property="run.clover"/>
<isset property="clover.present"/>
</and>
</condition>
<!-- the normal classpath -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<pathelement location="${conf.dir}"/>
<pathelement path="${lib.dir}/hadoop-core-${hadoop-core.version}.jar"/>
<pathelement path="${lib.dir}/hadoop-hdfs-${hadoop-hdfs.version}.jar"/>
<path refid="ivy-common.classpath"/>
</path>
<path id="test.classpath">
<pathelement location="${test.build.extraconf}"/>
<pathelement location="${test.core.build.classes}" />
<pathelement location="${test.src.dir}"/>
<pathelement location="${build.dir}"/>
<pathelement location="${build.examples}"/>
<pathelement location="${build.tools}"/>
<pathelement path="${clover.jar}"/>
<pathelement path="${lib.dir}/hadoop-core-test-${hadoop-core.version}.jar"/>
<pathelement path="${lib.dir}/hadoop-hdfs-test-${hadoop-hdfs.version}.jar"/>
<path refid="classpath"/>
<pathelement location="${test.mapred.build.classes}" />
<path refid="ivy-test.classpath"/>
</path>
<!-- the cluster test classpath: uses conf.dir for configuration -->
<path id="test.cluster.classpath">
<path refid="classpath"/>
<pathelement location="${test.build.classes}" />
<pathelement location="${test.src.dir}"/>
<pathelement location="${build.dir}"/>
</path>
<!-- properties dependent on the items defined above. -->
<!--<available classname="${rat.reporting.classname}" classpathref="classpath" property="rat.present" value="true"/> -->
<!-- ====================================================== -->
<!-- Macro definitions -->
<!-- ====================================================== -->
<macrodef name="macro_tar" description="Worker Macro for tar">
<attribute name="param.destfile"/>
<element name="param.listofitems"/>
<sequential>
<tar compression="gzip" longfile="gnu"
destfile="@{param.destfile}">
<param.listofitems/>
</tar>
</sequential>
</macrodef>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init" depends="ivy-retrieve-common">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.tools}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.webapps}/task/WEB-INF"/>
<mkdir dir="${build.webapps}/job/WEB-INF"/>
<mkdir dir="${build.examples}"/>
<mkdir dir="${build.dir}/c++"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
<mkdir dir="${test.build.extraconf}"/>
<tempfile property="touch.temp.file" destDir="${java.io.tmpdir}"/>
<touch millis="0" file="${touch.temp.file}">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<fileset dir="${contrib.dir}" includes="**/*.template"/>
</touch>
<delete file="${touch.temp.file}"/>
<!-- copy all of the jsp and static files -->
<copy todir="${build.webapps}">
<fileset dir="${src.webapps}">
<exclude name="**/*.jsp" />
<exclude name="**/*.jspx" />
</fileset>
</copy>
<unzip src="${lib.dir}/hadoop-hdfs-${hadoop-hdfs.version}.jar"
dest="${build.dir}">
<patternset>
<include name="webapps/hdfs/**"/>
<include name="webapps/datanode/**"/>
<include name="webapps/secondary/**"/>
</patternset>
</unzip>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
<copy todir="${contrib.dir}" verbose="true">
<fileset dir="${contrib.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<target name="avro-generate" depends="init">
<mkdir dir="${build.src}/org/apache/hadoop/mapreduce/jobhistory"/>
<taskdef name="protocol" classname="org.apache.avro.specific.ProtocolTask">
<classpath refid="classpath" />
</taskdef>
<protocol destdir="${build.src}">
<fileset dir="${mapred.src.dir}">
<include name="**/*.avpr" />
</fileset>
</protocol>
</target>
<target name="compile-mapred-classes" depends="init,avro-generate">
<taskdef classname="org.apache.jasper.JspC" name="jsp-compile" >
<classpath refid="classpath"/>
</taskdef>
<jsp-compile
uriroot="${src.webapps}/task"
outputdir="${build.src}"
package="org.apache.hadoop.mapred"
webxml="${build.webapps}/task/WEB-INF/web.xml">
</jsp-compile>
<jsp-compile
uriroot="${src.webapps}/job"
outputdir="${build.src}"
package="org.apache.hadoop.mapred"
webxml="${build.webapps}/job/WEB-INF/web.xml">
</jsp-compile>
<!-- Compile Java files (excluding JSPs) checking warnings -->
<javac
encoding="${build.encoding}"
srcdir="${mapred.src.dir};${build.src}"
includes="org/apache/hadoop/**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="classpath"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${mapred.src.dir}" includes="**/*.properties"/>
<fileset dir="${mapred.src.dir}" includes="mapred-default.xml"/>
</copy>
</target>
<target name="compile-tools" depends="init">
<javac
encoding="${build.encoding}"
srcdir="${tools.src}"
includes="org/apache/hadoop/**/*.java"
destdir="${build.tools}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="classpath"/>
</javac>
<copy todir="${build.tools}">
<fileset
dir="${tools.src}"
includes="**/*.properties"
/>
</copy>
</target>
<target name="compile-core" depends="clover, compile-mapred-classes, compile-c++" description="Compile core only"/>
<target name="compile-contrib" depends="compile-core,tools">
<subant target="compile">
<property name="version" value="${version}"/>
<property name="hadoop-core.version" value="${hadoop-core.version}"/>
<fileset file="${contrib.dir}/build.xml"/>
</subant>
</target>
<target name="compile" depends="compile-core, compile-contrib, compile-tools" description="Compile core, contrib">
</target>
<target name="compile-examples"
depends="compile-core,compile-tools,compile-c++-examples">
<javac
encoding="${build.encoding}"
srcdir="${examples.dir}"
includes="org/apache/hadoop/**/*.java"
destdir="${build.examples}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath>
<path refid="classpath"/>
<pathelement location="${build.tools}"/>
</classpath>
</javac>
</target>
<!-- ================================================================== -->
<!-- Make hadoop-mapred.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-core" description="Make hadoop-mapered.jar">
<jar jarfile="${hadoop-mapred.jar}"
basedir="${build.classes}">
<manifest>
<section name="org/apache/hadoop">
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache"/>
</section>
</manifest>
<!-- <fileset file="${conf.dir}/commons-logging.properties"/>
<fileset file="${conf.dir}/log4j.properties"/>
<fileset file="${conf.dir}/hadoop-metrics.properties"/> -->
<zipfileset dir="${build.webapps}" prefix="webapps"/>
</jar>
</target>
<!-- ================================================================== -->
<!-- Make the Hadoop examples jar. -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="examples" depends="jar, compile-examples" description="Make the Hadoop examples jar.">
<jar jarfile="${build.dir}/${examples.final.name}.jar"
basedir="${build.examples}">
<manifest>
<attribute name="Main-Class"
value="org/apache/hadoop/examples/ExampleDriver"/>
</manifest>
</jar>
</target>
<target name="tools" depends="jar, compile-tools"
description="Make the Hadoop tools jar.">
<jar jarfile="${build.dir}/${tools.final.name}.jar"
basedir="${build.tools}">
</jar>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-mapred-test" depends="compile-mapred-classes, compile-examples, ivy-retrieve-test">
<mkdir dir="${test.mapred.build.classes}"/>
<mkdir dir="${test.mapred.build.testjar}"/>
<mkdir dir="${test.mapred.build.testshell}"/>
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}/mapred"
includes="org/apache/hadoop/**/*.java"
destdir="${test.mapred.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.classpath"/>
</javac>
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}/mapred/testjar"
includes="*.java"
destdir="${test.mapred.build.testjar}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.classpath"/>
</javac>
<delete file="${test.mapred.build.testjar}/testjob.jar"/>
<jar jarfile="${test.mapred.build.testjar}/testjob.jar"
basedir="${test.mapred.build.testjar}">
</jar>
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}/mapred/testshell"
includes="*.java"
destdir="${test.mapred.build.testshell}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}"/>
<classpath refid="test.classpath"/>
</javac>
<delete file="${test.mapred.build.testshell}/testshell.jar"/>
<jar jarfile="${test.mapred.build.testshell}/testshell.jar"
basedir="${test.mapred.build.testshell}">
</jar>
<delete dir="${test.cache.data}"/>
<mkdir dir="${test.cache.data}"/>
<delete dir="${test.debug.data}"/>
<mkdir dir="${test.debug.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/testscript.txt" todir="${test.debug.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.txt" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.jar" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.zip" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.tar" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.tgz" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/mapred/test.tar.gz" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/cli/testMRConf.xml" todir="${test.cache.data}"/>
<copy file="${test.src.dir}/mapred/org/apache/hadoop/cli/data60bytes" todir="${test.cache.data}"/>
</target>
<!-- ================================================================== -->
<!-- Make hadoop-mapred-test.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar-test" depends="compile-mapred-test" description="Make hadoop-mapred-test.jar">
<copy todir="${test.build.classes}">
<fileset dir="${test.mapred.build.classes}"/>
</copy>
<jar jarfile="${build.dir}/${test.final.name}.jar"
basedir="${test.build.classes}">
<manifest>
<attribute name="Main-Class"
value="org/apache/hadoop/test/MapredTestDriver"/>
<section name="org/apache/hadoop">
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache"/>
</section>
</manifest>
</jar>
</target>
<macrodef name="macro-test-runner">
<attribute name="test.file" />
<sequential>
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.log.dir}"/>
<copy file="${test.src.dir}/hadoop-policy.xml"
todir="${test.build.extraconf}" />
<junit showoutput="${test.output}"
printsummary="${test.junit.printsummary}"
haltonfailure="${test.junit.haltonfailure}"
fork="yes"
forkmode="${test.junit.fork.mode}"
maxmemory="${test.junit.maxmemory}"
dir="${basedir}" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.tools.input.dir" value = "${test.tools.input.dir}"/>
<sysproperty key="test.cache.data" value="${test.cache.data}"/>
<sysproperty key="test.debug.data" value="${test.debug.data}"/>
<sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="taskcontroller-path" value="${taskcontroller-path}"/>
<sysproperty key="taskcontroller-ugi" value="${taskcontroller-ugi}"/>
<sysproperty key="test.build.extraconf" value="${test.build.extraconf}" />
<sysproperty key="hadoop.policy.file" value="hadoop-policy.xml"/>
<sysproperty key="java.library.path"
value="${build.native}/lib:${lib.dir}/native/${build.platform}"/>
<sysproperty key="install.c++.examples" value="${install.c++.examples}"/>
<syspropertyset dynamic="no">
<propertyref name="hadoop.tmp.dir"/>
</syspropertyset>
<!-- set compile.c++ in the child jvm only if it is set -->
<syspropertyset dynamic="no">
<propertyref name="compile.c++"/>
</syspropertyset>
<classpath refid="test.classpath"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}/mapred" excludes="**/${test.exclude}.java">
<patternset>
<includesfile name="@{test.file}"/>
</patternset>
</fileset>
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}/mapred" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<antcall target="checkfailure"/>
</sequential>
</macrodef>
<target name="run-test-mapred" depends="compile-mapred-test" description="Run mapred unit tests">
<macro-test-runner test.file="${test.mapred.all.tests.file}" />
</target>
<target name="run-commit-test" depends="compile-mapred-test" description="Run approximate 10-minute set of unit tests prior to commiting">
<macro-test-runner test.file="${test.mapred.commit.tests.file}" />
</target>
<target name="checkfailure" if="tests.failed">
<touch file="${test.build.dir}/testsfailed"/>
<fail unless="continueOnFailure">Tests failed!</fail>
</target>
<target name="test-contrib" depends="compile,compile-tools,compile-mapred-test" description="Run contrib unit tests">
<subant target="test">
<property name="version" value="${version}"/>
<property name="clover.jar" value="${clover.jar}"/>
<fileset file="${contrib.dir}/build.xml"/>
</subant>
</target>
<target name="test-core" description="Run core, hdfs and mapred unit tests">
<delete file="${test.build.dir}/testsfailed"/>
<property name="continueOnFailure" value="true"/>
<antcall target="run-test-mapred"/>
<available file="${test.build.dir}/testsfailed" property="testsfailed"/>
<fail if="testsfailed">Tests failed!</fail>
</target>
<target name="test" depends="jar-test, test-core" description="Run all unit tests">
<subant target="test-contrib">
<fileset file="${basedir}/build.xml"/>
</subant>
</target>
<!-- Run all unit tests, not just Test*, and use non-test configuration. -->
<target name="test-cluster" description="Run all unit tests, not just Test*, and use non-test configuration.">
<antcall target="test">
<param name="test.include" value="*"/>
<param name="test.classpath.id" value="test.cluster.classpath"/>
</antcall>
</target>
<target name="nightly" depends="test, tar">
</target>
<!-- ================================================================== -->
<!-- Run optional third-party tool targets -->
<!-- ================================================================== -->
<target name="checkstyle" depends="ivy-retrieve-checkstyle,check-for-checkstyle" if="checkstyle.present" description="Run optional third-party tool targets">
<taskdef resource="checkstyletask.properties">
<classpath refid="checkstyle-classpath"/>
</taskdef>
<mkdir dir="${test.build.dir}"/>
<checkstyle config="${test.src.dir}/checkstyle.xml"
failOnViolation="false">
<fileset dir="${mapred.src.dir}" includes="**/*.java" excludes="**/generated/**"/>
<formatter type="xml" toFile="${test.build.dir}/checkstyle-errors.xml"/>
</checkstyle>
<xslt style="${test.src.dir}/checkstyle-noframes-sorted.xsl"
in="${test.build.dir}/checkstyle-errors.xml"
out="${test.build.dir}/checkstyle-errors.html"/>
</target>
<target name="check-for-checkstyle">
<available property="checkstyle.present" resource="checkstyletask.properties">
<classpath refid="checkstyle-classpath"/>
</available>
</target>
<target name="all-jars" depends="tools,examples,jar-test">
<subant target="jar">
<property name="version" value="${version}"/>
<property name="dist.dir" value="${dist.dir}"/>
<fileset file="${contrib.dir}/streaming/build.xml"/>
<fileset file="${contrib.dir}/gridmix/build.xml"/>
<fileset file="${contrib.dir}/mumak/build.xml"/>
</subant>
</target>
<property name="findbugs.home" value=""/>
<target name="findbugs" depends="check-for-findbugs, all-jars" if="findbugs.present" description="Run findbugs if present">
<property name="findbugs.out.dir" value="${test.build.dir}/findbugs"/>
<property name="findbugs.exclude.file" value="${test.src.dir}/findbugsExcludeFile.xml"/>
<property name="findbugs.report.htmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.html"/>
<property name="findbugs.report.xmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.xml"/>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.home}/lib/findbugs-ant.jar" />
<mkdir dir="${findbugs.out.dir}"/>
<findbugs home="${findbugs.home}" output="xml:withMessages"
outputFile="${findbugs.report.xmlfile}" effort="max"
excludeFilter="${findbugs.exclude.file}" jvmargs="-Xmx${findbugs.heap.size}">
<auxClasspath>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${build.ivy.lib.dir}/${ant.project.name}/common">
<include name="**/*.jar"/>
</fileset>
</auxClasspath>
<sourcePath path="${mapred.src.dir}"/>
<sourcePath path="${examples.dir}" />
<sourcePath path="${tools.src}" />
<sourcePath path="${basedir}/src/contrib/streaming/src/java" />
<sourcePath path="${basedir}/src/contrib/gridmix/src/java" />
<sourcePath path="${basedir}/src/contrib/mumak/src/java" />
<class location="${basedir}/build/${final.name}.jar" />
<class location="${basedir}/build/${examples.final.name}.jar" />
<class location="${basedir}/build/${tools.final.name}.jar" />
<class location="${basedir}/build/contrib/streaming/hadoop-${version}-streaming.jar" />
<class location="${basedir}/build/contrib/gridmix/hadoop-${version}-gridmix.jar" />
<class location="${basedir}/build/contrib/mumak/hadoop-${version}-mumak.jar" />
</findbugs>
<xslt style="${findbugs.home}/src/xsl/default.xsl"
in="${findbugs.report.xmlfile}"
out="${findbugs.report.htmlfile}"/>
</target>
<target name="check-for-findbugs">
<available property="findbugs.present"
file="${findbugs.home}/lib/findbugs.jar" />
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="docs" depends="forrest.check" description="Generate forrest-based documentation. To use, specify -Dforrest.home=<base of Apache Forrest installation> on the command line." if="forrest.home">
<exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
failonerror="true">
<env key="JAVA_HOME" value="${java5.home}"/>
</exec>
<copy todir="${build.docs}">
<fileset dir="${docs.src}/build/site/" />
</copy>
<copy file="${docs.src}/releasenotes.html" todir="${build.docs}"/>
<style basedir="${mapred.src.dir}" destdir="${build.docs}"
includes="mapred-default.xml" style="conf/configuration.xsl"/>
<antcall target="changes-to-html"/>
</target>
<target name="forrest.check" unless="forrest.home" depends="java5.check">
<fail message="'forrest.home' is not defined. Please pass -Dforrest.home=<base of Apache Forrest installation> to Ant on the command-line." />
</target>
<target name="java5.check" unless="java5.home">
<fail message="'java5.home' is not defined. Forrest requires Java 5. Please pass -Djava5.home=<base of Java 5 distribution> to Ant on the command-line." />
</target>
<target name="javadoc-dev" depends="compile, ivy-retrieve-javadoc" description="Generate javadoc for hadoop developers">
<mkdir dir="${build.javadoc.dev}"/>
<javadoc
overview="${mapred.src.dir}/overview.html"
packagenames="org.apache.hadoop.*"
destdir="${build.javadoc.dev}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} Developer API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
maxmemory="${javadoc.maxmemory}"
>
<packageset dir="${mapred.src.dir}"/>
<packageset dir="${examples.dir}"/>
<packageset dir="src/contrib/streaming/src/java"/>
<packageset dir="src/contrib/data_join/src/java"/>
<packageset dir="src/contrib/index/src/java"/>
<packageset dir="src/contrib/gridmix/src/java"/>
<packageset dir="src/contrib/mumak/src/java"/>
<link href="${javadoc.link.java}"/>
<classpath >
<path refid="classpath" />
<fileset dir="src/contrib/">
<include name="*/lib/*.jar" />
</fileset>
<path refid="javadoc-classpath"/>
<pathelement path="${java.class.path}"/>
<pathelement path="${lib.dir}/hadoop-core-test-${hadoop-core.version}.jar"/>
<pathelement location="${build.tools}"/>
</classpath>
<group title="Examples" packages="org.apache.hadoop.examples*"/>
<group title="contrib: Streaming" packages="org.apache.hadoop.streaming*"/>
<group title="contrib: DataJoin" packages="org.apache.hadoop.contrib.utils.join*"/>
<group title="contrib: Index" packages="org.apache.hadoop.contrib.index*"/>
</javadoc>
</target>
<target name="javadoc-uptodate" depends="compile, ivy-retrieve-javadoc">
<uptodate property="javadoc.is.uptodate">
<srcfiles dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<mapper type="merge" to="${build.javadoc.timestamp}" />
</uptodate>
</target>
<target name="javadoc" description="Generate javadoc" depends="javadoc-uptodate"
unless="javadoc.is.uptodate">
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="${mapred.src.dir}/overview.html"
packagenames="org.apache.hadoop.*"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &copy; ${year} The Apache Software Foundation"
maxmemory="${javadoc.maxmemory}"
>
<packageset dir="${mapred.src.dir}"/>
<packageset dir="${examples.dir}"/>
<packageset dir="src/contrib/streaming/src/java"/>
<packageset dir="src/contrib/data_join/src/java"/>
<packageset dir="src/contrib/index/src/java"/>
<packageset dir="src/contrib/gridmix/src/java"/>
<packageset dir="src/contrib/mumak/src/java"/>
<link href="${javadoc.link.java}"/>
<classpath >
<path refid="classpath" />
<fileset dir="src/contrib/">
<include name="*/lib/*.jar" />
</fileset>
<path refid="javadoc-classpath"/>
<pathelement path="${java.class.path}"/>
<pathelement path="${lib.dir}/hadoop-core-test-${hadoop-core.version}.jar"/>
<pathelement location="${build.tools}"/>
</classpath>
<group title="Examples" packages="org.apache.hadoop.examples*"/>
<group title="contrib: Streaming" packages="org.apache.hadoop.streaming*"/>
<group title="contrib: DataJoin" packages="org.apache.hadoop.contrib.utils.join*"/>
<group title="contrib: Index" packages="org.apache.hadoop.contrib.index*"/>
</javadoc>
</target>
<target name="api-xml" depends="ivy-retrieve-jdiff,javadoc,write-null">
<javadoc maxmemory="${javadoc.maxmemory}">
<doclet name="jdiff.JDiff"
path="${jdiff.jar}:${xerces.jar}">
<param name="-apidir" value="${jdiff.xml.dir}"/>
<param name="-apiname" value="hadoop-mapred ${version}"/>
</doclet>
<packageset dir="src/java"/>
<packageset dir="src/tools"/>
<classpath >
<path refid="classpath" />
<path refid="jdiff-classpath" />
<pathelement path="${java.class.path}"/>
</classpath>
</javadoc>
</target>
<target name="write-null">
<exec executable="touch">
<arg value="${jdiff.home}/Null.java"/>
</exec>
</target>
<target name="api-report" depends="ivy-retrieve-jdiff,api-xml">
<mkdir dir="${jdiff.build.dir}"/>
<javadoc sourcepath="src/java,src/tools"
destdir="${jdiff.build.dir}"
sourceFiles="${jdiff.home}/Null.java"
maxmemory="${javadoc.maxmemory}">
<doclet name="jdiff.JDiff"
path="${jdiff.jar}:${xerces.jar}">
<param name="-oldapi" value="hadoop-mapred ${jdiff.stable}"/>
<param name="-newapi" value="hadoop-mapred ${version}"/>
<param name="-oldapidir" value="${jdiff.xml.dir}"/>
<param name="-newapidir" value="${jdiff.xml.dir}"/>
<param name="-javadocold" value="${jdiff.stable.javadoc}"/>
<param name="-javadocnew" value="../../api/"/>
<param name="-stats"/>
</doclet>
<classpath >
<path refid="classpath" />
<path refid="jdiff-classpath"/>
<pathelement path="${java.class.path}"/>
</classpath>
</javadoc>
</target>
<target name="changes-to-html" description="Convert CHANGES.txt into an html file">
<mkdir dir="${build.docs}"/>
<exec executable="perl" input="CHANGES.txt" output="${build.docs}/changes.html" failonerror="true">
<arg value="${changes.src}/changes2html.pl"/>
</exec>
<copy todir="${build.docs}">
<fileset dir="${changes.src}" includes="*.css"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="compile, jar, javadoc, docs, api-report, examples, tools, jar-test, package-librecordio"
description="Build distribution">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/contrib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<mkdir dir="${dist.dir}/docs/jdiff"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
<fileset dir="${common.ivy.lib.dir}"/>
</copy>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib">
<exclude name="**/native/**"/>
</fileset>
</copy>
<subant target="package">
<!--Pass down the version in case its needed again and the target
distribution directory so contribs know where to install to.-->
<property name="version" value="${version}"/>
<property name="dist.dir" value="${dist.dir}"/>
<fileset file="${contrib.dir}/build.xml"/>
</subant>
<copy todir="${dist.dir}/webapps">
<fileset dir="${build.webapps}"/>
</copy>
<copy todir="${dist.dir}">
<fileset file="${build.dir}/${final.name}*.jar"/>
<fileset file="${build.dir}/${test.final.name}.jar"/>
<fileset file="${build.dir}/${examples.final.name}.jar"/>
<fileset file="${build.dir}/${tools.final.name}.jar"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy file="ivy.xml" tofile="${dist.dir}/ivy.xml"/>
<copy todir="${dist.dir}/ivy">
<fileset dir="ivy"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
<fileset dir="src" excludes="**/*.template **/docs/build/**/*"/>
</copy>
<copy todir="${dist.dir}/c++" includeEmptyDirs="false">
<fileset dir="${build.dir}/c++"/>