forked from aseldawy/spatialhadoop2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
291 lines (247 loc) · 10.5 KB
/
build.xml
File metadata and controls
291 lines (247 loc) · 10.5 KB
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
<!--
Copyright (c) 2015 by Regents of the University of Minnesota.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Apache License, Version 2.0 which
accompanies this distribution and is available at
http://www.opensource.org/licenses/apache2.0.php.
-->
<project name="SpatialHadoop" default="compile1" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Compiles SpatialHadoop and builds packages to be installed on an existing Hadoop cluster</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="res" location="res"/>
<property name="doc" location="doc"/>
<property name="bin1" location="bin1"/>
<property name="bin2" location="bin2"/>
<property name="build1" location="${bin1}/classes"/>
<property name="dist1" location="${bin1}/dist"/>
<property name="build2" location="${bin2}/classes"/>
<property name="dist2" location="${bin2}/dist"/>
<property name="version" value="2.4-rc1"/>
<path id="other.path.ref">
<fileset dir="lib" includes="*.jar"/>
</path>
<path id="common.lib.path.ref">
<fileset dir="lib/ivy/common" includes="*.jar"/>
</path>
<path id="hadoop1.lib.path.ref">
<fileset dir="lib/ivy/hadoop1" includes="*.jar"/>
</path>
<path id="hadoop2.lib.path.ref">
<fileset dir="lib/ivy/hadoop2" includes="*.jar"/>
</path>
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="lib/ivy/[conf]/[artifact]-[revision].[ext]" />
</target>
<target name="init1" depends="resolve">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build1}"/>
</target>
<target name="init2" depends="resolve">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build2}"/>
</target>
<target name="compile1" depends="init1"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build1}"
classpath="${toString:other.path.ref}:${toString:common.lib.path.ref}:${toString:hadoop1.lib.path.ref}"
target="1.6" source="1.6" debug="true" debuglevel="lines,vars,source"/>
<copy todir="${build1}">
<fileset dir="${res}">
<include name="spatial-default.xml"/>
<include name="zoom_view.html"/>
<include name="gistic_logo.png"/>
<include name="gistic_logo_license.txt"/>
<include name="webapps/**/*"/>
</fileset>
</copy>
</target>
<target name="compile2" depends="init2"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build2}"
classpath="${toString:other.path.ref}:${toString:common.lib.path.ref}:${toString:hadoop2.lib.path.ref}"
target="1.6" source="1.6" debug="true" debuglevel="lines,vars,source"/>
<copy todir="${build2}">
<fileset dir="${res}">
<include name="spatial-default.xml"/>
<include name="zoom_view.html"/>
<include name="gistic_logo.png"/>
<include name="gistic_logo_license.txt"/>
<include name="webapps/**/*"/>
</fileset>
</copy>
</target>
<target name="doc" depends="init1"
description="Generates JavaDoc for the source code">
<mkdir dir="${doc}"/>
<javadoc sourcepath="${src}" destdir="${doc}"/>
</target>
<target name="dist1" depends="compile1"
description="generate the distribution for Hadoop 1.x" >
<!-- Create the distribution directory -->
<mkdir dir="${dist1}"/>
<!-- Put everything in ${build} into the spatialhadoop-${version}.jar file -->
<jar jarfile="${dist1}/spatialhadoop-${version}.jar" basedir="${build1}">
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="edu.umn.cs.spatialHadoop.operations.Main"/>
</manifest>
</jar>
<!-- For backward compatibility, provide a jar that contains just the main class-->
<jar jarfile="${dist1}/spatialhadoop-main.jar">
<fileset dir="${build1}" includes="edu/umn/cs/spatialHadoop/operations/Main.class"/>
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="edu.umn.cs.spatialHadoop.operations.Main"/>
</manifest>
</jar>
</target>
<target name="dist2" depends="compile2"
description="generate the distribution for Hadoop 2.x" >
<!-- Create the distribution directory -->
<mkdir dir="${dist2}"/>
<!-- Put everything in ${build} into the spatialhadoop-${version}.jar file -->
<jar jarfile="${dist2}/spatialhadoop-${version}.jar" basedir="${build2}">
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="edu.umn.cs.spatialHadoop.operations.Main"/>
</manifest>
</jar>
<!-- For backward compatibility, provide a jar that contains just the main class-->
<jar jarfile="${dist2}/spatialhadoop-main.jar">
<fileset dir="${build2}" includes="edu/umn/cs/spatialHadoop/operations/Main.class"/>
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="edu.umn.cs.spatialHadoop.operations.Main"/>
</manifest>
</jar>
</target>
<target name="emr-jar1" depends="dist1"
description="Creates a JAR file that can run on Amazon EMR for Hadoop 1.x">
<zip destfile="${dist1}/spatialhadoop-${version}-emr.jar">
<zipgroupfileset dir="lib/ivy/common">
<include name="esri-geometry-api-*.jar"/>
<exclude name="*sources.jar"/>
<exclude name="*javadoc.jar"/>
<include name="jts-*.jar"/>
</zipgroupfileset>
<zipgroupfileset dir="${dist1}" includes="spatialhadoop-${version}.jar"/>
</zip>
</target>
<target name="emr-jar2" depends="dist2"
description="Creates a JAR file that can run on Amazon EMR for Hadoop 2.x">
<zip destfile="${dist2}/spatialhadoop-${version}-emr.jar">
<zipgroupfileset dir="lib/ivy/common">
<include name="esri-geometry-api-*.jar"/>
<exclude name="*sources.jar"/>
<exclude name="*javadoc.jar"/>
<include name="jts-*.jar"/>
</zipgroupfileset>
<zipgroupfileset dir="${dist2}" includes="spatialhadoop-${version}.jar"/>
</zip>
</target>
<target name="package1" depends="dist1"
description="create a package files for the distribution">
<!-- Create the package directory -->
<mkdir dir="${dist1}/package"/>
<!-- Build the tar file -->
<tar destfile="${dist1}/package/spatialhadoop-${version}.tar.gz"
compression="gzip">
<tarfileset dir=".">
<include name="README.md"/>
<include name="LICENSE.txt"/>
</tarfileset>
<tarfileset dir="${res}" filemode="755">
<include name="bin/shadoop"/>
</tarfileset>
<tarfileset dir="${res}">
<include name="webapps/**"/>
<include name="conf/spatial-site.xml"/>
</tarfileset>
<tarfileset file="${toString:other.path.ref}" prefix="share/hadoop/common/lib/"/>
<tarfileset dir="lib/ivy/common" prefix="lib/">
<include name="esri-geometry-api-*.jar"/>
<exclude name="*sources.jar"/>
<exclude name="*javadoc.jar"/>
<include name="jts-*.jar"/>
</tarfileset>
<tarfileset dir="${dist1}" prefix="lib/">
<include name="spatialhadoop-${version}.jar"/>
</tarfileset>
<tarfileset dir="${dist1}">
<include name="spatialhadoop-main.jar"/>
</tarfileset>
</tar>
</target>
<!-- Build targets for Hadoop 2 -->
<target name="package2" depends="dist2">
<!-- Build the tar file -->
<tar destfile="${dist2}/package/spatialhadoop-${version}-2.tar.gz"
compression="gzip">
<tarfileset dir=".">
<include name="README.md"/>
<include name="LICENSE.txt"/>
</tarfileset>
<tarfileset dir="${res}" filemode="755">
<include name="bin/shadoop"/>
</tarfileset>
<tarfileset dir="${res}" prefix="etc/hadoop">
<include name="conf/spatial-site.xml"/>
</tarfileset>
<tarfileset dir="${res}" prefix="hadoop/hdfs/webapps/hdfs">
<include name="webapps/**"/>
</tarfileset>
<tarfileset file="${toString:other.path.ref}" prefix="share/hadoop/common/lib/"/>
<tarfileset dir="lib/ivy/common" prefix="share/hadoop/common/lib/">
<include name="esri-geometry-api-*.jar"/>
<exclude name="*sources.jar"/>
<exclude name="*javadoc.jar"/>
<include name="jts-*.jar"/>
</tarfileset>
<tarfileset dir="${dist2}" prefix="share/hadoop/common/lib/">
<include name="spatialhadoop-${version}.jar"/>
</tarfileset>
<tarfileset dir="${dist2}">
<include name="spatialhadoop-main.jar"/>
</tarfileset>
</tar>
</target>
<!-- Check whether the target hadoop.dir is of version 1 or 2 -->
<condition property="hadoop1">
<available file="${hadoop.dir}/conf/hadoop-env.sh"/>
</condition>
<condition property="hadoop2">
<available file="${hadoop.dir}/etc/hadoop/hadoop-env.sh"/>
</condition>
<target name="install1" depends="package1" if="hadoop1"
description="Install SpatialHadoop on an existing Hadoop installation">
<echo message="Installing on a Hadoop 1.x installation"/>
<!-- Extract the constructed package file (tar) in the destination directory -->
<untar src="${dist1}/package/spatialhadoop-${version}.tar.gz"
dest="${hadoop.dir}" compression="gzip"/>
</target>
<target name="install2" depends="package2" if="hadoop2"
description="Install SpatialHadoop on an existing Hadoop 2 installation">
<echo message="Installing on a Hadoop 2.x installation"/>
<!-- Extract the constructed package file (tar) in the destination directory -->
<untar src="${dist2}/package/spatialhadoop-${version}-2.tar.gz"
dest="${hadoop.dir}" compression="gzip"/>
</target>
<target name="install" depends="install1,install2">
<!-- Set executable permissions explicitly as untar does not support it -->
<!-- See https://issues.apache.org/bugzilla/show_bug.cgi?id=36361 -->
<chmod file="${hadoop.dir}/bin/shadoop" perm="755"/>
</target>
<target name="clean" description="clean up" >
<!-- Delete the binary directory trees -->
<delete dir="${bin1}"/>
<delete dir="${bin2}"/>
<delete dir="lib/ivy"/>
</target>
</project>