-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
276 lines (215 loc) · 9.23 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
<?xml version="1.0"?>
<!--
~ Copyright (c) 2007-2011 Concurrent, Inc. All Rights Reserved.
~
~ Project and contact information: http://www.cascading.org/
~
~ This file is part of the Cascading project.
~
~ Cascading is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ Cascading is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Cascading. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="cascading.load" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<dirname property="load.basedir" file="${ant.file.load}"/>
<!-- load properties first -->
<property file="../build.properties"/>
<property file="./build.properties"/>
<property name="src.license" location="${load.basedir}/LICENSE.txt"/>
<property name="src.dir" location="${load.basedir}/src/java"/>
<property name="src.resource" location="${load.basedir}/src/resource"/>
<property name="src.test" location="${load.basedir}/src/test"/>
<available file="${src.dir}" type="dir" property="main.available"/>
<available file="${src.test}" type="dir" property="test.available"/>
<property name="lib.dir" location="${load.basedir}/lib"/>
<property name="scripts.dir" location="${load.basedir}/bin"/>
<property name="build.dir" location="${load.basedir}/build/"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="build.deps" location="${build.dir}/deps"/>
<property name="test.results" location="${build.dir}/testresults"/>
<property name="test.showoutput" value="no"/>
<property name="dist" location="dist"/>
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${build.test}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${build.deps}">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean">
<echo message="cleaning..."/>
<delete dir="${build.dir}"/>
<delete dir="${dist}"/>
<delete dir="${ant.project.name}.tgz"/>
</target>
<target name="compile">
<echo message="building..."/>
<mkdir dir="${build.classes}"/>
<javac srcdir="${src.dir}" destdir="${build.classes}" verbose="off" debug="true" includeantruntime="false">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.dir}">
<exclude name="**/*.java"/>
</fileset>
<fileset dir="${src.resource}">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy file="${src.license}" tofile="${build.classes}/LOAD-LICENSE.txt"/>
</target>
<target name="compile-test">
<echo message="building..."/>
<mkdir dir="${build.test}"/>
<mkdir dir="${lib.dir}"/>
<javac srcdir="${src.test}" destdir="${build.test}" verbose="off" includeantruntime="false">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.test}">
<fileset dir="${src.test}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<!-- runs roundup.sh test plans -->
<target name="sh-test" description="run the shell unit test plans">
<exec executable="/bin/sh" failonerror="true">
<arg value="${src.test}/sh/helper/roundup.sh"/>
<arg value="${src.test}/sh/core/*_test.sh"/>
<arg value="${src.test}/sh/cascading/*_test.sh"/>
<arg value="${src.test}/sh/*_test.sh"/>
</exec>
</target>
<!-- runs JUnit tests -->
<target name="test" depends="compile,compile-test,sh-test" description="run the unit tests">
<echo message="running all tests..."/>
<mkdir dir="build/test/log"/>
<mkdir dir="${test.results}"/>
<junit printsummary="true" showoutput="${test.showoutput}" fork="yes" haltonerror="no" haltonfailure="no" dir="."
maxmemory="756m">
<sysproperty key="test.cluster.enabled" value="${test.cluster.enabled}"/>
<sysproperty key="test.build.data" value="${log.data}"/>
<sysproperty key="hadoop.log.dir" value="build/test/log"/>
<!--<jvmarg value="-Xdebug"/>--><!--<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"/>-->
<classpath>
<path refid="project.class.path"/>
<pathelement path="${java.class.path}"/>
</classpath>
<formatter type="plain" usefile="true"/>
<test name="${testcase}" todir="${test.results}" if="testcase" haltonfailure="${test.haltonerror}"/>
<batchtest todir="${test.results}" haltonfailure="${test.haltonerror}" unless="testcase">
<fileset dir="${src.test}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<tstamp/>
<target name="stamp-jar" depends="jar">
<move file="${build.dir}/${ant.project.name}.jar"
tofile="${build.dir}/${ant.project.name}-${DSTAMP}.jar"/>
</target>
<target name="jar" depends="compile" description="creates a Hadoop ready jar will all dependencies">
<tstamp>
<format property="TIMESTAMP" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<jar jarfile="${build.dir}/${ant.project.name}.jar">
<fileset dir="${build.classes}"/>
<fileset dir="${load.basedir}" includes="lib/"/>
<manifest>
<attribute name="Main-Class" value="${ant.project.name}/Main"/>
<attribute name="Build-Date" value="${TIMESTAMP}"/>
</manifest>
</jar>
</target>
<target name="dist" depends="clean,retrieve,jar,stamp-jar" description="packages current project">
<mkdir dir="${dist}"/>
<copy todir="${dist}">
<fileset dir=".">
<include name="bin/**"/>
<include name="data/**"/>
<include name="bin/**"/>
<include name="README.txt"/>
</fileset>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
</copy>
<copy file="${src.license}" tofile="${dist}/LICENSE.txt"/>
<chmod perm="u+x">
<fileset dir="${dist}/bin">
<include name="**"/>
</fileset>
</chmod>
</target>
<target name="tar" depends="dist" description="creates an archive of current project">
<tar destfile="${ant.project.name}-${DSTAMP}.tgz"
compression="gzip">
<tarfileset dir="dist/" prefix="${ant.project.name}-${DSTAMP}">
<include name="**/**"/>
<exclude name="bin/**"/>
</tarfileset>
<tarfileset dir="dist/" prefix="${ant.project.name}-${DSTAMP}" filemode="744">
<include name="bin/**"/>
</tarfileset>
</tar>
</target>
<target name="s3-package" if="package.remote.bucket">
<taskdef name="S3Upload" classname="dak.ant.taskdefs.S3Upload"/>
<property file="${package.aws.properties}"/>
<echo message="http://${package.remote.bucket}/cascading.load/${ant.project.name}-${DSTAMP}.tgz"
file="${ant.project.name}-current.txt"/>
<S3Upload verbose="true"
accessId="${package.aws.accessId}"
secretKey="${package.aws.secretKey}"
bucket="${package.remote.bucket}"
prefix="${ant.project.name}/"
publicRead="true">
<fileset file="${ant.project.name}-${DSTAMP}.tgz"/>
<fileset file="${ant.project.name}-current.txt"/>
</S3Upload>
<property name="package.remote.port" value="22"/>
<scp file="${ant.project.name}-current.txt"
remoteTofile="${package.remote.path}/${ant.project.name}/${ant.project.name}-${DSTAMP}.tgz"
keyfile="${package.remote.keyfile}"
passphrase="" port="${package.remote.port}" trust="true"/>
<delete file="${ant.project.name}-current.txt"/>
</target>
<target name="s3-jar" if="jar.remote.bucket">
<taskdef name="S3Upload" classname="dak.ant.taskdefs.S3Upload"/>
<property file="${package.aws.properties}"/>
<echo message="http://${jar.remote.bucket}/load/1.2/${ant.project.name}-${DSTAMP}.jar"
file="latest.txt"/>
<S3Upload verbose="true"
accessId="${package.aws.accessId}"
secretKey="${package.aws.secretKey}"
bucket="${jar.remote.bucket}"
prefix="load/1.2/"
publicRead="true">
<fileset file="build/${ant.project.name}-${DSTAMP}.jar"/>
<fileset file="latest.txt"/>
</S3Upload>
<delete file="latest.txt"/>
</target>
<target name="publish" depends="clean,retrieve,test,tar,s3-package,s3-jar"/>
<target name="retrieve">
<ivy:settings id="ivy.conjars.settings" url="http://conjars.org/repo/ivysettings.xml"/>
<ivy:retrieve file="${load.basedir}/ivy.xml" settingsRef="ivy.conjars.settings" conf="default"
pattern="${lib.dir}/[artifact]-[revision].[ext]" sync="true"/>
<ivy:retrieve file="${load.basedir}/ivy.xml" settingsRef="ivy.conjars.settings" conf="test"
pattern="${build.dir}/deps/[artifact]-[revision].[ext]" sync="true"/>
</target>
</project>