-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
401 lines (355 loc) · 14.9 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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?xml version="1.0"?>
<project default="build" basedir="." name="Jamm">
<!-- set global properties for this build -->
<property name="project.name" value="jamm"/>
<property name="project.version" value="0.9.7-rc1"/>
<property name="project.string"
value="${project.name}-${project.version}" />
<!-- This must be done before any other propertes -->
<property file="${basedir}/build.properties" />
<property file="${user.home}/.build.properties" />
<property file="${basedir}/src/build.properties" />
<path id="lib.path">
<pathelement path="${servlet.jar}" />
<fileset dir="${struts.lib}" includes="*.jar"/>
<fileset dir="${jaxp.lib}" includes="*.jar"/>
<pathelement path="${cli.jar}" />
<pathelement path="${log4j.jar}"/>
</path>
<path id="xdoclet.path">
<pathelement path="${ant.home}/lib/ant.jar" />
<fileset dir="${xdoclet.lib}" includes="commons-*.jar"/>
<pathelement location="${xdoclet.jar}"/>
<pathelement location="${xdoclet.xdoclet.jar}"/>
<pathelement location="${xjavadoc.jar}"/>
</path>
<target name="prepare">
<mkdir dir="build" />
<mkdir dir="build/backend/classes" />
<mkdir dir="build/webapp/root" />
<mkdir dir="build/webapp/root/WEB-INF" />
<mkdir dir="build/webapp/root/WEB-INF/classes" />
<mkdir dir="build/webapp/root/WEB-INF/lib" />
<mkdir dir="build/webapp/root/WEB-INF/tld" />
<mkdir dir="build/util/classes" />
<mkdir dir="build/util/dist/lib" />
<mkdir dir="build/util/dist/bin" />
<mkdir dir="test" />
<mkdir dir="test/backend/classes" />
<mkdir dir="test/webapp/classes" />
<mkdir dir="dist" />
</target>
<target name="build-util" depends="prepare, build-backend"
description="Builds all code for the util parts">
<depend srcDir="src/util/java" destDir="build/util/classes"
cache="build/util/depcache" closure="yes">
<classpath>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</depend>
<javac srcdir="src/util/java"
destdir="build/util/classes"
optimize="${compile.optimize}" debug="${compile.debug}"
deprecation="${compile.deprecation}" target="1.1">
<classpath>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</javac>
<jar jarfile="build/util/dist/lib/${project.string}-util.jar"
basedir="build/util/classes">
<manifest>
<attribute name="Main-Class" value="jamm.tools.JammCleaner"/>
</manifest>
</jar>
<copy todir="build/util/dist/lib"
file="build/backend/${project.name}-backend.jar" />
<copy todir="build/util/dist/lib" file="${cli.jar}" />
<copy todir="build/util/dist/lib" file="${log4j.jar}" />
<copy todir="build/util/dist/lib"
file="src/util/config/jammCleaner.properties.dist"/>
<copy todir="build/util/dist/lib"
file="src/util/config/jammCleaner.properties"/>
<copy todir="build/util/dist/bin" file="src/util/shell/jammCleaner" />
<chmod file="build/util/dist/bin/jammCleaner" perm="555" />
</target>
<target name="build-backend" depends="prepare"
description="Builds all code for the backend.">
<depend srcDir="src/backend/java" destDir="build/backend/classes"
cache="build/backend/depcache" closure="yes" />
<javac srcdir="src/backend/java"
destdir="build/backend/classes" target="1.1"
optimize="${compile.optimize}" debug="${compile.debug}"
classpathref="lib.path" />
<depend srcDir="src/backend/test/java" destDir="test/backend/classes"
cache="test/backend/depcache" closure="yes">
<classpath>
<pathelement location="build/backend/classes" />
</classpath>
</depend>
<javac srcdir="src/backend/test/java"
destdir="test/backend/classes" target="1.1"
debug="on" optimize="off">
<classpath>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</javac>
<jar jarfile="build/backend/${project.name}-backend.jar"
basedir="build/backend/classes"/>
</target>
<target name="b-b" depends="build-backend" />
<target name="build-webapp-java" depends="prepare, build-backend"
description="Builds all code for the web application.">
<depend srcDir="src/webapp/java"
destDir="build/webapp/root/WEB-INF/classes"
cache="build/webapp/depcache" closure="yes">
<classpath>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</depend>
<javac srcdir="src/webapp/java"
destdir="build/webapp/root/WEB-INF/classes" target="1.1"
optimize="${compile.optimize}" debug="${compile.debug}"
deprecation="${compile.deprecation}">
<classpath>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</javac>
<depend srcDir="src/webapp/test/java"
destDir="build/webapp/root/WEB-INF/classes"
cache="test/webapp/depcache" closure="yes">
<classpath>
<pathelement location="build/webapp/root/WEB-INF/classes" />
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</depend>
<javac srcdir="src/webapp/test/java" destdir="test/webapp/classes"
debug="on" optimize="off" target="1.1">
<classpath>
<pathelement location="build/webapp/root/WEB-INF/classes" />
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</javac>
<copy todir="build/webapp/root">
<fileset dir="src/webapp/content" includes="**/*" />
</copy>
<replace file="build/webapp/root/WEB-INF/common/header.jsp"
token="%VERSION%" value="${project.version}"/>
<replace file="build/webapp/root/WEB-INF/common/private_header.jsp"
token="%VERSION%" value="${project.version}"/>
<copy todir="build/webapp/root/WEB-INF/lib"
file="build/backend/${project.name}-backend.jar" />
<copy todir="build/webapp/root/WEB-INF/tld">
<fileset dir="${struts.lib}" includes="*.tld" />
</copy>
<copy todir="build/webapp/root/WEB-INF/lib">
<fileset dir="${struts.lib}" includes="*.jar" />
</copy>
<copy todir="build/webapp/root/WEB-INF/classes/">
<fileset dir="src/webapp/config/properties/" includes="*" />
</copy>
<copy todir="build/webapp/root/WEB-INF/"
file="src/webapp/config/validator-rules.xml"/>
<copy todir="build/webapp/root/WEB-INF/"
file="src/webapp/config/tileDefinitions.xml"/>
<copy todir="build/webapp/root/WEB-INF/"
file="src/webapp/config/jamm.properties"/>
<copy todir="build/webapp/root/WEB-INF/"
file="src/webapp/config/jamm.properties.dist"/>
<copy todir="build/webapp/root/WEB-INF/lib" file="${log4j.jar}"/>
<copy todir="build/webapp/root/WEB-INF/classes"
file="src/webapp/config/log4j.properties"/>
</target>
<target name="b-w-j" depends="build-webapp-java" />
<target name="build-webapp-webdoclet" depends="build-webapp-java">
<taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask">
<classpath>
<path refid="xdoclet.path"/>
<path location="${xdoclet.web.jar}"/>
<path location="${xdoclet.apache.jar}"/>
<path location="${xdoclet.ejb.jar}"/>
<pathelement location="${servlet.jar}"/>
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
</taskdef>
<webdoclet destdir="build/webapp/generated" verbose="false">
<fileset dir="src/webapp/java"/>
<deploymentdescriptor servletspec="2.3"
destdir="build/webapp/root/WEB-INF"
sessiontimeout="30"
mergedir="src/webapp/config/web-merge"
displayname="Jamm"
description="Java Mail Manager">
</deploymentdescriptor>
<jsptaglib jspversion="1.2" destdir="build/webapp/root/WEB-INF/tld"
shortname="jamm" filename="jamm.tld" />
<strutsconfigxml version="1.1" destdir="build/webapp/root/WEB-INF"
mergedir="src/webapp/config/struts-merge"
templateFile="src/webapp/config/struts_config_xml.xdt"/>
<!-- <strutsvalidationxml destdir="build/webapp/root/WEB-INF"/> -->
</webdoclet>
</target>
<target name="b-w-w" depends="build-webapp-webdoclet" />
<target name="build-webapp" depends="build-webapp-webdoclet" />
<target name="build" depends="build-webapp, build-backend, build-util" />
<target name="test-backend" depends="build-backend">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<pathelement location="test/backend/classes" />
<pathelement location="build/backend/classes" />
<path refid="lib.path" />
</classpath>
<jvmarg value="-Dlog4j.disableOverride=${log4j.disableOverride}" />
<!-- <jvmarg value="-Xdebug"/> -->
<!-- <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/> -->
<formatter type="plain" />
<test name="jamm.AllTests"
outfile="test/backend/results" />
</junit>
</target>
<target name="t-b" depends="test-backend" />
<target name="test" depends="test-backend" />
<target name="dist-webapp"
depends="build-webapp, build-webapp-webdoclet">
<jar jarfile="build/${project.string}.war"
basedir="build/webapp/root"
excludes="WEB-INF/jamm.properties"/>
</target>
<target name="dist-util"
depends="build-util, build-backend">
<tar destfile="build/jammUtils-${project.version}.tar">
<tarfileset dir="build/util/dist">
<include name="**/*"/>
<exclude name="bin/jammCleaner"/>
<exclude name="lib/jammCleaner.properties"/>
</tarfileset>
<tarfileset dir="build/util/dist" mode="555">
<include name="bin/jammCleaner"/>
</tarfileset>
</tar>
</target>
<target name="dist" depends="dist-webapp, dist-util" />
<target name="checkstyle">
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.jar}"/>
<checkstyle config="src/tools/default_checks.xml">
<fileset dir="src/webapp/java" includes="**/*.java" />
<formatter type="plain"/>
</checkstyle>
<checkstyle config="src/tools/default_checks.xml">
<property key="javadocScope" value="nothing"/>
<fileset dir="src/webapp/test/java" includes="**/*.java" />
</checkstyle>
<checkstyle config="src/tools/default_checks.xml">
<fileset dir="src/backend/java" includes="**/*.java" />
</checkstyle>
<checkstyle config="src/tools/default_checks.xml">
<property key="javadocScope" value="nothing"/>
<fileset dir="src/backend/test" includes="**/*.java" />
</checkstyle>
<checkstyle config="src/tools/default_checks.xml">
<fileset dir="src/util/java" includes="**/*.java" />
</checkstyle>
</target>
<target name="cs" depends="checkstyle" />
<target name="prepare-doc" depends="prepare">
<mkdir dir="build/doc/api" />
</target>
<target name="doc" depends="prepare-doc">
<javadoc packagenames="jamm.*"
destdir="build/doc/api"
author="true"
version="true"
use="true"
windowtitle="Jamm API"
private="${javadoc.private}"
doctitle="Jamm API">
<link offline="true"
href="http://java.sun.com/j2se/1.3/docs/api/"
packageListLoc="${javadoc.1.3.local}"/>
<sourcepath>
<pathelement location="src/backend/java" />
<pathelement location="src/backend/test/java" />
<pathelement location="src/webapp/java" />
<pathelement location="src/util/java" />
</sourcepath>
<classpath>
<path refid="lib.path" />
<pathelement location="${junit.jar}" />
</classpath>
<tag name="web.servlet" scope="types" description="Servlet"/>
<tag name="web.filter" scope="types" description="Filter"/>
<tag name="web.filter-mapping" scope="types"
description="Filter Mapping"/>
<tag name="jsp.attribute" scope="methods"
description="JSP Tag Attribute"/>
<tag name="jsp.tag" scope="types" description="JSP Tag"/>
<tag name="struts.form" scope="types" description="Struts Form"/>
<tag name="struts.action" scope="types" description="Struts Action"/>
<tag name="struts.action-forward" scope="types"
description="Struts Action Forward"/>
</javadoc>
</target>
<target name="dist-src" depends="prepare">
<delete dir="build/dist-src/${project.string}"/>
<mkdir dir="build/dist-src/${project.string}"/>
<copy todir="build/dist-src/${project.string}">
<fileset dir=".">
<exclude name="build/**"/>
<exclude name="test/**"/>
<exclude name="dist/**"/>
<exclude name="build.properties"/>
<exclude name="src/webapp/config/jamm.properties"/>
</fileset>
</copy>
<tar tarfile="build/${project.string}.tar"
basedir="build/dist-src"/>
<gzip zipfile="dist/${project.string}.tar.gz"
src="build/${project.string}.tar"/>
<!-- Make text files DOS-compatible before making zip file-->
<fixcrlf srcdir="build/dist-src" eol="crlf"
excludes="**/*.jpg,**/*.gif"/>
<zip zipfile="dist/${project.string}.zip"
basedir="build/dist-src"/>
</target>
<target name="dist-bin" depends="dist">
<delete dir="build/dist-bin/${project.string}"/>
<mkdir dir="build/dist-bin/${project.string}"/>
<copy todir="build/dist-bin/${project.string}" flatten="yes">
<fileset dir=".">
<include name="INSTALL"/>
<include name="README"/>
<include name="LICENSE"/>
<include name="NEWS"/>
<include name="UPGRADE"/>
<include name="src/schema/jamm.schema"/>
<include name="doc/samples/sample.ldif"/>
<include name="build/${project.string}.war"/>
<include name="build/jammUtils-${project.version}.tar"/>
<include name="src/util/perl/updateLdif.pl"/>
</fileset>
</copy>
<chmod file="build/dist-bin/${project.string}/updateLdif.pl" perm="555" />
<tar tarfile="build/${project.string}-bin.tar"
basedir="build/dist-bin"/>
<gzip zipfile="dist/${project.string}-bin.tar.gz"
src="build/${project.string}-bin.tar"/>
<!-- Make text files DOS-compatible before making zip file-->
<fixcrlf srcdir="build/dist-bin" eol="crlf"
excludes="**/*.war,**/*.jar,**/*.tar,**/*.gz"/>
<zip zipfile="dist/${project.string}-bin.zip"
basedir="build/dist-bin"/>
</target>
<target name="clean">
<delete dir="build" />
<delete dir="test" />
<delete dir="dist" />
</target>
</project>