This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
/
build.xml
516 lines (442 loc) · 18.9 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
<?xml version="1.0"?>
<project name="Hadoop" default="compile">
<!-- 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"/>
<property name="name" value="hadoop"/>
<property name="version" value="0.6.1-dev"/>
<property name="final.name" value="${name}-${version}"/>
<property name="year" value="2006"/>
<property name="libhdfs.version" value="1"/>
<property name="src.dir" value="${basedir}/src/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="docs.dir" value="${basedir}/docs"/>
<property name="docs.src" value="${basedir}/src/web"/>
<property name="libhdfs.src" value="${basedir}/src/c++/libhdfs"/>
<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.webapps" value="${build.dir}/webapps"/>
<property name="build.examples" value="${build.dir}/examples"/>
<property name="build.libhdfs" value="${build.dir}/libhdfs"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.minimr" value="${build.dir}/minimr"/>
<property name="build.javadoc" value="${build.docs}/api"/>
<property name="build.encoding" value="ISO-8859-1"/>
<property name="test.src.dir" value="${basedir}/src/test"/>
<property name="test.build.dir" value="${build.dir}/test"/>
<property name="test.build.data" value="${test.build.dir}/data"/>
<property name="hadoop.log.dir" value="${test.build.dir}/logs"/>
<property name="test.build.classes" value="${test.build.dir}/classes"/>
<property name="test.build.javadoc" value="${test.build.dir}/docs/api"/>
<property name="test.include" value="Test*"/>
<property name="test.classpath.id" value="test.classpath"/>
<property name="libhdfs.test.conf.dir" value="${libhdfs.src}/tests/conf"/>
<property name="libhdfs.test.log.dir" value="${build.libhdfs}/tests/logs"/>
<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/j2se/1.5/docs/api/"/>
<property name="javadoc.packages" value="org.apache.hadoop.*"/>
<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.5"/>
<!-- the normal classpath -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${conf.dir}"/>
</path>
<!-- the unit test classpath: uses test.src.dir for configuration -->
<path id="test.classpath">
<pathelement location="${test.build.classes}" />
<pathelement location="${build.minimr}" />
<pathelement location="${test.src.dir}"/>
<pathelement location="${build.dir}"/>
<pathelement location="${build.examples}"/>
<path refid="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>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.webapps}/task/WEB-INF"/>
<mkdir dir="${build.webapps}/job/WEB-INF"/>
<mkdir dir="${build.webapps}/dfs/WEB-INF"/>
<mkdir dir="${build.webapps}/datanode/WEB-INF"/>
<mkdir dir="${build.examples}"/>
<mkdir dir="${build.minimr}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
<touch datetime="01/25/1971 2:00 pm">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<!-- copy all of the jsp and static files -->
<copy todir="${build.webapps}">
<fileset dir="${src.webapps}">
<exclude name="**/*.jsp" />
</fileset>
</copy>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<taskdef classname="org.apache.jasper.JspC" name="jsp-compile" >
<classpath refid="test.classpath"/>
</taskdef>
<target name="record-parser" depends="init" if="javacc.home">
<javacc
target="${src.dir}/org/apache/hadoop/record/compiler/generated/rcc.jj"
outputdirectory="${src.dir}/org/apache/hadoop/record/compiler/generated"
javacchome="${javacc.home}"
/>
</target>
<target name="compile-core" depends="init, record-parser">
<copy file="${src.webapps}/datanode/browseDirectory.jsp" todir="${src.webapps}/dfs/"/>
<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>
<jsp-compile
uriroot="${src.webapps}/dfs"
outputdir="${build.src}"
package="org.apache.hadoop.dfs"
webxml="${build.webapps}/dfs/WEB-INF/web.xml">
</jsp-compile>
<jsp-compile
uriroot="${src.webapps}/datanode"
outputdir="${build.src}"
package="org.apache.hadoop.dfs"
webxml="${build.webapps}/datanode/WEB-INF/web.xml">
</jsp-compile>
<javac
encoding="${build.encoding}"
srcdir="${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}">
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-contrib" depends="compile-core">
<subant target="deploy">
<fileset file="${basedir}/src/contrib/build.xml"/>
</subant>
</target>
<target name="compile" depends="compile-core, compile-contrib">
</target>
<target name="compile-examples" depends="compile-core">
<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}">
<classpath refid="classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Make hadoop.jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-core">
<tar compression="gzip" destfile="${build.classes}/bin.tgz">
<tarfileset dir="bin" mode="755"/>
</tar>
<jar jarfile="${build.dir}/${final.name}.jar"
basedir="${build.classes}">
<fileset file="${conf.dir}/hadoop-default.xml"/>
<fileset file="${conf.dir}/mapred-default.xml"/>
<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">
<jar jarfile="${build.dir}/${final.name}-examples.jar"
basedir="${build.examples}">
<manifest>
<attribute name="Main-Class"
value="org/apache/hadoop/examples/ExampleDriver"/>
</manifest>
</jar>
</target>
<!-- ================================================================== -->
<!-- Make the Hadoop metrics jar. (for use outside Hadoop) -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="metrics.jar" depends="compile-core">
<jar jarfile="${build.dir}/hadoop-metrics-${version}.jar"
basedir="${build.classes}">
<include name="**/metrics/**" />
<exclude name="**/package.html" />
</jar>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-core-test" depends="compile-examples">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="org/apache/hadoop/**/*.java"
destdir="${test.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<classpath refid="test.classpath"/>
</javac>
<jar jarfile="${build.dir}/${final.name}-test.jar"
basedir="${test.build.classes}">
<manifest>
<attribute name="Main-Class"
value="org/apache/hadoop/test/AllTestDriver"/>
</manifest>
</jar>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test-core" depends="compile-core-test">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<delete dir="${hadoop.log.dir}"/>
<mkdir dir="${hadoop.log.dir}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="hadoop.log.dir" value="${hadoop.log.dir}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="hadoop.log.dir" value="."/>
<classpath refid="${test.classpath.id}"/>
<formatter type="plain" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/${test.include}.java"
excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="test-contrib" depends="compile-core">
<subant target="test">
<fileset file="${basedir}/src/contrib/build.xml"/>
</subant>
</target>
<target name="test" depends="test-core, test-contrib">
</target>
<!-- Run all unit tests, not just Test*, and use non-test configuration. -->
<target name="test-cluster">
<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>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="javadoc" depends="default-doc">
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="${src.dir}/overview.html"
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"
>
<packageset dir="${src.dir}"/>
<packageset dir="${examples.dir}"/>
<link href="${javadoc.link.java}"/>
<classpath refid="classpath"/>
<group title="Core" packages="org.apache.hadoop.*"/>
<group title="Examples" packages="org.apache.hadoop.examples"/>
</javadoc>
</target>
<target name="default-doc">
<style basedir="${conf.dir}" destdir="${build.docs}"
includes="hadoop-default.xml" style="conf/configuration.xsl"/>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="jar, javadoc, examples, compile-core-test">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib"/>
</copy>
<copy todir="${dist.dir}/webapps">
<fileset dir="${build.webapps}"/>
</copy>
<copy file="${build.dir}/${final.name}.jar" todir="${dist.dir}"/>
<copy file="${build.dir}/${final.name}-examples.jar" todir="${dist.dir}"/>
<copy file="${build.dir}/${final.name}-test.jar" todir="${dist.dir}"/>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${dist.dir}/bin"/>
</chmod>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
<fileset dir="src"/>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="tar" depends="package">
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${final.name}.tar.gz">
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</tar>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean" depends="clean-contrib, clean-libhdfs">
<delete dir="${build.dir}"/>
</target>
<!-- ================================================================== -->
<!-- Contrib targets. For now, they must be called explicitely -->
<!-- Using subant instead of ant as a workaround for 30569 -->
<!-- ================================================================== -->
<target name="deploy-contrib" depends="compile-core">
<subant target="deploy">
<fileset file="src/contrib/build.xml"/>
</subant>
</target>
<target name="clean-contrib">
<subant target="clean">
<fileset file="src/contrib/build.xml"/>
</subant>
</target>
<!-- ================================================================== -->
<!-- libhdfs targets. -->
<!-- ================================================================== -->
<target name="compile-libhdfs" depends="init">
<mkdir dir="${build.libhdfs}"/>
<exec dir="${libhdfs.src}" executable="make">
<env key="OS_NAME" value="${os.name}"/>
<env key="OS_ARCH" value="${os.arch}"/>
<env key="SHLIB_VERSION" value="${libhdfs.version}"/>
<env key="LIBHDFS_BUILD_DIR" value="${build.libhdfs}"/>
</exec>
</target>
<target name="test-libhdfs" depends="compile-libhdfs, jar">
<delete dir="${libhdfs.test.log.dir}"/>
<mkdir dir="${libhdfs.test.log.dir}"/>
<exec dir="${libhdfs.src}" executable="make">
<env key="OS_NAME" value="${os.name}"/>
<env key="OS_ARCH" value="${os.arch}"/>
<env key="SHLIB_VERSION" value="${libhdfs.version}"/>
<env key="LIBHDFS_BUILD_DIR" value="${build.libhdfs}"/>
<env key="CLASSPATH" value="${build.dir}/${final.name}.jar"/>
<env key="HADOOP_HOME" value="${basedir}"/>
<env key="HADOOP_CONF_DIR" value="${libhdfs.test.conf.dir}"/>
<env key="HADOOP_LOG_DIR" value="${libhdfs.test.log.dir}"/>
<arg value="test"/>
</exec>
</target>
<target name="clean-libhdfs">
<exec dir="${libhdfs.src}" executable="make">
<env key="LIBHDFS_BUILD_DIR" value="${build.libhdfs}"/>
<arg value="clean"/>
</exec>
</target>
<target name="doc-libhdfs">
<exec dir="${libhdfs.src}" executable="make">
<arg value="doc"/>
</exec>
</target>
<target name="package-libhdfs" depends="compile-libhdfs, doc-libhdfs">
<mkdir dir="${dist.dir}/libhdfs"/>
<copy todir="${dist.dir}/libhdfs">
<fileset dir="${build.libhdfs}" followsymlinks="false"/>
</copy>
<chmod perm="ugo+x" type="file">
<fileset dir="${dist.dir}/libhdfs"/>
</chmod>
<exec dir="${dist.dir}/libhdfs" executable="ln">
<arg line="-sf libhdfs.so.${libhdfs.version} libhdfs.so"/>
</exec>
</target>
</project>