forked from apache/hive
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
1464 lines (1313 loc) · 60.7 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="hive" default="jar"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:artifact="urn:maven-artifact-ant"
xmlns:rat="antlib:org.apache.rat.anttasks"
xmlns:maven="antlib:org.apache.maven.artifact.ant">
<property name="hive.root" location="${basedir}"/>
<property file="${hive.root}/build.properties"/>
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<loadproperties srcfile="${ivy.conf.dir}/libraries.properties"/>
<property environment="env"/>
<property name="target.dir" location="${build.dir.hive}/dist"/>
<property name="target.lib.dir" location="${target.dir}/lib"/>
<property name="target.conf.dir" location="${target.dir}/conf"/>
<property name="target.bin.dir" location="${target.dir}/bin"/>
<property name="target.scripts.dir" location="${target.dir}/scripts"/>
<property name="target.example.dir" location="${target.dir}/examples"/>
<property name="ql.test.query.dir" location="${basedir}/ql/src/test/queries"/>
<property name="test.data.dir" location="${basedir}/data"/>
<property name="test.build.dir" value="${build.dir.hive}/test"/>
<property name="test.continue.on.failure" value="true"/>
<property name="build.docs" value="${target.dir}/docs"/>
<property name="build.javadoc" value="${build.docs}/api"/>
<property name="docs.src" value="${hive.root}/docs"/>
<property name="anakia.docs.src" value="${docs.src}/xdocs"/>
<property name="anakia.docs.dest" value="${target.dir}/docs"/>
<property name="images.src" value="${docs.src}/images"/>
<property name="javadoc.link.java"
value="http://java.sun.com/javase/6/docs/api/"/>
<property name="final.name" value="${name}-${version}"/>
<property name="tar.final.name" value="${final.name}"/>
<property name="bin.final.name" value="${final.name}-bin"/>
<property name="vcs.excludes" value="**/.svn,**/.svn/**,**/.git,**/.git/**"/>
<property name="checkstyle.conf.dir" location="${hive.root}/checkstyle"/>
<property name="checkstyle.build.dir" location="${build.dir.hive}/checkstyle"/>
<property name="rat.build.dir" location="${build.dir.hive}/rat"/>
<property name="md5sum.format" value="{0} {1}"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${hive.root}/testlibs/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<if>
<equals arg1="${build.profile}" arg2="core"/>
<then>
<property name="iterate.hive.all" value="${iterate.hive.core.all}"/>
<property name="iterate.hive.modules" value="${iterate.hive.core.modules}"/>
<property name="iterate.hive.tests" value="${iterate.hive.core.tests}"/>
<property name="iterate.hive.thrift" value="${iterate.hive.core.thrift}"/>
<property name="iterate.hive.protobuf" value="${iterate.hive.core.protobuf}"/>
<property name="iterate.hive.cpp" value="${iterate.hive.core.cpp}"/>
</then>
</if>
<if>
<equals arg1="${build.profile}" arg2="nohcat"/>
<then>
<property name="iterate.hive.all" value="${iterate.hive.nohcat.all}"/>
<property name="iterate.hive.modules" value="${iterate.hive.nohcat.modules}"/>
<property name="iterate.hive.tests" value="${iterate.hive.nohcat.tests}"/>
<property name="iterate.hive.thrift" value="${iterate.hive.nohcat.thrift}"/>
<property name="iterate.hive.protobuf" value="${iterate.hive.nohcat.protobuf}"/>
<property name="iterate.hive.cpp" value="${iterate.hive.nohcat.cpp}"/>
</then>
</if>
<if>
<or>
<equals arg1="${build.profile}" arg2="full"/>
<not><isset property="build.profile"/></not>
</or>
<then>
<property name="iterate.hive.all" value="${iterate.hive.full.all}"/>
<property name="iterate.hive.modules" value="${iterate.hive.full.modules}"/>
<property name="iterate.hive.tests" value="${iterate.hive.full.tests}"/>
<property name="iterate.hive.thrift" value="${iterate.hive.full.thrift}"/>
<property name="iterate.hive.protobuf" value="${iterate.hive.full.protobuf}"/>
<property name="iterate.hive.cpp" value="${iterate.hive.full.cpp}"/>
</then>
</if>
<!-- Check minimum ant version required -->
<fail message="Please use ant version 1.8.0 or greater for building hive.">
<condition>
<not>
<antversion atleast="1.8.0"/>
</not>
</condition>
</fail>
<condition property="is-offline" value="true" else="false">
<isset property="offline"/>
</condition>
<import file="build-offline.xml"/>
<condition property="staging">
<equals arg1="${mvn.publish.repo}" arg2="staging"/>
</condition>
<condition property="test.halt.on.failure" value="no" else="yes">
<equals arg1="${test.continue.on.failure}" arg2="true"/>
</condition>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${hive.root}/testlibs/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- ForTask is not defined in net/sf/antcontrib/antcontrib.properties! -->
<taskdef name="for" classname="net.sf.antcontrib.logic.ForTask">
<classpath>
<pathelement location="${hive.root}/testlibs/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- ====================================================== -->
<!-- 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>
<checksum file="@{param.destfile}" algorithm="md5" pattern="${md5sum.format}"/>
</sequential>
</macrodef>
<macrodef name="iterate">
<attribute name="target"/>
<attribute name="iterate"/>
<sequential>
<if>
<isset property="module"/>
<then> <var name="target.module" value="${module}"/> </then>
<else> <var name="target.module" value="@{iterate}"/> </else>
</if>
<for list="${target.module}" param="module">
<sequential>
<subant buildpath="@{module}/build.xml" target="@{target}">
<property name="is-offline" value="${is-offline}"/>
<property name="thrift.home" value="${thrift.home}"/>
<property name="build.dir.hive" location="${build.dir.hive}"/>
</subant>
</sequential>
</for>
</sequential>
</macrodef>
<!-- the normal classpath -->
<path id="common-classpath">
<pathelement location="${hadoop.oldstyle-name.jar}"/>
<pathelement location="${hadoop.newstyle-name.jar}"/>
<pathelement location="${hadoop.common.jar}"/>
<pathelement location="${hadoop.hdfs.jar}"/>
<pathelement location="${hadoop.mapreduce.jar}"/>
<pathelement location="${build.dir.hive}/classes"/>
<fileset dir="${hive.root}" includes="hive-*.jar"/>
<fileset dir="${hive.root}/lib" includes="*.jar"/>
<fileset dir="${build.dir.hive}/ivy/lib/default" includes="*.jar"
excludes="*hadoop*.jar" erroronmissingdir="false"/>
</path>
<path id="classpath">
<pathelement location="${build.dir.hive}/common/classes"/>
<pathelement location="${build.dir.hive}/serde/classes"/>
<pathelement location="${build.dir.hive}/metastore/classes"/>
<pathelement location="${build.dir.hive}/hcatalog/classes"/>
<pathelement location="${build.dir.hive}/ql/classes"/>
<pathelement location="${build.dir.hive}/cli/classes"/>
<pathelement location="${build.dir.hive}/beeline/classes"/>
<fileset dir="${hive.root}/data" includes="files/*.jar"/>
<fileset dir="${hive.root}/ql" includes="lib/*.jar"/>
<fileset dir="${hive.root}/cli" includes="lib/*.jar"/>
<fileset dir="${hive.root}/service" includes="lib/*.jar"/>
<path refid="common-classpath"/>
</path>
<target name="ivy-init-settings">
<!--Configure Ivy by reading in the settings file
If anyone has already read in a settings file into this settings ID, it gets priority
-->
<echo message="Project: ${ant.project.name}"/>
<ivy:settings id="${ant.project.name}.ivy.settings" file="${ivysettings.xml}"/>
</target>
<target name="ivy-init-dirs">
<echo message="Project: ${ant.project.name}"/>
<mkdir dir="${build.ivy.dir}" />
<mkdir dir="${build.ivy.lib.dir}" />
<mkdir dir="${build.ivy.report.dir}" />
<mkdir dir="${build.ivy.maven.dir}" />
</target>
<target name="ivy-probe-antlib" >
<echo message="Project: ${ant.project.name}"/>
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>
<target name="ivy-download" depends="ivy-init-dirs"
description="To download ivy" unless="offline">
<echo message="Project: ${ant.project.name}"/>
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<!--
To avoid Ivy leaking things across big projects, always load Ivy in the same classloader.
Also note how we skip loading Ivy if it is already there, just to make sure all is well.
-->
<target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found">
<echo message="Project: ${ant.project.name}"/>
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader" resource="org/apache/ivy/ant/antlib.xml">
<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.1 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="ivy-clean-cache" depends="ivy-init-antlib"
description="Clean the Ivy cache">
<ivy:cleancache />
</target>
<target name="init" depends="ivy-init-antlib,deploy-ant-tasks">
<echo message="Project: ${ant.project.name}"/>
<iterate target="init" iterate="${iterate.hive.all}"/>
</target>
<target name="test-init">
<echo message="Project: ${ant.project.name}"/>
<iterate target="test-init" iterate="${iterate.hive.all}"/>
</target>
<!-- target to deploy anttasks -->
<target name="compile-ant-tasks">
<echo message="Project: ${ant.project.name}"/>
<subant target="compile">
<fileset dir="." includes="ant/build.xml"/>
</subant>
</target>
<target name="deploy-ant-tasks" depends="compile-ant-tasks">
<echo message="Project: ${ant.project.name}"/>
<subant target="jar">
<fileset dir="." includes="ant/build.xml"/>
</subant>
<taskdef name="getversionpref" classname="org.apache.hadoop.hive.ant.GetVersionPref"
classpath="${build.dir.hive}/anttasks/hive-anttasks-${version}.jar"/>
</target>
<target name="compile-cpp"
depends="init"
description="Build CPP artifacts" >
<echo message="Project: ${ant.project.name}"/>
<fail unless="thrift.home">
You must set thrift.home to the absolute path of your
local Thrift installation.
</fail>
<iterate target="compile-cpp" iterate="${iterate.hive.cpp}"/>
</target>
<target name="compile-cpp-clean"
description="Clean CPP artifacts">
<echo message="Project: ${ant.project.name}"/>
<iterate target="clean" iterate="${iterate.hive.cpp}"/>
</target>
<target name="compile" depends="compile-cpp">
<echo message="Project: ${ant.project.name}"/>
<iterate target="compile" iterate="${iterate.hive.modules}"/>
</target>
<target name="thriftif">
<echo message="Project: ${ant.project.name}"/>
<iterate target="thriftif" iterate="${iterate.hive.thrift}"/>
</target>
<target name="protobuf">
<echo message="Project: ${ant.project.name}"/>
<iterate target="protobuf" iterate="${iterate.hive.protobuf}"/>
</target>
<target name="jar"
depends="init"
description="Build JAR artifacts">
<echo message="Project: ${ant.project.name}"/>
<iterate target="jar" iterate="${iterate.hive.modules}"/>
</target>
<target name="gen-test" depends="jar" description="Generate tests">
<iterate target="gen-test" iterate="${iterate.hive.tests}"/>
</target>
<target name="jar-test" depends="gen-test"
description="Build Java test artifacts">
<echo message="Project: ${ant.project.name}"/>
<iterate target="compile-test" iterate="${iterate.hive.tests}"/>
</target>
<target name="test" depends="clean-test,jar-test" description="Run tests">
<echo message="Project: ${ant.project.name}"/>
<if>
<isset property="module"/>
<else>
<antcall target="test-shims">
<param name="hadoop.version.ant-internal" value="${hadoop.security.version}" />
</antcall>
</else>
</if>
<condition property="target.module" value="${module}" else="${iterate.hive.test}">
<isset property="module"/>
</condition>
<for keepgoing="${test.continue.on.failure}" list="${target.module}" param="module">
<sequential>
<ant antfile="@{module}/build.xml" target="test" inheritAll="false" inheritRefs="true">
<property name="build.dir.hive" location="${build.dir.hive}"/>
<property name="is-offline" value="${is-offline}"/>
</ant>
</sequential>
</for>
</target>
<target name="test-shims">
<echo message="Project: ${ant.project.name}"/>
<subant target="test" failonerror="${test.halt.on.failure}">
<property name="hadoop.version" value="${hadoop.security.version}"/>
<property name="hadoop.security.version" value="${hadoop.security.version}"/>
<fileset dir="${hive.root}/shims" includes="build.xml"/>
</subant>
</target>
<!-- create an html report from junit output files -->
<target name="testreport"
description="Generate JUnit HTML test report">
<echo message="Project: ${ant.project.name}"/>
<mkdir dir="${test.build.dir}"/>
<junitreport todir="${test.build.dir}">
<fileset dir="${build.dir.hive}">
<include name="**/TEST-*.xml"/>
</fileset>
<report format="noframes" todir="${test.build.dir}"/>
</junitreport>
</target>
<target name="clean-test"
description="Clean test results">
<echo message="Project: ${ant.project.name}"/>
<iterate target="clean-test" iterate="${iterate.hive.modules}"/>
<delete dir="${build.dir.hive}/test"/>
<delete dir="${hive.root}/ql/TempStatsStore"/>
</target>
<target name="clean"
description="Clean build artifacts">
<echo message="Project: ${ant.project.name}"/>
<iterate target="clean" iterate="${iterate.hive.all}"/>
<iterate target="clean" iterate="${iterate.hive.cpp}"/>
<delete dir="${target.dir}"/>
<antcall target="clean-online"/>
<antcall target="clean-offline"/>
</target>
<target name="clean-online" unless="offline">
<echo message="Project: ${ant.project.name}"/>
<delete dir="${build.dir.hive}"/>
</target>
<target name="clean-offline" if="offline">
<echo message="Project: ${ant.project.name}"/>
<!-- preserve the downloaded ivy .jar -->
<delete quiet="true" includeemptydirs="true">
<fileset dir="${build.dir.hive}" excludes="ivy/**/ivy*.jar"/>
</delete>
</target>
<target name="very-clean" unless="offline" depends="clean,ivy-clean-cache"
description="Clean build artifacts and flush Ivy cache" />
<target name="package-cpp"
depends="package,compile-cpp"
description="Deploy CPP artifacts">
<echo message="Project: ${ant.project.name}"/>
<mkdir dir="${target.dir}/include"/>
<copy todir="${target.dir}/include" preservelastmodified="true" flatten="true">
<fileset file="${build.dir.hive}/odbc/include/*"/>
</copy>
<copy todir="${target.lib.dir}" preservelastmodified="true" flatten="true">
<fileset file="${build.dir.hive}/odbc/lib/*" excludes="*.so"/>
</copy>
<symlink link="${target.lib.dir}/libhiveclient.so" resource="libhiveclient.so.1.0.0"/>
</target>
<target name="package"
depends="jar"
description="Deploy JAR artifacts">
<echo message="Project: ${ant.project.name}"/>
<echo message="Deploying Hive jars to ${target.dir}"/>
<mkdir dir="${target.dir}"/>
<mkdir dir="${target.lib.dir}"/>
<mkdir dir="${target.conf.dir}"/>
<mkdir dir="${target.bin.dir}"/>
<mkdir dir="${target.scripts.dir}/metastore/upgrade"/>
<mkdir dir="${target.example.dir}"/>
<mkdir dir="${target.example.dir}/files"/>
<mkdir dir="${target.example.dir}/queries"/>
<mkdir dir="${target.lib.dir}/py"/>
<mkdir dir="${target.lib.dir}/php"/>
<copy file="${hive.root}/bin/hive" todir="${target.bin.dir}"/>
<copy file="${hive.root}/bin/metatool" todir="${target.bin.dir}"/>
<copy file="${hive.root}/bin/schematool" todir="${target.bin.dir}"/>
<copy file="${hive.root}/bin/beeline" todir="${target.bin.dir}"/>
<copy file="${hive.root}/bin/hiveserver2" todir="${target.bin.dir}"/>
<copy file="${hive.root}/bin/hive-config.sh" todir="${target.bin.dir}"/>
<copy todir="${target.bin.dir}/ext">
<fileset dir="${hive.root}/bin/ext" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.scripts.dir}/metastore/upgrade">
<fileset dir="${hive.root}/metastore/scripts/upgrade" excludes="${vcs.excludes}"/>
</copy>
<copy file="${basedir}/conf/hive-default.xml.template" todir="${target.conf.dir}">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy todir="${target.conf.dir}">
<fileset dir="${basedir}/conf">
<include name="*.template"/>
</fileset>
</copy>
<copy file="${basedir}/common/src/java/conf/hive-log4j.properties"
tofile="${target.conf.dir}/hive-log4j.properties.template"/>
<copy file="${basedir}/ql/src/java/conf/hive-exec-log4j.properties"
tofile="${target.conf.dir}/hive-exec-log4j.properties.template"/>
<!-- Create php thrift package -->
<copy todir="${target.lib.dir}/php">
<fileset dir="${hive.root}/service/lib/php" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/php/packages/serde">
<fileset dir="${hive.root}/serde/src/gen/thrift/gen-php" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/php/packages/hive_metastore">
<fileset dir="${hive.root}/metastore/src/gen/thrift/gen-php" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/php/packages/hive_service">
<fileset dir="${hive.root}/service/src/gen/thrift/gen-php" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/php/packages/queryplan">
<fileset dir="${hive.root}/ql/src/gen/thrift/gen-php" excludes="${vcs.excludes}"/>
</copy>
<!-- Create the python thrift package -->
<copy todir="${target.lib.dir}/py">
<fileset dir="${hive.root}/service/lib/py" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/py/hive_serde">
<fileset dir="${hive.root}/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/py/hive_metastore">
<fileset dir="${hive.root}/metastore/src/gen/thrift/gen-py/hive_metastore" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/py/hive_service">
<fileset dir="${hive.root}/service/src/gen/thrift/gen-py/hive_service" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/py/TCLIService">
<fileset dir="${hive.root}/service/src/gen/thrift/gen-py/TCLIService" excludes="${vcs.excludes}"/>
</copy>
<copy todir="${target.lib.dir}/py/queryplan">
<fileset dir="${hive.root}/ql/src/gen/thrift/gen-py/queryplan" excludes="${vcs.excludes}"/>
</copy>
<!-- copy jar files -->
<copy todir="${target.lib.dir}" preservelastmodified="true" flatten="true">
<fileset dir="${hive.root}" >
<include name="*/*.jar"/>
<include name="*/*/*.jar"/>
<exclude name="**/TestSerDe.jar"/>
<exclude name="build/hadoopcore/*.jar"/>
<exclude name="**/ant-contrib*.jar"/>
<exclude name="**/hive-anttasks*.jar"/>
<exclude name="**/hive-testutils*.jar"/>
</fileset>
<fileset file="${build.dir.hive}/beeline/hive-beeline-${version}.jar" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/cli/hive-cli-${version}.jar" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/common/hive-common-${version}.jar" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/ql/hive-exec-${version}.jar" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/metastore/hive-metastore-${version}.jar" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/hwi/hive-hwi-${version}.war" erroronmissingdir="false"/>
<fileset file="${build.dir.hive}/contrib/hive-contrib-${version}.jar" erroronmissingdir="false"/>
<fileset dir="${build.dir.hive}/ivy/lib/default">
<include name="*.jar"/>
<exclude name="*.tar.gz"/>
<exclude name="hadoop-*.jar" />
<exclude name="**/*high-scale-lib-*"/>
<exclude name="**/hamcrest-core-*jar"/>
<exclude name="**/junit*.jar"/>
<exclude name="**/asm*.jar"/>
<exclude name="**/mockito*.jar"/>
<exclude name="**/velocity*.jar"/>
<exclude name="**/antlr-3*.jar"/>
</fileset>
</copy>
<copy todir="${target.example.dir}/files" preservelastmodified="true" flatten="true">
<fileset dir="${test.data.dir}/files" includes="*.*" excludes="${vcs.excludes}"/>
</copy>
<copy file="${basedir}/README.txt" todir="${target.dir}">
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy file="${basedir}/NOTICE" todir="${target.dir}"/>
<copy file="${basedir}/LICENSE" todir="${target.dir}"/>
<copy file="${basedir}/RELEASE_NOTES.txt" todir="${target.dir}"/>
<copy todir="${target.example.dir}/queries" preservelastmodified="true" flatten="true">
<fileset dir="${ql.test.query.dir}/positive" includes="*.q" excludes="${vcs.excludes}"/>
</copy>
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${target.bin.dir}"/>
</chmod>
<!-- Package the hcat stuff and pull it up into Hive's build dir -->
<if>
<matches string="${iterate.hive.all}" pattern="hcatalog"/>
<then>
<ant antfile="${hive.root}/hcatalog/build.xml" target="package"
inheritAll="false"/>
<mkdir dir="${target.dir}/hcatalog"/>
<copy todir="${target.dir}/hcatalog">
<fileset dir="${hive.root}/hcatalog/build/hcatalog-${hcatalog.version}"/>
</copy>
</then>
</if>
<!--fix permissions since 'copy' looses them (known ant/Java issue)-->
<if>
<matches string="${iterate.hive.all}" pattern="hcatalog"/>
<then>
<chmod perm="ugo+x" type="file">
<fileset dir="${target.dir}/hcatalog/bin"/>
<fileset dir="${target.dir}/hcatalog/sbin"/>
</chmod>
</then>
</if>
</target>
<!-- ====================================================== -->
<!-- Generate files for eclipse. -->
<!-- ====================================================== -->
<target name="eclipse-files" depends="gen-test"
description="Generate files for Eclipse">
<echo message="Project: ${ant.project.name}"/>
<condition property="hadoop.version.ant-internal" value="0.20">
<not>
<isset property="hadoop.version.ant-internal"/>
</not>
</condition>
<echo message="Using hadoop version ${hadoop.version.ant-internal}"/>
<taskdef name="getversionpref" classname="org.apache.hadoop.hive.ant.GetVersionPref"
classpath="${build.dir.hive}/anttasks/hive-anttasks-${version}.jar"/>
<getversionpref property="hadoop.version.ant-internal.prefix" input="${hadoop.version.ant-internal}"/>
<condition property="jetty.jar" value="jetty-6.1.14.jar" else="jetty-5.1.4.jar">
<matches string="${hadoop.version.ant-internal}" pattern="^0\.20\..*" />
</condition>
<condition property="jetty.util.jar" value="jetty-util-6.1.14.jar" else="jetty-ext/jsp-api.jar">
<!-- hadoop 0.19 and earlier does not have jetty-util.jar, so we just load another jar -->
<matches string="${hadoop.version.ant-internal}" pattern="^0\.20\..*" />
</condition>
<condition property="servlet-api.jar" value="servlet-api-2.5-6.1.14.jar" else="servlet-api.jar">
<matches string="${hadoop.version.ant-internal}" pattern="^0\.20\..*" />
</condition>
<!-- Construct the classpath needed for testutils/hadoop launch script -->
<path id="hive.hadoop.test.classpath">
<fileset dir="${hive.root}/build/ivy/lib/hadoop0.${hadoop.mr.rev}.shim" includes="*.jar" />
<fileset dir="${hive.root}/build/ivy/lib/default" includes="*.jar" excludes="hive*.jar" />
</path>
<property name="hive.hadoop.test.classpath" refid="hive.hadoop.test.classpath"/>
<pathconvert property="eclipse.project">
<path path="${basedir}"/>
<regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes"/>
</pathconvert>
<copy todir="." overwrite="true">
<fileset dir="eclipse-templates">
<exclude name="**/README.txt"/>
<exclude name="${vcs.excludes}"/>
</fileset>
<filterset>
<filtersfile file="${hive.root}/ivy/libraries.properties"/>
<filter token="PROJECT" value="${eclipse.project}"/>
<filter token="HADOOPVER" value="${hadoop.version.ant-internal}"/>
<filter token="HADOOPVERPREF" value="${hadoop.version.ant-internal.prefix}"/>
<filter token="JETTYJAR" value="${jetty.jar}"/>
<filter token="JETTYUTILJAR" value="${jetty.util.jar}"/>
<filter token="SERVLETAPIJAR" value="${servlet-api.jar}"/>
<filter token="HIVE_VERSION" value="${version}"/>
<filter token="HIVE_HADOOP_TEST_CLASSPATH" value="${hive.hadoop.test.classpath}"/>
<filter token="HADOOP_BIN_PATH" value="${hive.root}/testutils/hadoop"/>
<filter token="JVM_ARGS" value="${eclipse.launch.jvm.args}"/>
</filterset>
</copy>
<move todir="." includeemptydirs="false">
<fileset dir=".">
<include name="*.launchtemplate"/>
</fileset>
<mapper type="glob" from="*.launchtemplate" to="*.launch"/>
</move>
</target>
<target name="clean-eclipse-files"
description="Delete files for Eclipse">
<echo message="Project: ${ant.project.name}"/>
<delete includeemptydirs="true">
<fileset dir="." includes=".classpath .project .settings/ .externalToolBuilders/"/>
</delete>
</target>
<!-- ====================================================== -->
<!-- Get Arc-JIRA library. -->
<!-- ====================================================== -->
<target name="arc-setup" description="Get Arc-JIRA library" depends="init">
<get
dest="${build.dir.hive}/arc-jira.tar.gz"
src="https://github.com/facebook/arc-jira/tarball/master"/>
<untar src="${build.dir.hive}/arc-jira.tar.gz" compression="gzip"
dest="${build.dir.hive}">
<patternset>
<include name="facebook-arc-jira-*/arc_jira_lib/**"/>
</patternset>
</untar>
<move todir="${hive.root}">
<fileset dir="${build.dir.hive}">
<include name="facebook-arc-jira-*/arc_jira_lib/**"/>
</fileset>
<mapper type="regexp" from="^facebook-arc-jira-([^/])*/(.*)" to="\.\2"/>
</move>
<delete includeemptydirs="true">
<fileset dir="${build.dir.hive}">
<include name="facebook-arc-jira-*"/>
<include name="arc-jira.tar.gz"/>
</fileset>
</delete>
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="docs" description="Generate documentation" depends="ivy-init-antlib">
<echo message="Project: ${ant.project.name}"/>
<antcall target="docs-anakia"/>
</target>
<target name="javadoc" depends="package" description="Generate Javadoc" unless="skip.javadoc">
<echo message="Project: ${ant.project.name}"/>
<mkdir dir="${build.javadoc}"/>
<javadoc
maxmemory="1024m"
packagenames="org.apache.hadoop.hive.*"
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"
useexternalfile="yes"
>
<packageset dir="ant/src"/>
<packageset dir="hwi/src/java"/>
<packageset dir="hwi/src/test"/>
<packageset dir="common/src/java"/>
<packageset dir="service/src/java"/>
<packageset dir="service/src/test"/>
<packageset dir="service/src/gen/thrift/gen-javabean"/>
<packageset dir="serde/src/java"/>
<packageset dir="serde/src/test"/>
<packageset dir="serde/src/gen/thrift/gen-javabean"/>
<packageset dir="serde/src/gen/protobuf/gen-java"/>
<packageset dir="jdbc/src/java"/>
<packageset dir="jdbc/src/test"/>
<packageset dir="metastore/src/java"/>
<packageset dir="metastore/src/test"/>
<packageset dir="metastore/src/gen/thrift/gen-javabean"/>
<packageset dir="metastore/src/model"/>
<packageset dir="hcatalog/src/java"/>
<packageset dir="cli/src/java"/>
<packageset dir="beeline/src/java"/>
<packageset dir="beeline/src/test"/>
<packageset dir="ql/src/java"/>
<packageset dir="ql/src/test"/>
<packageset dir="ql/src/gen/thrift/gen-javabean"/>
<packageset dir="${build.dir.hive}/ql/gen/antlr/gen-java"/>
<packageset dir="shims/src/common/java"/>
<link href="${javadoc.link.java}"/>
<classpath >
<path refid="classpath" />
<pathelement path="${java.class.path}"/>
<pathelement
path="${build.ivy.lib.dir}/default/hadoop-core-${hadoop-0.20.version}.jar"/>
<pathelement
path="${build.ivy.lib.dir}/default/hadoop-test-${hadoop-0.20.version}.jar"/>
</classpath>
<group title="Hive" packages="org.apache.*"/>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="tar" depends="package, docs, javadoc" description="Make release tarball">
<echo message="Project: ${ant.project.name}"/>
<macro_tar param.destfile="${build.dir.hive}/${tar.final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir.hive}/dist" mode="755" prefix="${tar.final.name}"
excludes="${vcs.excludes}">
<include name="bin/**"/>
</tarfileset>
<tarfileset dir="${build.dir.hive}/dist" mode="755" prefix="${tar.final.name}"
excludes="${vcs.excludes}">
<include name="lib/py/**/*-remote"/>
</tarfileset>
<tarfileset dir="${build.dir.hive}/dist" mode="664" prefix="${tar.final.name}"
excludes="${vcs.excludes}">
<include name="**"/>
<exclude name="bin/**"/>
<exclude name="lib/py/**/*-remote"/>
</tarfileset>
<tarfileset dir="${hive.root}" mode="664" prefix="${tar.final.name}/src"
excludes="${vcs.excludes}">
<exclude name="build/**" />
<exclude name="hcatalog/**/build/**" />
<exclude name="bin/**" />
<exclude name="**/py/**/*-remote" />
<exclude name="data/scripts/**" />
<exclude name="metastore/scripts/**" />
<exclude name="ql/src/test/scripts/**" />
</tarfileset>
<tarfileset dir="${hive.root}" mode="755" prefix="${tar.final.name}/src"
excludes="${vcs.excludes}">
<exclude name="build/**" />
<exclude name="hcatalog/**/build/**" />
<include name="bin/**" />
<include name="**/py/**/*-remote" />
<include name="data/scripts/**" />
<include name="metastore/scripts/**" />
<include name="ql/src/test/scripts/**" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<target name="binary" depends="package, docs, javadoc"
description="Make release tarball without source and documentation">
<echo message="Project: ${ant.project.name}"/>
<macro_tar param.destfile="${build.dir.hive}/${bin.final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir.hive}/dist" mode="755" prefix="${bin.final.name}"
excludes="${vcs.excludes}">
<include name="bin/**"/>
<include name="hcatalog/bin/*"/>
<include name="hcatalog/sbin/*"/>
</tarfileset>
<tarfileset dir="${build.dir.hive}/dist" mode="755" prefix="${bin.final.name}"
excludes="${vcs.excludes}">
<include name="lib/py/**/*-remote"/>
</tarfileset>
<tarfileset dir="${build.dir.hive}/dist" mode="664" prefix="${bin.final.name}"
excludes="${vcs.excludes}">
<include name="**"/>
<exclude name="bin/**"/>
<exclude name="docs/**"/>
<exclude name="lib/py/**/*-remote"/>
<exclude name="hcatalog/bin/*"/>
<exclude name="hcatalog/sbin/*"/>
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- RAT -->
<!-- ================================================================== -->
<target name="ivy-resolve-rat" depends="ivy-init-settings">
<echo message="Project: ${ant.project.name}"/>
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="rat"
log="${ivyresolvelog}"/>
</target>
<target name="ivy-retrieve-rat" depends="ivy-resolve-rat"
description="Retrieve Ivy-managed artifacts for RAT">
<echo message="Project: ${ant.project.name}"/>
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
log="${ivyresolvelog}"/>
<ivy:cachepath pathid="rat-classpath" conf="rat"/>
</target>
<target name="rat" depends="init,ivy-retrieve-rat,check-for-rat"
if="rat.present"
description="Run RAT on source files">
<echo message="Project: ${ant.project.name}"/>
<taskdef uri="antlib:org.apache.rat.anttasks"
resource="org/apache/rat/anttasks/antlib.xml">
<classpath refid="rat-classpath"/>
</taskdef>
<mkdir dir="${rat.build.dir}"/>
<rat:report reportFile="${rat.build.dir}/hive-rat.txt">
<fileset dir=".">
<patternset id="non.build.files">
<exclude name="**/build/**"/>
<exclude name="**/src/gen/**"/>
<exclude name=".arcconfig*"/>
<exclude name=".arc_jira_lib/**"/>
<exclude name="**/*.deflate"/>
<exclude name="**/*.m"/>
<exclude name="**/*.m.out"/>
<exclude name="**/*.q"/>
<exclude name="**/*.q.out"/>
<exclude name="data/files/*.rc"/>
<exclude name="**/test/data/**/*.rc"/>
<exclude name="data/files/*.seq"/>
<exclude name="**/data/files/*.log"/>
<exclude name="**/*.txt"/>
<exclude name="**/test/results/**/*.out"/>
<exclude name="**/test/results/**/*.xml"/>
<exclude name="**/testdata/*.input"/>
<!-- Ignore recordio generated file -->
<exclude name="ql/src/test/org/apache/hadoop/hive/ql/io/RecordTestObj.java"/>
<!-- Ignore thrift generated files -->
<exclude name="service/lib/php/packages/fb303/FacebookService.php"/>
<exclude name="service/lib/php/packages/fb303/fb303_types.php"/>
<exclude name="service/lib/py/fb303/FacebookService-remote"/>
<exclude name="service/lib/py/fb303/FacebookService.py"/>
<exclude name="service/lib/py/fb303/constants.py"/>
<exclude name="service/lib/py/fb303/ttypes.py"/>
<exclude name="service/lib/py/thrift/reflection/limited/constants.py"/>
<exclude name="service/lib/py/thrift/reflection/limited/ttypes.py"/>
</patternset>
</fileset>
</rat:report>
</target>
<target name="check-for-rat">
<echo message="Project: ${ant.project.name}"/>
<available property="rat.present"
resource="org/apache/rat/anttasks/antlib.xml">
<classpath refid="rat-classpath"/>
</available>
</target>
<!-- ================================================================== -->
<!-- Checkstyle -->
<!-- ================================================================== -->
<target name="ivy-resolve-checkstyle" depends="ivy-init-settings">
<echo message="Project: ${ant.project.name}"/>
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="checkstyle"
log="${ivyresolvelog}"/>
</target>
<target name="ivy-retrieve-checkstyle" depends="ivy-resolve-checkstyle"
description="Retrieve Ivy-managed artifacts for the checkstyle configurations">
<echo message="Project: ${ant.project.name}"/>
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
log="${ivyresolvelog}"/>
<ivy:cachepath pathid="checkstyle-classpath" conf="checkstyle"/>
</target>
<target name="checkstyle" depends="init,ivy-retrieve-checkstyle,check-for-checkstyle"
if="checkstyle.present"
description="Run Checkstyle on source files">
<echo message="Project: ${ant.project.name}"/>
<taskdef resource="checkstyletask.properties">
<classpath refid="checkstyle-classpath"/>
</taskdef>
<mkdir dir="${checkstyle.build.dir}"/>
<checkstyle config="${checkstyle.conf.dir}/checkstyle.xml"
failOnViolation="false">
<fileset dir="${hive.root}">
<exclude name="build/**"/>
<exclude name="ant/**"/>
<include name="**/*.java"/>
</fileset>
<formatter type="plain" toFile="${checkstyle.build.dir}/checkstyle-errors.txt"/>
<formatter type="xml" toFile="${checkstyle.build.dir}/checkstyle-errors.xml"/>
</checkstyle>
<xslt style="${checkstyle.conf.dir}/checkstyle-noframes-sorted.xsl"
in="${checkstyle.build.dir}/checkstyle-errors.xml"
out="${checkstyle.build.dir}/checkstyle-errors.html"/>
</target>
<target name="check-for-checkstyle">
<echo message="Project: ${ant.project.name}"/>
<available property="checkstyle.present" resource="checkstyletask.properties">
<classpath refid="checkstyle-classpath"/>
</available>
</target>
<!-- ================================================================== -->
<!-- Findbugs -->
<!-- ================================================================== -->
<target name="ivy-resolve-findbugs" depends="ivy-init-settings">
<echo message="Project: ${ant.project.name}" />
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="findbugs" log="${ivyresolvelog}" />
</target>
<property name="ivy.findbugs.retrieve.pattern" value="[conf]/[artifact].[ext]" />
<target name="ivy-retrieve-findbugs" depends="ivy-resolve-findbugs" description="Retrieve Ivy-managed artifacts for the checkstyle configurations">
<echo message="Project: ${ant.project.name}" />
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" pattern="${build.ivy.lib.dir}/${ivy.findbugs.retrieve.pattern}" log="${ivyresolvelog}" />
</target>
<target name="check-for-findbugs">
<echo message="Project: ${ant.project.name}" />
<path id="findbugs.classpath">
<fileset dir="${build.ivy.lib.dir}/findbugs">
<include name="*.jar" />
</fileset>
</path>
<pathconvert property="findbugs.classpath" refid="findbugs.classpath" />
</target>
<target name="findbugs" depends="init,ivy-retrieve-findbugs,check-for-findbugs" description="Run findbugs on source files">
<echo message="Project: ${ant.project.name}" />
<property name="findbugs.conf.dir" location="${hive.root}/findbugs" />
<property name="findbugs.build.dir" location="${build.dir.hive}/findbugs" />