-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.xml
159 lines (132 loc) · 5.14 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Build file for hive-json-serde
February 2010
Peter Sankauskas
-->
<project name="hive-json-serde" default="usage" basedir=".">
<!-- Change this version number when you do a release -->
<property name="version" value="0.3" />
<!-- Local system paths -->
<property name="dir.src" value="${basedir}/src" />
<property name="dir.build" value="${basedir}/build" />
<property name="dir.build.classes" value="${dir.build}/classes" />
<property name="dir.lib" value="${basedir}/lib" />
<property name="dir.test" value="${basedir}/test" />
<property name="dir.test.report" value="${basedir}/test-reports" />
<property name="dir.javadoc" value="${basedir}/../javadoc" />
<property name="jarfile" value="${dir.build}/hive-json-serde.jar" />
<property name="jarfileversioned" value="${dir.build}/hive-json-serde-${version}.jar" />
<!-- Classpath -->
<path id="compile.classpath">
<fileset dir="${dir.lib}">
<include name="**/*.jar" />
</fileset>
<pathelement path="." />
<pathelement path="${dir.build.classes}" />
</path>
<!-- Usage message -->
<target name="usage">
<echo level="info">Usage:</echo>
<echo level="info"> ant build - Compiles this SerDe into a .jar file in the build</echo>
<echo level="info"> directory</echo>
<echo level="info"> ant build.debug - Compiles a debuggable version of this SerDe into a</echo>
<echo level="info"> .jar file in the build directory</echo>
<echo level="info"> ant clean - Remove unnecessary files, and build artifacts</echo>
<echo level="info"> ant javadoc - Creates the JavaDoc</echo>
<echo level="info"> ant runtests - Run all JUnit tests</echo>
<echo level="info"></echo>
<echo level="info">Build directory: ${dir.build}</echo>
<echo level="info">JavaDoc: ${dir.javadoc}</echo>
<echo level="info">JUnit test reports: ${dir.test.report}</echo>
</target>
<!-- Building -->
<target name="prepare">
<tstamp />
<mkdir dir="${dir.build}" />
<mkdir dir="${dir.build.classes}" />
</target>
<target name="compile" depends="prepare" description="Compiles the source">
<!-- First to set a property wins, so debug below works -->
<property name="debug" value="no" />
<javac srcdir="${dir.src}" destdir="${dir.build.classes}"
debug="${debug}" includeantruntime="false">
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="compile.tests" depends="compile" description="Compiles the source of the tests">
<javac srcdir="${dir.test}" destdir="${dir.build.classes}"
debug="true" includeantruntime="false">
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="build" depends="compile">
<jar destfile="${jarfile}">
<fileset dir="${dir.build.classes}" excludes="${dir.build.tests}/**" />
<zipgroupfileset dir="${dir.lib}" includes="**/*.jar" />
</jar>
<copyfile dest="${jarfileversioned}" src="${jarfile}" />
</target>
<target name="build.debug">
<!-- First to set a property wins, so here is where we enable debugging -->
<property name="debug" value="yes" />
<antcall target="compile.tests" />
<copy todir="${dir.build.classes}">
<fileset dir="${dir.src}"/>
</copy>
<antcall target="build" />
</target>
<!-- Cleaning -->
<target name="clean" description="Remove unnecessary files">
<delete dir="${dir.build}" />
<delete dir="${dir.test.report}" />
</target>
<!-- JavaDoc -->
<target name="javadoc"
depends="javadoc-clean"
description="Build JavaDoc in ${dir.javadoc}">
<mkdir dir="${dir.javadoc}" />
<javadoc packagenames="org.apache.hadoop.hive.contrib.*"
sourcepath="${dir.src}"
defaultexcludes="yes"
destdir="${dir.javadoc}"
author="true"
version="true"
use="true"
windowtitle="JSON SerDe for Hive"
classpathref="compile.classpath">
<tag name="todo" scope="all" description="To do:"/>
</javadoc>
</target>
<target name="javadoc-clean" description="Removes JavaDoc files">
<delete dir="${dir.javadoc}" />
</target>
<!-- JUnit tests -->
<target name="runtests" depends="build.debug" description="Run all JUnit tests">
<delete dir="${dir.test.report}" />
<mkdir dir="${dir.test.report}" />
<junit printsummary="withOutAndErr"
fork="yes"
haltonfailure="off"
failureproperty="junit.non.success"
errorproperty="junit.non.success"
dir="${basedir}"
showoutput="yes">
<classpath>
<pathelement location="${dir.build.inst-classes}" />
<pathelement location="${dir.build.classes}" />
<path refid="compile.classpath" />
</classpath>
<formatter type="xml" />
<test name="org.apache.hadoop.hive.contrib.serde2.AllTests"
todir="${dir.test.report}" />
</junit>
<junitreport todir="${dir.test.report}">
<fileset dir="${dir.test.report}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes" styledir="${dir.test}" todir="${dir.test.report}" />
</junitreport>
<fail if="junit.non.success">JUnit Tests FAILED</fail>
</target>
</project>