forked from marciosilva/sqoop
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
1044 lines (904 loc) · 39.3 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 Cloudera, Inc. under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
Cloudera, Inc. 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="sqoop" default="jar-all"
xmlns:artifact="urn:maven-artifact-ant"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Load system-wide and project-wide default properties set by
the user, to avoid needing to override with -D. -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<!-- some basic properties -->
<property environment="env"/>
<property name="name" value="sqoop" />
<property name="Name" value="Sqoop" />
<property name="version" value="1.3.0-SNAPSHOT" />
<!-- The last version released. -->
<property name="oldversion" value="1.0.0" />
<!-- The point when we branched for the previous release. -->
<property name="prev.git.hash"
value="b099cd8566cebab7fa7360bec21c3d1fcbece093" />
<property name="artifact.name" value="${name}-${version}" />
<property name="dest.jar" value="${artifact.name}.jar" />
<property name="test.jar" value="${name}-test-${version}.jar" />
<property name="git.hash" value="" />
<!-- programs used -->
<property name="python" value="python" />
<!-- locations in the source tree -->
<property name="base.src.dir" location="${basedir}/src" />
<property name="src.dir" location="${base.src.dir}/java" />
<property name="test.dir" location="${base.src.dir}/test" />
<property name="perftest.src.dir" location="${base.src.dir}/perftest" />
<property name="lib.dir" location="${basedir}/lib" />
<property name="docs.src.dir" location="${base.src.dir}/docs" />
<property name="script.src.dir" location="${base.src.dir}/scripts" />
<!-- base directory for all build/test process output -->
<property name="build.dir" location="${basedir}/build" />
<!-- generated bin scripts -->
<property name="build.bin.dir" location="${build.dir}/bin" />
<!-- generated source code -->
<property name="build.src.dir" location="${build.dir}/src" />
<!-- staging area for *-sources.jar files -->
<property name="build.srcjar.dir" location="${build.dir}/srcjars" />
<!-- compiled classes for the main sqoop artifact. -->
<property name="build.classes" location="${build.dir}/classes"/>
<!-- root directory for output/intermediate data for testing -->
<property name="build.test" location="${build.dir}/test"/>
<property name="test.log.dir" location="${build.dir}/test/logs"/>
<!-- compiled test classes -->
<property name="build.test.classes" location="${build.test}/classes" />
<!-- compiled "perftest" programs -->
<property name="build.perftest" location="${build.dir}/perftest"/>
<property name="build.perftest.classes" location="${build.perftest}/classes"/>
<!-- generated documentation output directory -->
<property name="build.javadoc" location="${build.dir}/docs/api" />
<!-- Target dir for release notes file. -->
<property name="build.relnotes.dir" location="${build.dir}/docs" />
<property name="relnotes.filename"
location="${build.relnotes.dir}/sqoop-${version}.releasenotes.html" />
<property name="dist.dir" location="${build.dir}/${artifact.name}" />
<property name="tar.file" location="${build.dir}/${artifact.name}.tar.gz" />
<property name="build.docs.timestamp"
location="${build.dir}/docs.timestamp" />
<!-- compilation -->
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
<property name="build.encoding" value="ISO-8859-1"/>
<!-- testing with JUnit -->
<property name="test.junit.output.format" value="plain"/>
<property name="test.output" value="no"/>
<property name="test.timeout" value="300000"/>
<!-- static analysis -->
<property name="findbugs.out.dir" value="${build.dir}/findbugs" />
<property name="findbugs.output.xml.file"
value="${findbugs.out.dir}/report.xml" />
<property name="findbugs.output.html.file"
value="${findbugs.out.dir}/report.html" />
<property name="findbugs.excludes"
location="${test.dir}/findbugsExcludeFile.xml" />
<!-- maven -->
<property name="mvn.build.dir" value="${build.dir}/m2" />
<property name="mvn.repo" value="snapshots" />
<property name="mvn.repo.id" value="cloudera.${mvn.repo}.repo" />
<property name="mvn.deploy.url"
value="https://repository.cloudera.com/content/repositories/${mvn.repo}"/>
<property name="sqoop.pom" value="${mvn.build.dir}/sqoop.pom" />
<property name="sqooptest.pom" value="${mvn.build.dir}/sqoop-test.pom" />
<!-- code coverage -->
<property name="cobertura.dir" value="${build.dir}/cobertura" />
<property name="cobertura.home" value="${cobertura.dir}" />
<property name="cobertura.report.dir" value="${cobertura.dir}/report" />
<property name="cobertura.format" value="html" /> <!-- may be 'xml' -->
<property name="cobertura.class.dir" value="${cobertura.dir}/classes" />
<!-- Checking code style -->
<property name="checkstyle.xml" value="${test.dir}/checkstyle.xml" />
<property name="checkstyle.format.xsl"
value="${test.dir}/checkstyle-noframes.xsl" />
<property name="checkstyle.report.dir" value="${build.dir}" />
<!-- Release audit -->
<property name="rat.reporting.classname" value="rat.Report"/>
<!-- When testing with non-free JDBC drivers, override this parameter
to contain the path to the driver library dir.
-->
<property name="sqoop.thirdparty.lib.dir" value="" />
<!-- Ivy-based dependency resolution -->
<property name="ivy.dir" location="${basedir}/ivy" />
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml"/>
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<property name="ivy.jar" location="${lib.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="mvn_repo_url"
value="http://repo2.maven.org/maven2/org/apache/maven/maven-ant-tasks/${mvn.version}/maven-ant-tasks-${mvn.version}.jar"/>
<property name="mvn.jar"
location="${build.dir}/maven-ant-tasks-${mvn.version}.jar" />
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<property name="redist.ivy.lib.dir"
location="${build.ivy.lib.dir}/${name}/redist"/>
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern"
value="${name}/[conf]/[artifact]-[revision](-[classifier]).[ext]"/>
<!--test related properties -->
<property name="sqoop.test.oracle.connectstring"
value="jdbc:oracle:thin:@//localhost/xe"/>
<property name="sqoop.test.mysql.connectstring.host_url"
value="jdbc:mysql://localhost/"/>
<property name="sqoop.test.postgresql.connectstring.host_url"
value="jdbc:postgresql://localhost/"/>
<!-- load ant-contrib tasks to get the "if" task. -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- The classpath for compiling and running Sqoop -->
<if>
<isset property="hadoop.home" />
<then>
<path id="compile.classpath">
<pathelement location="${build.classes}"/>
<path refid="lib.path"/>
<fileset dir="${hadoop.home}">
<include name="hadoop-core-*.jar" />
<include name="hadoop-*-core.jar" />
<include name="hadoop-common-*.jar" />
<include name="hadoop-mapred-*.jar" />
<include name="hadoop-hdfs-*.jar" />
</fileset>
<fileset dir="${hadoop.home}/lib">
<include name="*.jar" />
</fileset>
<path refid="${name}.hadoop.classpath"/>
</path>
</then>
<else>
<path id="compile.classpath">
<pathelement location="${build.classes}"/>
<path refid="lib.path"/>
<path refid="${name}.hadoop.classpath"/>
</path>
</else>
</if>
<path id="cobertura.classpath">
<fileset dir="${cobertura.home}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- "init" target used for setup purposes. -->
<target name="init">
<!-- Path containing third-party libraries deployed directly with Sqoop.
This does not include anything that Ivy can retrieve for us.
-->
<path id="lib.path">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- Classpath for unit tests (superset of compile.classpath) -->
<path id="test.classpath">
<pathelement location="${build.test.classes}" />
<path refid="${name}.hadooptest.classpath" />
<path refid="compile.classpath" />
</path>
</target>
<!-- generate the version information class. -->
<target name="gen-version" depends="init">
<exec executable="${script.src.dir}/write-version-info.sh"
dir="${basedir}" failonerror="true">
<arg value="${build.dir}" />
<arg value="${version}" />
<arg value="${git.hash}" />
</exec>
</target>
<!-- Compile core classes for the project -->
<target name="compile"
depends="init, gen-version, ivy-retrieve-hadoop"
description="Compile core classes for the project">
<!-- don't use an out-of-date instrumented build. -->
<delete dir="${cobertura.class.dir}" />
<!-- ensure normal build target dir exists -->
<mkdir dir="${build.classes}" />
<!-- Compile generated code first. -->
<javac
encoding="${build.encoding}"
srcdir="${build.src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<classpath refid="compile.classpath"/>
</javac>
<!-- Compile the main code. -->
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="compile-test"
depends="compile, ivy-retrieve-hadoop-test"
description="Compile test classes">
<mkdir dir="${build.test.classes}" />
<javac
encoding="${build.encoding}"
srcdir="${test.dir}"
includes="**/*.java"
destdir="${build.test.classes}"
debug="${javac.debug}">
<classpath>
<path refid="test.classpath"/>
</classpath>
</javac>
</target>
<target name="compile-perf-test"
depends="compile, ivy-retrieve-hadoop-test"
description="Compile manual performance tests">
<mkdir dir="${build.perftest.classes}" />
<javac
encoding="${build.encoding}"
srcdir="${perftest.src.dir}"
includes="**/*.java"
destdir="${build.perftest.classes}"
debug="${javac.debug}">
<classpath>
<path refid="test.classpath"/>
</classpath>
</javac>
</target>
<target name="jar" depends="compile" description="Create main jar">
<jar jarfile="${build.dir}/${dest.jar}" basedir="${build.classes}" />
</target>
<target name="jar-test" depends="compile-test" description="Create test jar">
<jar jarfile="${build.dir}/${test.jar}" basedir="${build.test.classes}" />
</target>
<!-- Ensure that all source code can be built -->
<target name="compile-all"
depends="compile,compile-test,compile-perf-test"
description="Compile all sources"/>
<!-- Create all jars. Note this does not include the perftests. -->
<target name="jar-all" depends="jar,jar-test"
description="Create all jar artifacts" />
<target name="scripts" depends="jar"
description="Create tool-specific wrapper scripts">
<!-- Take the list of available tools from 'sqoop help' and generate
the wrapper scripts to invoke each of these.
-->
<mkdir dir="${build.bin.dir}" />
<java classname="com.cloudera.sqoop.Sqoop"
fork="true"
failonerror="true"
output="${build.dir}/tools-list"
error="/dev/null">
<jvmarg value="-Dhadoop.security.log.file=./build/security-audit.log" />
<arg value="help" />
<classpath refid="compile.classpath"/>
</java>
<exec executable="${script.src.dir}/create-tool-scripts.sh"
dir="${basedir}" failonerror="true">
<arg value="${build.bin.dir}" />
<arg value="${script.src.dir}/tool-script.sh.template" />
<arg value="${build.dir}/tools-list" />
</exec>
</target>
<target name="package"
depends="jar-all,compile-all,docs,ivy-retrieve-redist,scripts"
description="Create a redistributable package">
<mkdir dir="${dist.dir}"/>
<!-- copy in the build artifact -->
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="true">
<fileset dir="${build.dir}">
<include name="${dest.jar}" />
</fileset>
</copy>
<!-- copy the test artifact -->
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="true">
<fileset dir="${build.dir}">
<include name="${test.jar}" />
</fileset>
</copy>
<!-- copy in various components of the initial source layout
so that the redistributable can bootstrap itself. -->
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="false">
<fileset dir="${basedir}">
<include name="**/*" />
<exclude name="build/**" />
<exclude name="lib/**" />
<exclude name=".git/**" />
<exclude name="tags" />
<exclude name=".project" />
<exclude name=".classpath" />
<exclude name="conf/managers.d/**" />
<exclude name="conf/tools.d/**" />
</fileset>
</copy>
<!-- copy the dependency libraries from ivy into the output lib dir -->
<mkdir dir="${dist.dir}/lib"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
<fileset dir="${redist.ivy.lib.dir}">
<include name="**/*.jar" />
</fileset>
</copy>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="${lib.dir}">
<include name="**/*" />
<exclude name="ivy*" />
</fileset>
</copy>
<!-- copy in documentation build artifacts -->
<copy todir="${dist.dir}/docs" includeEmptyDirs="false" flatten="false">
<fileset dir="${build.dir}/docs">
<include name="**/*.html" />
<include name="**/*.css" />
<include name="images/**" />
</fileset>
</copy>
<copy todir="${dist.dir}/docs/man" includeEmptyDirs="false" flatten="false">
<fileset dir="${build.dir}/docs">
<include name="**/*.gz" />
</fileset>
</copy>
<!-- copy in auto-generated bin scripts -->
<copy todir="${dist.dir}/bin" includeEmptyDirs="false" flatten="true">
<fileset dir="${build.bin.dir}">
<include name="*" />
</fileset>
</copy>
<!-- make sure the bin scripts are executable. -->
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}/bin" />
</chmod>
<!-- make sure any scripts named *.sh are executable. -->
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}">
<include name="**/*.sh" />
</fileset>
</chmod>
<!-- In the configuration directory, take the sqoop-site-template
and copy it to sqoop-site.xml, overwriting any user-specified
sqoop-site.xml in there.
-->
<copy file="${dist.dir}/conf/sqoop-site-template.xml"
tofile="${dist.dir}/conf/sqoop-site.xml"
overwrite="true" />
</target>
<target name="tar" depends="package" description="Create release tarball">
<tar compression="gzip" longfile="gnu" destfile="${tar.file}">
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${artifact.name}/bin/*" />
<exclude name="${artifact.name}/**/*.sh" />
<include name="${artifact.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${artifact.name}/bin/*" />
<include name="${artifact.name}/**/*.sh" />
</tarfileset>
</tar>
</target>
<!-- set variables that configure the actual test -->
<target name="test-prep" depends="test-prep-normal,test-prep-thirdparty"/>
<target name="test-prep-normal" unless="thirdparty">
<!-- Set this to run all the "standard" tests -->
<property name="test.pattern" value="Test*" />
<property name="cobertura.testset" value="base" />
</target>
<target name="test-prep-thirdparty" if="thirdparty">
<!-- Run tests that *end* with the name Test, instead of starting with it;
this runs non-standard tests e.g. third-party database tests. -->
<property name="test.pattern" value="*Test" />
<property name="cobertura.testset" value="thirdparty" />
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- By default, we'll run the "normal" tests: Test*.java -->
<!-- To run third-party tests, run with -Dthirdparty=true -->
<!-- ================================================================== -->
<target name="test"
depends="compile-test,compile,test-prep,run-tests"
description="Run unit tests" />
<!-- actually run the selected unit tests -->
<target name="run-tests"
depends="compile-test,compile,test-prep">
<antcall target="checkfailure" inheritRefs="true" />
</target>
<target name="test-core">
<!-- inner target only intended to be used via antcall.
Does not define its dependencies. Should be invoked through the
'test' target. Does not fail the build if tests fail.
-->
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.log.dir}"/>
<delete dir="${build.test}/data"/>
<mkdir dir="${build.test}/data" />
<mkdir dir="${cobertura.class.dir}" />
<junit
printsummary="yes" showoutput="${test.output}"
haltonfailure="no" fork="yes" maxmemory="512m"
errorProperty="tests.failed" failureProperty="tests.failed"
timeout="${test.timeout}"
dir="${build.test}/data">
<!-- enable asserts in tests -->
<jvmarg value="-ea" />
<!-- uncomment this if you want to attach a debugger -->
<!--
<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=2601" />
-->
<sysproperty key="test.build.data" value="${build.test}/data"/>
<sysproperty key="build.test" value="${build.test}"/>
<sysproperty key="net.sourceforge.cobertura.datafile"
value="${cobertura.dir}/cobertura-${cobertura.testset}.ser" />
<!-- define this property to force Sqoop to throw better exceptions on
errors during testing, instead of printing a short message and
exiting with status 1.
-->
<sysproperty key="sqoop.throwOnError" value="" />
<!-- we want more log4j output when running unit tests -->
<sysproperty key="hadoop.root.logger"
value="DEBUG,console" />
<!-- requires fork=yes for:
relative File paths to use the specified user.dir
classpath to use build/*.jar
-->
<sysproperty key="user.dir" value="${build.test}/data"/>
<!-- Setting the user.dir property is actually meaningless as it
is read-only in the Linux Sun JDK. Provide an alternate sysprop
to specify where generated code should go.
-->
<sysproperty key="sqoop.src.dir" value="${build.test}/data"/>
<!-- Override standalone Hadoop's working dirs to allow parallel
execution of multiple Hudson builders
-->
<sysproperty key="hadoop.tmp.dir" value="${build.test}/hadoop"/>
<sysproperty key="fs.default.name" value="${fs.default.name}"/>
<sysproperty key="hadoop.test.localoutputfile"
value="${hadoop.test.localoutputfile}"/>
<sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
<!-- we have a mock "hive" shell instance in our testdata directory
for testing hive integration. Set this property here to ensure
that the unit tests pick it up.
-->
<sysproperty key="hive.home" value="${basedir}/testdata/hive" />
<!-- By default the Oracle tests assume an Oracle XE installation
with a hardcoded connection string. If you want to overwrite
that specify the value at command line or via
build.properties file.
-->
<sysproperty key="sqoop.test.oracle.connectstring"
value="${sqoop.test.oracle.connectstring}"/>
<sysproperty key="sqoop.test.mysql.connectstring.host_url"
value="${sqoop.test.mysql.connectstring.host_url}"/>
<sysproperty key="sqoop.test.postgresql.connectstring.host_url"
value="${sqoop.test.postgresql.connectstring.host_url}"/>
<classpath>
<!-- instrumented classes go ahead of normal classes -->
<pathelement location="${cobertura.class.dir}" />
<!-- main classpath here. -->
<path refid="test.classpath" />
<!-- need thirdparty JDBC drivers for thirdparty tests -->
<fileset dir="${sqoop.thirdparty.lib.dir}"
includes="*.jar" />
<!-- include cobertura itself on the classpath -->
<path refid="cobertura.classpath" />
</classpath>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${build.test}" unless="testcase">
<fileset dir="${test.dir}"
includes="**/${test.pattern}.java"
excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${build.test}" if="testcase">
<fileset dir="${test.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
</target>
<target name="releaseaudit" depends="package,ivy-retrieve-releaseaudit"
description="Audit license headers for release">
<fail unless="rat.present"
message="Failed to load class [${rat.reporting.classname}]." />
<java classname="${rat.reporting.classname}" fork="true"
output="${build.dir}/rat.log">
<classpath refid="${name}.releaseaudit.classpath" />
<arg value="${dist.dir}" />
</java>
<exec executable="${script.src.dir}/rat-violations.sh" failOnError="true">
<arg value="${build.dir}/rat.log" />
<arg value="${dist.dir}" />
</exec>
<echo message="Release audit appears okay. Full results are in " />
<echo message="${build.dir}/rat.log" />
</target>
<target name="docs-uptodate" depends="init">
<uptodate property="docs.uptodate">
<srcfiles dir="${basedir}/src/docs/">
<include name="**/*.txt" />
</srcfiles>
<mapper type="merge" to="${build.docs.timestamp}" />
</uptodate>
</target>
<target name="checkversion">
<if>
<contains string="${version}" substring="SNAPSHOT" />
<then>
<fail message="Error: cannot release a snapshot. Set -Dversion" />
</then>
</if>
</target>
<target name="relnotes-uptodate" depends="init">
<!-- releasenotes are considered up-to-date if they exist. -->
<available property="relnotes.exists" file="${relnotes.filename}" />
<!-- if we're building a snapshot release, don't make release notes. -->
<if>
<contains string="${version}" substring="SNAPSHOT" />
<then>
<property name="relnotes.exists" value="true" />
</then>
</if>
</target>
<target name="relnotes" depends="relnotes-uptodate" unless="relnotes.exists"
description="Generate release notes">
<exec executable="${python}" failonerror="yes">
<arg value="${script.src.dir}/relnotes.py" />
<arg value="${build.relnotes.dir}" />
<arg value="${basedir}" />
<arg value="${prev.git.hash}..HEAD" />
<arg value="${version}" />
<arg value="${oldversion}" />
</exec>
</target>
<target name="release" depends="checkversion,tar,releaseaudit"
description="Roll a release artifact">
<echo message="Release complete" />
<echo message="Binary tar: ${tar.file}" />
<echo message="Documentation: ${build.dir}/docs" />
<echo message="Release notes: ${relnotes.filename}" />
<echo message="Release audit report: ${build.dir}/rat.log" />
</target>
<target name="mvn-prep" depends="init,ivy-resolve-test">
<!-- prepare for mvn tasks. -->
<!-- Download maven -->
<mkdir dir="${build.dir}" />
<get src="${mvn_repo_url}" dest="${mvn.jar}" usetimestamp="true" />
<!-- Register mvn tasks -->
<path id="mvn-ant-task.classpath" path="${mvn.jar}" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant"
classpathref="mvn-ant-task.classpath"/>
<!-- generate our poms from our ivy files. -->
<mkdir dir="${mvn.build.dir}" />
<ivy:makepom ivyfile="ivy/sqoop.xml" pomfile="${sqoop.pom}"
settingsRef="${name}.ivy.settings">
<mapping conf="default" scope="compile" />
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
<ivy:makepom ivyfile="ivy/sqoop-test.xml" pomfile="${sqooptest.pom}"
settingsRef="${name}.ivy.settings">
<mapping conf="default" scope="compile" />
<mapping conf="runtime" scope="runtime" />
</ivy:makepom>
<!-- Change the version in the pom file to reflect our claimed version. -->
<replaceregexp>
<regexp pattern="<version>.*</version>" />
<substitution expression="<version>${version}</version>" />
<fileset dir="${mvn.build.dir}">
<include name="*.pom" />
</fileset>
</replaceregexp>
</target>
<target name="srcjars" depends="init,jar-all"
description="Create source jars">
<mkdir dir="${build.srcjar.dir}" />
<jar jarfile="${build.srcjar.dir}/${artifact.name}-sources.jar">
<fileset dir="${src.dir}" />
<fileset dir="${build.src.dir}" />
</jar>
<jar jarfile="${build.srcjar.dir}/${name}-test-${version}-sources.jar">
<fileset dir="${test.dir}" />
</jar>
</target>
<target name="mvn-install" depends="init,mvn-prep,jar-all,srcjars"
description="Install Sqoop in local m2 repository">
<artifact:pom file="${sqoop.pom}" id="sqoop" />
<artifact:install file="${build.dir}/${dest.jar}">
<pom refid="sqoop" />
<attach file="${build.srcjar.dir}/${artifact.name}-sources.jar"
classifier="sources" />
</artifact:install>
<artifact:pom file="${sqooptest.pom}" id="sqoop-test" />
<artifact:install file="${build.dir}/${test.jar}">
<pom refid="sqoop-test" />
<attach file="${build.srcjar.dir}/${name}-test-${version}-sources.jar"
classifier="sources" />
</artifact:install>
</target>
<target name="mvn-deploy" depends="init,mvn-prep,jar-all,srcjars"
description="Deploy Sqoop to public maven repository">
<artifact:pom file="${sqoop.pom}" id="sqoop" />
<artifact:deploy file="${build.dir}/${dest.jar}">
<remoteRepository id="${mvn.repo.id}" url="${mvn.deploy.url}"/>
<pom refid="sqoop" />
<attach file="${build.srcjar.dir}/${artifact.name}-sources.jar"
classifier="sources" />
</artifact:deploy>
<artifact:pom file="${sqooptest.pom}" id="sqoop-test" />
<artifact:deploy file="${build.dir}/${test.jar}">
<remoteRepository id="${mvn.repo.id}" url="${mvn.deploy.url}"/>
<pom refid="sqoop-test" />
<attach file="${build.srcjar.dir}/${name}-test-${version}-sources.jar"
classifier="sources" />
</artifact:deploy>
</target>
<target name="docs" depends="real-docs,relnotes,javadoc"
description="Build documentation"/>
<target name="real-docs" depends="docs-uptodate,init" unless="docs.uptodate">
<exec executable="make" failonerror="true">
<arg value="-C" />
<arg value="${basedir}/src/docs" />
<arg value="BUILDROOT=${build.dir}" />
<arg value="VERSION=${version}" />
</exec>
<touch file="${build.docs.timestamp}" />
</target>
<target name="javadoc-uptodate" depends="init">
<uptodate property="javadoc.is.uptodate">
<srcfiles dir="${src.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<mapper type="merge" to="${build.javadoc}/index.html" />
</uptodate>
</target>
<target name="javadoc" description="Build javadoc"
depends="init,javadoc-uptodate,compile" unless="javadoc.is.uptodate">
<mkdir dir="${build.javadoc}" />
<exec executable="date" outputproperty="year">
<arg value="+%Y" />
</exec>
<javadoc
packagenames="com.cloudera.sqoop.lib.*"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &copy; ${year} Cloudera, Inc.">
<packageset dir="${src.dir}">
<include name="com/cloudera/sqoop/lib/**" />
</packageset>
<classpath>
<path refid="compile.classpath" />
</classpath>
</javadoc>
</target>
<target name="checkfailure" depends="test-core" if="tests.failed">
<touch file="${build.dir}/testsfailed"/>
<fail unless="continueOnFailure">Unit tests failed!</fail>
</target>
<target name="clean" description="Clean build target files">
<delete dir="${build.dir}"/>
</target>
<target name="clean-cache" description="Remove cached dependencies">
<delete dir="${user.home}/.ivy2/cache/org.apache.hadoop" />
<delete dir="${user.home}/.ivy2/cache/com.cloudera.hadoop" />
<delete dir="${user.home}/.ivy2/cache/com.cloudera.hadoop" />
<delete file="${ivy.jar}" />
</target>
<target name="veryclean"
depends="clean,clean-cache"
description="Clean build and remove cached dependencies">
</target>
<target name="findbugs" depends="check-for-findbugs,jar,compile-test"
if="findbugs.present" description="Run FindBugs">
<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.output.xml.file}" effort="max"
excludeFilter="${findbugs.excludes}" jvmargs="-Xms512m -Xmx512m">
<auxClasspath>
<path refid="test.classpath"/>
</auxClasspath>
<sourcePath path="${src.dir}" />
<sourcePath path="${test.dir}" />
<class location="${build.dir}/${dest.jar}" />
<class location="${build.test.classes}" />
</findbugs>
<xslt style="${findbugs.home}/src/xsl/default.xsl"
in="${findbugs.output.xml.file}"
out="${findbugs.output.html.file}" />
</target>
<target name="warn-findbugs-unset" unless="findbugs.home">
<fail message="You need to set -Dfindbugs.home=/path/to/findbugs" />
</target>
<target name="check-for-findbugs" depends="warn-findbugs-unset">
<available property="findbugs.present"
file="${findbugs.home}/lib/findbugs.jar" />
</target>
<target name="cobertura"
depends="check-for-cobertura,warn-cobertura-unset,jar,compile-test,test-prep"
if="cobertura.present" description="Run Cobertura (code coverage)">
<taskdef classpathref="cobertura.classpath"
resource="tasks.properties"/>
<mkdir dir="${cobertura.class.dir}" />
<cobertura-instrument todir="${cobertura.class.dir}"
datafile="${cobertura.dir}/cobertura-${cobertura.testset}.ser">
<fileset dir="${build.classes}">
<include name="**/*.class" />
</fileset>
</cobertura-instrument>
<!-- Run the unit tests, but do not fail the build if tests fail. -->
<antcall target="test-core" inheritRefs="true" />
<!-- merge the reports together from the internal and thirdparty tests -->
<delete file="${cobertura.dir}/cobertura.ser" />
<cobertura-merge datafile="${cobertura.dir}/cobertura.ser">
<fileset dir="${cobertura.dir}">
<include name="*.ser" />
</fileset>
</cobertura-merge>
<delete dir="${cobertura.report.dir}" />
<cobertura-report srcdir="${src.dir}" destdir="${cobertura.report.dir}"
format="${cobertura.format}"
datafile="${cobertura.dir}/cobertura.ser" />
</target>
<target name="warn-cobertura-unset" depends="check-for-cobertura"
unless="cobertura.present">
<fail message="You need to set -Dcobertura.home=/path/to/cobertura" />
</target>
<target name="check-for-cobertura">
<available property="cobertura.present"
file="${cobertura.home}/cobertura.jar" />
</target>
<target name="checkstyle" depends="ivy-retrieve-checkstyle,compile-all"
description="Check source code conventions">
<taskdef resource="checkstyletask.properties">
<classpath refid="${name}.checkstyle.classpath" />
</taskdef>
<mkdir dir="${checkstyle.report.dir}" />
<checkstyle config="${checkstyle.xml}" failOnViolation="false">
<fileset dir="${base.src.dir}" includes="**/*.java" />
<classpath refid="test.classpath"/>
<formatter type="xml"
toFile="${checkstyle.report.dir}/checkstyle-errors.xml" />
</checkstyle>
<xslt style="${checkstyle.format.xsl}"
in="${checkstyle.report.dir}/checkstyle-errors.xml"
out="${checkstyle.report.dir}/checkstyle-errors.html" />
</target>
<target name="ivy-probe-antlib" >
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>
<!-- Downloads the ivy jar itself. -->
<target name="ivy-download" unless="offline">
<mkdir dir="${lib.dir}" />
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib"
unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}"/>
</classpath>
</typedef>
<fail >
<condition >
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="ivy-init" depends="ivy-init-antlib" unless="ivy.configured">
<ivy:configure settingsid="${name}.ivy.settings" file="${ivysettings.xml}"/>
<property name="ivy.configured" value="true" />
</target>
<!-- retrieve ivy-managed artifacts for the compile configuration -->
<target name="ivy-resolve-common" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="common" />
</target>
<target name="ivy-retrieve-common" depends="ivy-resolve-common">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.common.classpath" conf="common" />
</target>
<!-- retrieve ivy-managed artifacts for the test configuration -->
<target name="ivy-resolve-test" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="test" />
</target>
<target name="ivy-retrieve-test" depends="ivy-resolve-test">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.test.classpath" conf="test" />
</target>
<!-- retrieve ivy-managed artifacts for the redist configuration -->
<target name="ivy-resolve-redist" depends="ivy-init">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="redist" />
</target>
<target name="ivy-retrieve-redist" depends="ivy-resolve-redist">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="${name}.redist.classpath" conf="redist" />
</target>
<!-- retrieve ivy-managed artifacts from the Hadoop distribution -->
<target name="ivy-resolve-hadoop" depends="ivy-init"
unless="hadoop.is.local">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="cloudera" />
</target>
<target name="ivy-retrieve-hadoop" depends="ivy-init,ivy-resolve-hadoop">
<!-- retrieve hadoop refs normally. -->
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
sync="true" />
<ivy:cachepath pathid="${name}.hadoop.classpath" conf="cloudera" />
</target>
<!-- retrieve ivy-managed test artifacts from the Hadoop distribution -->
<target name="ivy-resolve-hadoop-test" depends="ivy-init"
unless="hadoop.is.local">
<ivy:resolve settingsRef="${name}.ivy.settings" conf="clouderatest" />
</target>
<target name="ivy-retrieve-hadoop-test"
depends="ivy-init,ivy-resolve-hadoop-test">
<ivy:retrieve settingsRef="${name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"