-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.xml
361 lines (297 loc) · 14.4 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
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="gora" default="publish-local-all"
xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="year" value="2011" />
<property name="project.dir" value="${basedir}"/>
<property name="version" value="0.2-incubating" />
<property name="final.name" value="${ant.project.name}-${version}" />
<property name="dist.base.dir" value="${basedir}/dist"/>
<property name="dist.dir" value="${dist.base.dir}/${final.name}"/>
<property name="build.dir" value="${basedir}/build" />
<property name="docs.dir" value="${basedir}/docs" />
<property name="build.docs" value="${build.dir}/docs" />
<property name="build.javadoc" value="${build.docs}/api/" />
<property name="javadoc.link.java" value="http://java.sun.com/javase/6/docs/api/" />
<property name="javadoc.link.hadoop" value="http://hadoop.apache.org/common/docs/r0.20.2/api/" />
<property name="javadoc.link.avro" value="http://avro.apache.org/docs/1.3.3/api/java/" />
<property name="build.javadoc.timestamp" value="${build.javadoc}/index.html" />
<!-- module directories -->
<property name="src.dir" value="src/main/java" />
<property name="conf.dir" value="conf" />
<property name="lib.dir" value="lib" />
<property name="lib-ext.dir" value="lib-ext" />
<property name="build.classes.dir" value="build/classes" />
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- setup ivy default configuration with some custom info -->
<property name="ivy.file" value="ivy.xml" />
<property name="ivy.version" value="2.1.0" />
<property name="ivy.dir" value="${basedir}/ivy" />
<property name="project.ivy.dir" value="${project.dir}/ivy" />
<property name="ivy.jar" location="${project.ivy.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="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local" />
<property name="ivy.local.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.shared.default.root" value="${ivy.default.ivy.user.dir}/shared" />
<property name="ivy.shared.default.ivy.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<property name="ivy.shared.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" />
<!-- target: init ================================================ -->
<target name="init" depends="ivy-init">
<chmod dir="bin" perm="ugo+rx" includes="*.sh, gora"/>
</target>
<!-- target: -buildlist ================================================ -->
<target name="-buildlist" depends="init">
<ivy:buildlist reference="build-path" ivyfilepath="ivy/${ivy.file}">
<fileset dir="." includes="*/build.xml" excludes="build.xml"/>
</ivy:buildlist>
</target>
<target name="compile" depends="-buildlist">
<subant target="compile" buildpathref="build-path" />
</target>
<target name="jar" depends="-buildlist">
<subant target="jar" buildpathref="build-path" />
</target>
<target name="jar-snapshot" depends="-buildlist, jar" description="copies the jar files to append timestamp to artifact name">
<subant target="jar-snapshot" buildpathref="build-path" />
</target>
<target name="compile-test" depends="publish-local-all-test">
</target>
<target name="test-jar" depends="publish-local-all-test"/>
<target name="test-jar-snapshot" depends="test-jar" description="copies the jar files to append timestamp to artifact name">
<subant target="test-jar-snapshot" buildpathref="build-path" />
</target>
<target name="test" depends="publish-local-all-test">
<subant target="test" buildpathref="build-path" />
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<path id="classpath">
<dirset dir=".">
<include name="*/${build.classes.dir}"/>
<include name="*/${conf.dir}"/>
</dirset>
<fileset dir=".">
<include name="**/*.jar" />
</fileset>
</path>
<target name="javadoc-uptodate" depends="compile">
<uptodate property="javadoc.is.uptodate">
<srcfiles dir="${project.dir}/gora-core/${src.dir}">
<include name="**/*.java" />
<include name="**/*.html" />
</srcfiles>
<mapper type="merge" to="${build.javadoc.timestamp}" />
</uptodate>
</target>
<target name="javadoc" description="Generate javadoc" depends="javadoc-uptodate"
unless="javadoc.is.uptodate">
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="gora-core/${src.dir}/overview.html"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="Apache Gora API"
doctitle="Apache Gora API"
bottom="Copyright &copy; ${year} The Apache Software Foundation">
<packageset dir="gora-core/src/main/java"/>
<packageset dir="gora-cassandra/src/main/java"/>
<packageset dir="gora-hbase/src/main/java"/>
<packageset dir="gora-sql/src/main/java"/>
<link href="${javadoc.link.java}"/>
<link href="${javadoc.link.avro}"/>
<link href="${javadoc.link.hadoop}"/>
<classpath refid="classpath"/>
<group title="Core" packages="org.apache.gora.*"/>
<group title="Cassandra Module" packages="org.apache.gora.cassandra.*"/>
<group title="HBase Module" packages="org.apache.gora.hbase.*"/>
<group title="Sql Module" packages="org.apache.gora.sql.*"/>
</javadoc>
</target>
<target name="docs" depends="forrest.check, javadoc" description="Generate forrest-based documentation. To use, specify -Dforrest.home=<base of Apache Forrest installation> on the command line." if="forrest.home">
<exec dir="${docs.dir}" executable="${forrest.home}/bin/forrest" failonerror="true">
<arg value="-Dforrest.validate.xdocs.failonerror=false"/>
<arg value="-Dproject.build-dir=${build.docs}"/>
</exec>
<copy todir="${build.docs}/site/api/" includeEmptyDirs="false">
<fileset dir="${build.javadoc}"/>
</copy>
</target>
<target name="forrest.check" unless="forrest.home">
<fail message="'forrest.home' is not defined. Please pass -Dforrest.home=<base of Apache Forrest installation> to Ant on the command-line." />
</target>
<!-- ================================================================== -->
<!-- Distribution -->
<!-- ================================================================== -->
<target name="package" depends="-buildlist, test-jar"
description="Build distribution">
<subant target="package" buildpathref="build-path" />
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<copy todir="${dist.dir}/ivy">
<fileset dir="ivy">
<exclude name="ivy*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
<include name="*.xml" />
</fileset>
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}/site"/>
</copy>
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}/bin"/>
</chmod>
<!-- modules -->
<copy todir="${dist.dir}/gora-core">
<fileset dir="gora-core/build/gora-core"/>
</copy>
<copy todir="${dist.dir}/gora-cassandra">
<fileset dir="gora-cassandra/build/gora-cassandra"/>
</copy>
<copy todir="${dist.dir}/gora-hbase">
<fileset dir="gora-hbase/build/gora-hbase"/>
</copy>
<copy todir="${dist.dir}/gora-sql">
<fileset dir="gora-sql/build/gora-sql"/>
</copy>
</target>
<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>
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="tar" depends="package" description="Make release tarball">
<macro_tar param.destfile="${dist.base.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${dist.base.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${dist.base.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- Publish Targets -->
<!-- ================================================================== -->
<!-- target: publish-local-all ========================================== -->
<target name="publish-local-all" depends="-buildlist"
description="publish the projects to local ivy repo">
<subant target="publish-local" buildpathref="build-path" />
</target>
<!-- target: publish-local-all-test ===================================== -->
<target name="publish-local-all-test" depends="-buildlist"
description="publish the projects test jars to local ivy repo">
<subant target="publish-local-test" buildpathref="build-path" />
</target>
<!-- target: publish-all ================================================ -->
<target name="publish-all" depends="-buildlist"
description="compile, jar and publish all projects in the right order">
<subant target="publish" buildpathref="build-path" />
</target>
<!-- ================================================================== -->
<!-- Clean Targets -->
<!-- ================================================================== -->
<!-- target: clean-all ================================================ -->
<target name="clean-all" depends="-buildlist" description="clean all projects">
<subant target="clean" buildpathref="build-path" />
</target>
<!-- target: clean ================================================ -->
<target name="clean" depends="clean-all"
description="clean all projects">
<delete includeemptydirs="true" dir="${dist.base.dir}"/>
<delete includeemptydirs="true" dir="${build.dir}"/>
</target>
<!-- target: clean-cache ================================================ -->
<target name="clean-cache" depends=""
description="delete ivy cache">
<ivy:cleancache />
</target>
<!-- ================================================================== -->
<!-- target: clean-docs -->
<!-- ================================================================== -->
<target name="clean-docs">
<delete dir="${build.docs}"/>
</target>
<!-- ================================================================== -->
<!-- Ivy Targets -->
<!-- ================================================================== -->
<!-- target: ivy-init ================================================ -->
<target name="ivy-init" depends="ivy-probe-antlib, ivy-init-antlib">
<ivy:settings file="${project.ivy.dir}/ivysettings.xml" />
</target>
<!-- target: ivy-probe-antlib ======================================== -->
<target name="ivy-probe-antlib">
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</condition>
</target>
<!-- target: ivy-download ============================================ -->
<target name="ivy-download" description="Download ivy">
<available file="${ivy.jar}" property="ivy.jar.found"/>
<antcall target="-ivy-download-unchecked"/>
</target>
<!-- target: ivy-download-unchecked ================================== -->
<target name="-ivy-download-unchecked" unless="ivy.jar.found">
<get src="${ivy.repo.url}" dest="${ivy.jar}" usetimestamp="true" />
</target>
<!-- target: ivy-init-antlib ========================================= -->
<target name="ivy-init-antlib" depends="ivy-download" 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>
</project>