forked from djktno/cascading.mongodb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
218 lines (160 loc) · 7.32 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
<?xml version="1.0"?>
<!--
~ Copyright (c) 2010 djktno.
~
~ This build file heavily borrows from cascading-jdbc build.xml, (c) 2009 Concurrent, Inc.
~ which has been released via Creative Commons Attribution-Share Alike 3.0,
~ http://creativecommons.org/licenses/by-sa/3.0/us/
~
~ This was done specifically to simplify usage of this module for users
~ of other cascading modules, as it retains the same usage patterns and similar dependencies.
-->
<project name="cascading-mongodb" default="build" basedir=".">
<!-- load properties first -->
<property file="${user.home}/.${ant.project.name}.build.properties" />
<property file="${basedir}/build.properties"/>
<property file="${basedir}/version.properties"/>
<property name="cascading.mongodb.version" value="x.y.z"/>
<!-- these are optional, only used if you uncomment the project.class.path filesets below -->
<property name="hadoop.home" location="${basedir}/../hadoop"/>
<property name="hadoop.lib" location="${hadoop.home}/lib"/>
<!-- assumes Cascading shares the same parent directory, change if necessary -->
<property name="cascading.home" location="${basedir}/../cascading"/>
<property file="${cascading.home}/version.properties"/>
<property name="cascading.release.version" value="x.y.z"/>
<property name="cascading.filename.core" value="cascading-core-${cascading.release.version}.jar"/>
<property name="cascading.filename.xml" value="cascading-xml-${cascading.release.version}.jar"/>
<property name="cascading.filename.test" value="cascading-test-${cascading.release.version}.jar"/>
<property name="cascading.libs" value="${cascading.home}/lib"/>
<property name="cascading.libs.core" value="${cascading.libs}"/>
<property name="cascading.libs.xml" value="${cascading.libs}/xml"/>
<condition property="cascading.path" value="${cascading.home}/"
else="${cascading.home}/build">
<available file="${cascading.home}/${cascading.filename.core}"/>
</condition>
<property name="mongo.driver.home" location="${basedir}/../mongo-java-driver"/>
<property file="${mongo.driver.home}/version.properties"/>
<property name="mongo.release.version" value="x.y.z"/>
<property name="mongo.filename.core" value="mongo.jar"/>
<property name="bson.filename.core" value="bson.jar"/>
<condition property="mongo.path" value="${mongo.driver.home}/"
else="${mongo.driver.home}/build">
<available file="${mongo.driver.home}/${mongo.filename.core}"/>
</condition>
<property name="cascading.lib.core" value="${cascading.path}/${cascading.filename.core}"/>
<property name="cascading.lib.xml" value="${cascading.path}/${cascading.filename.xml}"/>
<property name="cascading.lib.test" value="${cascading.path}/${cascading.filename.test}"/>
<property name="mongo.lib" value="${mongo.path}/${mongo.filename.core}"/>
<property name="bson.lib" value="${mongo.path}/${bson.filename.core}"/>
<property name="src.dir" location="${basedir}/src/java"/>
<property name="src.test" location="${basedir}/src/test"/>
<available file="${src.dir}" type="dir" property="main.available"/>
<available file="${src.test}" type="dir" property="test.available"/>
<property name="conf.dir" location="${hadoop.home}/conf"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="build.dir" location="${basedir}/build/"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="test.results" location="${build.dir}/results"/>
<property name="javac.debug" value="true"/>
<property name="dist" location="dist"/>
<path id="project.class.path">
<pathelement location="${build.classes}"/>
<pathelement location="${build.test}"/>
<pathelement location="${cascading.lib.core}"/>
<pathelement location="${cascading.lib.test}"/>
<pathelement location="${mongo.lib}"/>
<pathelement location="${bson.lib}"/>
<fileset dir="${cascading.libs}">
<include name="**/*.jar"/>
</fileset>
<!--<fileset dir="${lib.dir}">-->
<!--<include name="*.jar"/>-->
<!--</fileset>-->
<fileset dir="${hadoop.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${hadoop.home}/build" erroronmissingdir="false">
<include name="*.jar"/>
</fileset>
<fileset dir="${hadoop.lib}">
<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="build">
<echo message="building..."/>
<echo message="using cascading lib: ${cascading.lib.core}"/>
<echo message="using mongo-driver lib: ${mongo.lib}" />
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.test}"/>
<mkdir dir="${lib.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.classes}" verbose="off" debug="${javac.debug}">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
<javac srcdir="${src.test}" destdir="${build.test}" verbose="off" debug="${javac.debug}">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${build.test}">
<fileset dir="${src.test}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="jar" depends="build" description="creates module jar">
<jar jarfile="${build.dir}/${ant.project.name}-${cascading.mongodb.version}.jar">
<fileset dir="${build.classes}"/>
</jar>
</target>
<target name="test" depends="build">
<echo message="running all tests..."/>
<mkdir dir="${test.results}"/>
<mkdir dir="build/test/log"/>
<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="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>
<target name="dist" depends="clean" description="packages current project">
<mkdir dir="${dist}"/>
<copy todir="${dist}">
<fileset dir=".">
<include name="src/**"/>
<include name="build.xml"/>
<include name="README.txt"/>
</fileset>
</copy>
</target>
<target name="tar" depends="dist" description="creates an archive of current project">
<tar destfile="${ant.project.name}.tgz"
compression="gzip">
<tarfileset dir="dist/" prefix="${ant.project.name}">
<include name="**/**"/>
</tarfileset>
</tar>
</target>
</project>