-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-common.xml
339 lines (289 loc) · 12.5 KB
/
build-common.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
<?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 xmlns:ivy="antlib:org.apache.ivy.ant" name="hivecommon" default="jar">
<property name="hive.root" location="${basedir}/.."/>
<property file="${hive.root}/build.properties"/>
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property name="hive.conf.dir" value="${hive.root}/conf"/>
<property name="dist.dir" location="${hive.root}"/>
<property name="build.dir.hive" location="${hive.root}/build"/>
<property name="build.dir.hadoop" location="${build.dir.hive}/hadoopcore"/>
<property name="build.dir" location="${build.dir.hive}/${ant.project.name}"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.encoding" value="ISO-8859-1"/>
<property name="hadoop.conf.dir" location="${hadoop.root}/conf"/>
<property name="javac.debug" value="on"/>
<property name="javac.version" value="1.5"/>
<property name="javac.optimize" value="on"/>
<property name="javac.deprecation" value="off"/>
<property name="javac.args" value=""/>
<property name="javac.args.warnings" value=""/> <!-- -Xlint:unchecked"/ -->
<!-- configuration needed for tests -->
<property name="test.src.dir" value="${basedir}/src/test"/>
<property name="test.src.data.dir" value="${hive.root}/data"/>
<property name="test.build.dir" value="${build.dir}/test"/>
<property name="test.log.dir" value="${test.build.dir}/logs"/>
<property name="test.data.dir" value="${test.build.dir}/data"/>
<property name="test.build.src" value="${test.build.dir}/src"/>
<property name="test.build.classes" value="${test.build.dir}/classes"/>
<property name="test.include" value="Test*"/>
<property name="test.classpath.id" value="test.classpath"/>
<property name="test.output" value="true"/>
<property name="test.timeout" value="5400000"/>
<property name="test.junit.output.format" value="xml"/>
<property name="test.junit.output.usefile" value="true"/>
<property name="minimr.query.files" value="join1.q,groupby1.q"/>
<property name="test.silent" value="true"/>
<path id="test.classpath">
<pathelement location="${test.build.classes}" />
<pathelement location="" />
<pathelement location="${test.data.dir}/conf"/>
<pathelement location="${hive.conf.dir}"/>
<fileset dir="${hive.root}" includes="testlibs/*.jar"/>
<fileset dir="${hive.root}/lib">
<include name="**/hadoop*.jar" />
<exclude name="**/excluded/" />
</fileset>
<path refid="classpath"/>
</path>
<import file="${hive.root}/ivy/get_ivy.xml"/>
<target name="settings-ivy" depends="init-ivy">
<ivy:settings file="${hive.root}/ivy/ivysettings.xml"/>
</target>
<target name="resolve" description="--> retrieve dependencies with ivy" depends="settings-ivy">
<ivy:retrieve pattern="${build.dir.hadoop}/[artifact]-[revision].[ext]"/>
</target>
<available property="hadoopcore.${hadoop.version.ant-internal}.install.done" file="${build.dir.hadoop}/hadoop-${hadoop.version.ant-internal}.installed"/>
<target name="install-hadoopcore-internal" depends="resolve" unless="hadoopcore.${hadoop.version.ant-internal}.install.done">
<untar src="${build.dir.hadoop}/hadoop-${hadoop.version.ant-internal}.tar.gz" dest="${build.dir.hadoop}" compression="gzip"/>
<chmod file="${hadoop.root}/bin/hadoop" perm="+x"/>
<touch file="${build.dir.hadoop}/hadoop-${hadoop.version.ant-internal}.installed"/>
</target>
<target name="install-hadoopcore-default" unless="hadoop.root.nondefault">
<antcall target="install-hadoopcore-internal"/>
</target>
<target name="install-hadoopcore">
<condition property="hadoop.root.nondefault">
<not>
<equals arg1="${hadoop.root}" arg2="${hadoop.root.default}"/>
</not>
</condition>
<antcall target="install-hadoopcore-default"/>
</target>
<!-- the normal classpath -->
<path id="common-classpath">
<!-- pathelement location="${hadoop.jar}"/-->
<fileset dir="${hive.root}/lib">
<include name="**/hadoop*.jar" />
<exclude name="**/excluded/" />
</fileset>
<pathelement location="${build.dir.hive}/classes"/>
<fileset dir="${build.dir.hive}" includes="*/*.jar"/>
<fileset dir="${hive.root}/lib" includes="*.jar"/>
<fileset dir="${hive.root}/ql/lib" includes="*.jar"/>
</path>
<path id="classpath">
<pathelement location="${build.dir.hive}/service/classes"/>
<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}/ql/classes"/>
<pathelement location="${build.dir.hive}/cli/classes"/>
<pathelement location="${build.dir.hive}/shims/classes"/>
<fileset dir="${basedir}" includes="lib/*.jar"/>
<path refid="common-classpath"/>
</path>
<target name="create-dirs">
<mkdir dir="${build.dir.hive}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.dir.hive}/jexl/classes"/>
<mkdir dir="${build.dir.hadoop}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.src}"/>
<mkdir dir="${test.build.classes}"/>
</target>
<target name="init" depends="create-dirs, deploy-ant-tasks"/>
<target name="test-init">
<mkdir dir="${test.data.dir}"/>
<mkdir dir="${test.log.dir}/clientpositive"/>
<mkdir dir="${test.log.dir}/clientnegative"/>
<mkdir dir="${test.log.dir}/positive"/>
<mkdir dir="${test.log.dir}/negative"/>
<copy todir="${test.data.dir}">
<fileset dir="${test.src.data.dir}">
<exclude name="**/.svn"/>
</fileset>
</copy>
</target>
<target name="setup"/>
<target name="compile" depends="init, install-hadoopcore, setup">
<echo message="Compiling: ${ant.project.name}"/>
<javac
encoding="${build.encoding}"
srcdir="${src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="classpath"/>
</javac>
</target>
<target name="jar" depends="compile">
<echo message="Jar: ${ant.project.name}"/>
<jar
jarfile="${build.dir}/hive_${ant.project.name}.jar"
basedir="${build.classes}">
<manifest>
<!-- Not putting these in their own manifest section, since that inserts
a new-line, which breaks the reading of the attributes. -->
<attribute name="Implementation-Title" value="Hive"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache"/>
</manifest>
</jar>
</target>
<!-- target to compile tests -->
<target name="compile-test" depends="compile">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="org/apache/hadoop/**/*.java"
excludes="**/TestSerDe.java"
destdir="${test.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.classpath"/>
</javac>
<javac
encoding="${build.encoding}"
srcdir="${test.build.src}"
includes="org/apache/hadoop/**/*.java"
destdir="${test.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.classpath"/>
</javac>
</target>
<target name="test-jar" depends="compile-test">
<delete file="${test.build.dir}/test-udfs.jar"/>
<jar jarfile="${test.build.dir}/test-udfs.jar">
<fileset dir="${test.build.classes}" includes="**/udf/*.class"/>
<fileset dir="${test.build.classes}" includes="**/udf/generic/*.class"/>
</jar>
</target>
<target name="test-conditions">
<condition property="qfile" value="${minimr.query.files}">
<and>
<not>
<isset property="qfile"/>
</not>
<equals arg1="${clustermode}" arg2="miniMR" />
</and>
</condition>
<condition property="qfile" value="">
<not>
<isset property="qfile"/>
</not>
</condition>
<condition property="overwrite" value="false">
<not>
<isset property="overwrite"/>
</not>
</condition>
<condition property="standalone" value="false">
<not>
<isset property="standalone"/>
</not>
</condition>
<condition property="clustermode" value="">
<not>
<isset property="clustermode"/>
</not>
</condition>
</target>
<!-- target to deploy anttasks -->
<target name="compile-ant-tasks">
<subant target="compile">
<fileset dir=".." includes="ant/build.xml"/>
</subant>
</target>
<target name="deploy-ant-tasks" depends="compile-ant-tasks">
<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.jar"/>
</target>
<target name="gen-test"/>
<!-- target to run the tests -->
<target name="test"
depends="test-conditions,gen-test,compile-test,test-jar,test-init">
<!--<property name="testcp" refid="test.classpath"/>-->
<!--<echo message="test.classpath: ${testcp}"/>-->
<junit showoutput="${test.output}" printsummary="yes" haltonfailure="no"
fork="yes" maxmemory="512m" dir="${basedir}" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed" filtertrace="off">
<!--
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/> -->
<env key="HADOOP_HOME" value="${hadoop.root}"/>
<env key="TZ" value="US/Pacific"/>
<sysproperty key="test.output.overwrite" value="${overwrite}"/>
<sysproperty key="test.service.standalone.server" value="${standalone}"/>
<sysproperty key="log4j.configuration" value="file://${test.data.dir}/conf/hive-log4j.properties"/>
<sysproperty key="derby.stream.error.file" value="${test.build.dir}/derby.log"/>
<sysproperty key="hive.aux.jars.path" value="file://${test.build.dir}/test-udfs.jar"/>
<sysproperty key="ql.test.query.clientpositive.dir" value="${ql.test.query.clientpositive.dir}"/>
<sysproperty key="ql.test.results.clientpositive.dir" value="${ql.test.results.clientpositive.dir}"/>
<sysproperty key="test.log.dir" value="${test.log.dir}"/>
<sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
<sysproperty key="test.silent" value="${test.silent}"/>
<classpath refid="${test.classpath.id}"/>
<formatter type="${test.junit.output.format}" usefile="${test.junit.output.usefile}" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.build.classes}"
includes="**/${test.include}.class"
excludes="**/TestSerDe.class" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.build.classes}" includes="**/${testcase}.class"/>
</batchtest>
<assertions>
<enable />
</assertions>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="clean-test">
<delete dir="${test.build.dir}"/>
<delete dir="${build.dir.hive}/test"/>
</target>
<target name="clean">
<echo message="Cleaning: ${ant.project.name}"/>
<delete dir="${build.dir}"/>
</target>
</project>