-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbuild.xml
More file actions
357 lines (306 loc) · 14.2 KB
/
build.xml
File metadata and controls
357 lines (306 loc) · 14.2 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
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
<?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.
By default, ant will compile the core engine and some built-in examples.
The final output includes termite-core-0.1.jar and termite-examples-0.1.jar
in the directory ${basedir}/build.
-->
<project name="hama" default="all.jar">
<property name="system" value="termite" />
<property name="version" value="0.1" />
<property name="year" value="2015" />
<!-- names of output jar -->
<property name="core.name" value="${system}-core-${version}" />
<property name="examples.name" value="${system}-examples-${version}" />
<property name="examples.mainclass.name" value="hybridgraph/examples/driver/ExampleDriver" />
<!-- 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}/${name}.build.properties" />
<property file="${basedir}/build.properties" />
<property name="src.dir" location="${basedir}/src/java" />
<property name="src.test" location="${basedir}/src/test" />
<property name="src.examples" location="${basedir}/src/examples" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="conf.dir" value="${basedir}/conf" />
<property name="docs.dir" value="${basedir}/docs" />
<property name="docs.src" value="${basedir}/src/docs" />
<!-- build properties -->
<property name="test.output" value="no" />
<property name="test.timeout" value="600000" />
<property name="build.dir" location="${basedir}/build" />
<property name="build.lib" location="${build.dir}/lib" />
<property name="build.classes" location="${build.dir}/classes" />
<property name="build.test" location="${build.dir}/test" />
<property name="build.examples" location="${build.dir}/examples" />
<property name="build.docs" value="${build.dir}/docs/site" />
<property name="build.javadoc" value="${build.docs}/api" />
<property name="build.encoding" value="ISO-8859-1" />
<property name="build.src" value="${build.dir}/src" />
<property name="build.report" value="${build.dir}/reports" />
<property name="build.report.findbugs" value="${build.report}/findbugs" />
<property name="build.report.tests" value="${build.report}/tests" />
<property name="test.build.dir" value="${build.dir}/test" />
<property name="test.junit.output.format" value="plain" />
<property name="dist.dir" value="${build.dir}/${final.name}" />
<property name="javac.deprecation" value="off" />
<property name="javac.debug" value="on" />
<property name="javadoc.link.java" value="http://download.oracle.com/javase/6/docs/api/" />
<property name="javadoc.packages" value="org.apache.hama.*" />
<fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar" />
<path id="classpath">
<fileset refid="lib.jars" />
<fileset dir="${lib.dir}/findbugs/">
<include name="*.jar" />
</fileset>
<pathelement location="${build.classes}" />
<pathelement location="${conf.dir}" />
</path>
<taskdef name="findbugs" classpathref="classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.test}" />
<mkdir dir="${build.examples}" />
<mkdir dir="${build.report.findbugs}" />
<mkdir dir="${build.report.tests}" />
<!--Copy bin, lib, and conf. too-->
<mkdir dir="${build.lib}" />
<copy todir="${build.lib}">
<fileset dir="${lib.dir}" />
</copy>
<tempfile property="touch.temp.file" destDir="${java.io.tmpdir}"/>
<touch millis="0" file="${touch.temp.file}">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<delete file="${touch.temp.file}"/>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
<mkdir dir="${build.examples}/hybridgraph" />
</target>
<!-- ================================================================== -->
<!-- Java Compiler Compiler, generate Parsers -->
<!-- ================================================================== -->
<target name="compile-core" depends="init">
<!-- Compile core java files -->
<mkdir dir="${build.src}" />
<javac encoding="${build.encoding}" srcdir="${src.dir};${build.src}" includes="**/*.java" destdir="${build.classes}" debug="${javac.debug}" deprecation="${javac.deprecation}" includeantruntime="false">
<classpath refid="classpath" />
</javac>
</target>
<target name="compile-examples" depends="compile-core">
<javac encoding="${build.encoding}" srcdir="${src.examples}" includes="**/*.java" destdir="${build.examples}" debug="${javac.debug}" deprecation="${javac.deprecation}" includeantruntime="false">
<classpath refid="classpath" />
</javac>
</target>
<!-- Override jar target to specify main class -->
<target name="core.jar" depends="compile-core">
<jar jarfile="${build.dir}/${core.name}.jar" basedir="${build.classes}">
</jar>
</target>
<target name="examples.jar" depends="compile-examples" description="Make the examples jar.">
<jar jarfile="${build.dir}/${examples.name}.jar" basedir="${build.examples}">
<manifest>
<attribute name="Main-Class" value="${examples.mainclass.name}" />
</manifest>
</jar>
</target>
<target name="all.jar" depends="core.jar,examples.jar" description="Make the core jar and examples jar.">
</target>
<target name="package" depends="core.jar,javadoc,examples.jar,compile-test" description="Build distribution">
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="true">
<fileset dir="${build.dir}">
<include name="${core.name}.jar" />
<include name="${examples.name}.jar" />
<include name="${core.name}-test.jar" />
</fileset>
</copy>
<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}/lib">
<fileset dir="${build.lib}" />
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
<copy todir="${dist.dir}/" file="pom.xml"/>
<mkdir dir="${dist.dir}/src" />
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
<fileset dir="src" excludes="**/*.template **/docs/build/**/*" />
</copy>
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}/bin"/>
</chmod>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<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>
<target name="tar" depends="package" description="Make release tarball">
<macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<target name="binary" depends="package" description="Make tarball without source and documentation">
<macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<exclude name="${final.name}/src/**" />
<exclude name="${final.name}/docs/**" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- Doc -->
<!-- ================================================================== -->
<target name="docs" depends="forrest.check" 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.src}" executable="${forrest.home}/bin/forrest" failonerror="true">
</exec>
<copy todir="${build.docs}">
<fileset dir="${docs.src}/build/site/" />
</copy>
<delete dir="${docs.src}/build/" />
</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>
<!-- javadoc-classpath -->
<!-- This is going to stay back until we use a mechanism for automatic dependency management -->
<path id="javadoc-classpath">
<fileset file="${lib.dir}/hadoop*.jar" />
<fileset file="${lib.dir}/zookeeper*.jar" />
<fileset file="${lib.dir}/commons*.jar" />
<fileset file="${lib.dir}/log4j*.jar" />
<fileset file="${lib.dir}/junit-3.8.1.jar" />
</path>
<!-- Javadoc -->
<target name="javadoc" description="Generate javadoc">
<mkdir dir="${build.javadoc}" />
<javadoc overview="${src.dir}/overview.html" packagenames="org.apache.hama.*" 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">
<packageset dir="${src.dir}">
<include name="org/apache/**" />
</packageset>
<link href="${javadoc.link.java}" />
<classpath>
<path refid="javadoc-classpath" />
</classpath>
<group title="${Name}" packages="org.apache.hama.*" />
</javadoc>
</target>
<!-- Javadoc with UML diagrams -->
<target name="javadocs" depends="compile-core">
<javadoc sourcepath="${src.dir}" packagenames="org.apache.hama.*" destdir="${build.javadoc}" private="true">
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="${lib.dir}/UmlGraph.jar">
<param name="-inferrel" />
<param name="-inferdep" />
<param name="-hide" value="java.*" />
<param name="-collpackages" value="java.util.*" />
<param name="-qualify" />
<param name="-postfixpackage" />
<param name="-nodefontsize" value="9" />
<param name="-nodefontpackagesize" value="7" />
<param name="-link" value="http://download.oracle.com/javase/1.6.0/docs/guide/javadoc/doclet/spec/" />
<param name="-link" value="http://download.oracle.com/javase/1.6/docs/api" />
</doclet>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<path id="test.classpath">
<pathelement location="${conf.dir}" />
<pathelement location="${src.test}" />
<pathelement location="${build.test}" />
<path refid="classpath" />
<pathelement location="${build.dir}" />
</path>
<target name="compile-test" depends="compile-core">
<javac encoding="${build.encoding}" srcdir="${src.test}" includes="**/*.java" destdir="${build.test}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="test.classpath" />
</javac>
<jar jarfile="${build.dir}/${final.name}-test.jar">
<fileset dir="${build.test}" includes="org/**" />
<fileset dir="${build.classes}" />
<fileset dir="${src.test}" includes="**/*.properties" />
<manifest>
<attribute name="Main-Class" value="org/apache/hama/Utils" />
</manifest>
</jar>
</target>
<target name="test" depends="compile-core, compile-test">
<junit printsummary="yes" showoutput="${test.output}" haltonfailure="no" fork="yes" maxmemory="512m" errorProperty="tests.failed" failureProperty="tests.failed" timeout="${test.timeout}">
<classpath refid="test.classpath" />
<formatter type="${test.junit.output.format}" />
<batchtest todir="${build.report.tests}" unless="testcase">
<fileset dir="${src.test}" includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${build.report.tests}" if="testcase">
<fileset dir="${src.test}" includes="**/${testcase}.java" excludes="**/${test.exclude}.java" />
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="findbugs" depends="init, core.jar">
<findbugs home="${lib.dir}/findbugs" output="xml" outputFile="${build.report.findbugs}/hama-findbugs.xml" excludeFilter="${conf.dir}/findbugs-exclude-filter.xml" auxClasspathRef="classpath">
<sourcePath path="${src.dir}" />
<class location="${build.dir}/${final.name}.jar" />
</findbugs>
</target>
<target name="report" depends="findbugs,test">
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>