-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
executable file
·384 lines (346 loc) · 17.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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<?xml version="1.0" encoding="UTF-8"?>
<project name="interferom " default="dist-war" basedir=".">
<property environment="env"/>
<property name="app.name" value="interferome"/>
<property name="src.java.dir" value="src/java"/>
<property name="utest.java.dir" value="utest/java"/>
<property name="src.web.dir" value="src/webapp"/>
<property name="etc.dir" value="etc"/>
<property name="conf.dir" value="conf"/>
<property name="webcontent.dir" value="webcontent"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.utest.dir" value="${build.dir}/utest"/>
<property name="build.utest.classes.dir" value="${build.utest.dir}/classes"/>
<property name="build.utest.report.dir" value="${build.dir}/junit/report"/>
<property name="install.dir" value="install"/>
<property name="javadoc.version" value="2.0"/>
<!-- =================================================================== -->
<!-- distribute directory -->
<!-- =================================================================== -->
<property name="dist.dir" value="dist"/>
<property name="dist.war.dir" value="${dist.dir}/war"/>
<property name="dist.src.tar.dir" value="${dist.dir}/tar"/>
<property name="dist.db.schema.dir" value="${dist.dir}/sql"/>
<property name="dist.javadoc.dir" location="${dist.dir}/docs/api"/>
<property name="dist.pack.tmp.dir" value="${dist.dir}/tmp"/>
<property name="dist.pack.tmp.app.dir" value="${dist.pack.tmp.dir}/${app.name}"/>
<property name="dist.pack.tmp.app.web-inf.dir" value="${dist.pack.tmp.app.dir}/WEB-INF"/>
<property name="dist.pack.tmp.app.classes.dir" value="${dist.pack.tmp.app.web-inf.dir}/classes"/>
<property name="dist.pack.tmp.app.lib.dir" value="${dist.pack.tmp.app.web-inf.dir}/lib"/>
<property name="dist.pack.tmp.app.install.dir" value="${dist.pack.tmp.app.web-inf.dir}/install"/>
<property name="dist.pack.tmp.app.install.conf.dir" value="${dist.pack.tmp.app.install.dir}/conf"/>
<property name="dist.pack.tmp.app.install.web.dir" value="${dist.pack.tmp.app.install.dir}/web"/>
<!-- =================================================================== -->
<!-- developing deploy directory -->
<!-- =================================================================== -->
<property name="deploy.dir" value="deploy"/>
<property name="deploy.app.dir" value="${deploy.dir}/${app.name}"/>
<property name="deploy.app.web-inf.dir" value="${deploy.app.dir}/WEB-INF"/>
<property name="deploy.app.classes.dir" value="${deploy.app.dir}/WEB-INF/classes"/>
<property name="deploy.app.lib.dir" value="${deploy.app.dir}/WEB-INF/lib"/>
<property name="deploy.app.install.dir" value="${deploy.app.dir}/WEB-INF/install"/>
<!-- =================================================================== -->
<!-- Build classpath , db schema lib classpath, utest classpath -->
<!-- =================================================================== -->
<path id="build.classpath">
<fileset dir="${lib.dir}/core_lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${lib.dir}/axis_lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${lib.dir}/compile_lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="db_schema_export.classpath">
<path refid="build.classpath"/>
</path>
<path id="utest.classpath">
<path refid="build.classpath"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${build.utest.classes.dir}"/>
</path>
<!-- =================================================================== -->
<!-- Cleans up compiled classes -->
<!-- =================================================================== -->
<target name="clean">
<echo>Deleling the build classes directory</echo>
<delete dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Cleans up all -->
<!-- =================================================================== -->
<target name="clean-all">
<echo>Deleling the build classes, deploy directories</echo>
<delete dir="${build.dir}"/>
<delete dir="${deploy.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the build directories -->
<!-- =================================================================== -->
<target name="prepare" depends="clean">
<mkdir dir="${build.classes.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile" depends="prepare" description="compiling the source files">
<javac srcdir="${src.java.dir}" destdir="${build.classes.dir}" debug="on" deprecation="on" optimize="off"
includeantruntime="false" includes="**">
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.classes.dir}">
<fileset dir="${src.java.dir}">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<copy todir="${build.classes.dir}">
<fileset dir="${etc.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${build.classes.dir}">
<fileset dir="${conf.dir}">
<include name="**/log4j.properties"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- generate a dev integration deploy directory -->
<!-- =================================================================== -->
<target name="generate-dev-test-deploy-dir" depends="compile">
<delete dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.app.dir}"/>
<mkdir dir="${deploy.app.classes.dir}"/>
<mkdir dir="${deploy.app.lib.dir}"/>
<copy todir="${deploy.app.dir}">
<fileset dir="${webcontent.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${deploy.app.dir}">
<fileset dir="${src.web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${deploy.app.classes.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${deploy.app.classes.dir}">
<fileset dir="${conf.dir}">
<include name="**/*.*"/>
<exclude name="web.xml"/>
</fileset>
</copy>
<copy todir="${deploy.app.lib.dir}">
<fileset dir="${lib.dir}/core_lib">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${deploy.app.lib.dir}">
<fileset dir="${lib.dir}/axis_lib">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${deploy.app.web-inf.dir}">
<fileset dir="${conf.dir}">
<include name="**/web.xml"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- sync dev web to tomcat - freemarker file, css, js and images -->
<!-- =================================================================== -->
<target name="sync-dev-web-to-tomcat">
<copy todir="${deploy.app.dir}">
<fileset dir="${src.web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${deploy.app.dir}">
<fileset dir="${webcontent.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- generate a dist directory -->
<!-- =================================================================== -->
<target name="generate-dist-dir" depends="compile">
<delete dir="${dist.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.pack.tmp.dir}"/>
<mkdir dir="${dist.pack.tmp.app.dir}"/>
<mkdir dir="${dist.pack.tmp.app.classes.dir}"/>
<mkdir dir="${dist.pack.tmp.app.lib.dir}"/>
<copy todir="${dist.pack.tmp.app.dir}">
<fileset dir="${webcontent.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.dir}">
<fileset dir="${src.web.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.classes.dir}">
<fileset dir="${build.classes.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.lib.dir}">
<fileset dir="${lib.dir}/core_lib">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.lib.dir}">
<fileset dir="${lib.dir}/axis_lib">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.classes.dir}">
<fileset dir="${conf.dir}">
<include name="**/*.*"/>
<exclude name="web.xml"/>
</fileset>
</copy>
<copy todir="${dist.pack.tmp.app.web-inf.dir}">
<fileset dir="${conf.dir}">
<include name="**/web.xml"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- distribution preparing -->
<!-- =================================================================== -->
<target name="prepare-dist" depends="generate-dist-dir">
<echo>preparing a dist war</echo>
<delete dir="${dist.war.dir}"/>
<mkdir dir="${dist.war.dir}"/>
</target>
<!-- =================================================================== -->
<!-- packing a war file -->
<!-- =================================================================== -->
<target name="dist-war" depends="prepare-dist" description="packing the war">
<jar destfile="${dist.war.dir}/${app.name}.war" basedir="${dist.pack.tmp.app.dir}"/>
<delete dir="${dist.pack.tmp.dir}"/>
</target>
<!-- =================================================================== -->
<!-- generate a dist integration deploy directory -->
<!-- =================================================================== -->
<target name="generate-dist-test-deploy-dir" depends="generate-dist-dir">
<delete dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}"/>
<copy todir="${deploy.dir}">
<fileset dir="${dist.pack.tmp.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- reference a hibernatetool task -->
<!-- =================================================================== -->
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="db_schema_export.classpath"/>
<!-- =================================================================== -->
<!-- export the database schema from the annotation domain objects -->
<!-- =================================================================== -->
<target name="export-db-schema" depends="compile" description="Exports DDL to file in build directory">
<delete dir="${dist.db.schema.dir}"/>
<mkdir dir="${dist.db.schema.dir}"/>
<hibernatetool destdir="${dist.db.schema.dir}">
<classpath path="${build.classes.dir}"/>
<jpaconfiguration persistenceunit="domain_ps_unit"/>
<hbm2ddl drop="true" create="true" export="false" outputfilename="${app.name}_ddl.sql" delimiter=";"
format="true" haltonerror="true"/>
</hibernatetool>
</target>
<!-- =================================================================== -->
<!-- compile the unit test classes -->
<!-- =================================================================== -->
<target name="utest_compile" depends="compile">
<mkdir dir="${build.utest.classes.dir}"/>
<javac srcdir="${utest.java.dir}" destdir="${build.utest.classes.dir}" debug="debug"
deprecation="deprecation" optimize="optimize">
<classpath refid="utest.classpath"/>
<include name="**/*Test.java"/>
</javac>
<copy todir="${build.utest.classes.dir}">
<fileset dir="${conf.dir}">
<include name="*.xml"/>
<include name="**/*.properties"/>
<exclude name="**/struts.xml"/>
<exclude name="**/web.xml"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- run the unit test classes -->
<!-- =================================================================== -->
<target name="utest" depends="utest_compile" description="Run unit testing">
<mkdir dir="${build.utest.report.dir}"/>
<junit dir="${build.utest.dir}" forkmode="perBatch" printsummary="yes" haltonfailure="yes" haltonerror="yes">
<jvmarg line="-Djava.awt.headless=true -Xmx256m -XX:MaxPermSize=128m"/>
<classpath refid="utest.classpath"/>
<formatter type="plain" usefile="false"/>
<batchtest fork="yes" todir="${build.utest.report.dir}">
<fileset dir="${build.utest.classes.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- make the whole source code as a tar file -->
<!-- =================================================================== -->
<target name="generate.src.tar" depends="clean-all">
<echo message="Tar the source code ... "/>
<delete dir="${dist.src.tar.dir}"/>
<mkdir dir="${dist.src.tar.dir}"/>
<jar destfile="${dist.src.tar.dir}/${app.name}-${javadoc.version}-src.tar">
<tarfileset dir=".">
<exclude name="${dist.dir}/**"/>
</tarfileset>
</jar>
<echo message="Tar the source code completed !"/>
</target>
<!-- =================================================================== -->
<!-- generates the java api docs -->
<!-- =================================================================== -->
<target name="generate-javadoc" depends="clean">
<javadoc destdir="${dist.javadoc.dir}" use="true" windowtitle="Interferome Java API"
classpathref="build.classpath">
<packageset dir="${src.java.dir}" defaultexcludes="yes">
<exclude name="xslt/"/>
<exclude name="META-INF/"/>
<exclude name="**/*.xml"/>
<exclude name="**/*.properties"/>
</packageset>
<doctitle>
<![CDATA[<h2>Java API for Interferome, version ${javadoc.version}<br/>
API Specification<br/>
</h2>]]>
</doctitle>
<bottom>
<![CDATA[<i>Copyright © 2010-2011 Monash University, e-Research Centre, Australia. All Rights Reserved.</i>]]>
</bottom>
</javadoc>
<echo message="Interferome Java API v${javadoc.version} Javadoc Generated !!"/>
</target>
<target name="zip-javadoc" depends="generate-javadoc">
<jar destfile="${dist.dir}/docs/${app.name}-${javadoc.version}-Java-API.zip">
<tarfileset dir="${dist.javadoc.dir}">
<include name="**/*.*"/>
</tarfileset>
</jar>
<echo message="zip the Java-API docs completed!"/>
</target>
</project>