forked from voodoodyne/subetha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
431 lines (344 loc) · 13.2 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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<?xml version="1.0"?>
<!--
$Id$
$URL$
Master build file for SubEtha.
-->
<project name="subetha" default="war" basedir=".">
<property name="name" value="${ant.project.name}" />
<property file="etc/local/user.properties" />
<property file="${user.home}/build.properties" />
<property file="etc/build.properties" />
<property name="appserver.resin.port" value="8080" />
<property name="appserver.resin.host" value="127.0.0.1" />
<property name="appserver.resin.user" value="admin" />
<property name="appserver.resin.pass" value="admin" />
<property name="build.debug" value="on" />
<property name="build.deprecation" value="on" />
<property name="ant.build.javac.target" value="1.6" />
<property name="ant.build.javac.source" value="1.6" />
<property name="ant.build.javac.encoding" value="UTF-8" />
<property name="build.dir" location="out/ant" />
<property name="build.classes.dir" location="${build.dir}/classes" />
<property name="build.war.file" location="${build.dir}/se.war" />
<property name="build.client.file" location="${build.dir}/${name}-client.jar" />
<property name="docs.dir" value="${build.dir}/docs" />
<property name="resin.dir" location="/java/resin-4.0.25/" />
<property name="deploy.dir" location="${resin.dir}/webapps" />
<property name="expandedWar.dir" location="${deploy.dir}/se" />
<property name="src.dir" location="src" />
<property name="src.java.dir" location="src/main/java" />
<property name="src.resource.dir" location="src/main/resources" />
<property name="web.dir" location="src/main/webapp" />
<property name="lib.dir" location="lib" />
<property name="lib.build.dir" location="lib/build-only" />
<property name="lib.dist.dir" location="lib/dist" />
<property name="lib.dev.dir" location="lib/dev" />
<typedef resource="com/googlecode/svntask/svntask.xml">
<classpath>
<fileset dir="${lib.build.dir}">
<include name="**/svnkit.jar"/>
<include name="**/svntask.jar"/>
</fileset>
</classpath>
</typedef>
<tstamp/>
<tstamp>
<format property="YEAR" pattern="yyyy" />
</tstamp>
<path id="master.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${resin.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="javadoc.classpath">
<path refid="master.classpath" />
</path>
<path id="rtest.build.classpath">
<pathelement location="${build.classes.dir}" />
<path refid="master.classpath" />
</path>
<path id="rtest.run.classpath">
<pathelement location="${build.dir}/rtest/rtest.jar" />
<pathelement location="${src.java.dir}"/> <!-- gets the hessian serializers -->
<path refid="rtest.build.classpath" />
</path>
<target name="init">
<svn><info path="${basedir}" revisionProperty="revisionVersion" /></svn>
<!-- A hack because svnant does not respect Ant's properties can't be overwritten rule. -->
<property name="version" value="${revisionVersion}" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="classes" depends="init">
<mkdir dir="${build.classes.dir}" />
<javac srcdir="${src.java.dir}"
destdir="${build.classes.dir}"
debug="${build.debug}"
deprecation="${build.deprecation}"
includeantruntime="false"
>
<classpath refid="master.classpath" />
</javac>
</target>
<target name="client" depends="classes">
<jar jarfile="${build.client.file}">
<fileset dir="${build.classes.dir}">
<include name="org/subethamail/common/**" />
<include name="org/subethamail/**/i/**" />
</fileset>
<manifest>
<attribute name="Specification-Version" value="${build.version}" />
<attribute name="Implementation-Version" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="war" depends="classes">
<war destfile="${build.war.file}" webxml="${web.dir}/WEB-INF/web.xml">
<webinf dir="${web.dir}/WEB-INF">
<exclude name="web.xml" />
</webinf>
<fileset dir="${web.dir}">
<exclude name="WEB-INF/**" />
</fileset>
<classes dir="${build.classes.dir}" />
<classes dir="${src.resource.dir}">
</classes>
<lib dir="${lib.dist.dir}">
<exclude name="build-only/**"/>
</lib>
</war>
</target>
<target name="deploy" depends="war">
<copy file="${build.war.file}" todir="${deploy.dir}" />
</target>
<target name="deploy-dist" depends="clean, init-dist, war">
<copy file="${build.war.file}" todir="${deploy.dir}" />
</target>
<target name="sync-deploy" depends="classes">
<property name="timeDriftLimit" value="100"/>
<sync todir="${expandedWar.dir}" granularity="${timeDriftLimit}" verbose="true" >
<fileset dir="${web.dir}" />
<preserveintarget>
<!-- resin crap -->
<include name="WEB-INF/tmp/**" />
<include name="WEB-INF/work/**" />
<!-- Taken care of below -->
<include name="META-INF/**" />
<include name="WEB-INF/classes/**" />
<include name="WEB-INF/lib/**" />
</preserveintarget>
</sync>
<sync todir="${expandedWar.dir}/WEB-INF/classes" granularity="${timeDriftLimit}" verbose="true">
<fileset dir="${build.classes.dir}" />
<fileset dir="${src.java.dir}">
<exclude name="**/*.java"/>
</fileset>
<preserveintarget>
<include name="META-INF/**" />
</preserveintarget>
</sync>
<sync todir="${expandedWar.dir}/WEB-INF/classes/META-INF" granularity="${timeDriftLimit}" verbose="true">
<fileset dir="${src.java.dir}/META-INF" />
</sync>
<sync todir="${expandedWar.dir}/WEB-INF/lib" verbose="true">
<fileset dir="${lib.dist.dir}" >
</fileset>
</sync>
</target>
<target name="resin-deploy" depends="war">
<taskdef name="resin-deploy" classname="com.caucho.ant.ResinDeploy">
<classpath>
<fileset dir="lib">
<include name="**"/>
</fileset>
<fileset dir="${resin.dir}/lib/">
<include name="**"/>
</fileset>
</classpath>
</taskdef>
<resin-deploy warfile="${build.war.file}" server="${appserver.resin.host}"
port="${appserver.resin.port}" user="${appserver.resin.user}" password="${appserver.resin.pass}"
virtualhost="default" version="0.1" commitmessage="trying"/>
</target>
<target name="precompile-jsp" description="precompile jsp">
<taskdef name="resin-jspc" classname="com.caucho.ant.Jspc">
<classpath>
<fileset dir="lib">
<include name="**"/>
</fileset>
<fileset dir="${resin.dir}/lib/">
<include name="**"/>
</fileset>
</classpath>
</taskdef>
<resin-jspc rootDirectory="src/main/webapp"/><!-- why is this not using the web.dir var? -->
</target>
<target name="rtest-jar" depends="client">
<mkdir dir="${build.dir}/rtest/classes" />
<javac
srcdir="${basedir}/rtest/src"
destdir="${build.dir}/rtest/classes"
includeAntRuntime="false"
debug="${build.debug}"
deprecation="${build.deprecation}">
<classpath refid="rtest.build.classpath" />
</javac>
<jar jarfile="${build.dir}/rtest/rtest.jar">
<fileset dir="${build.dir}/rtest/classes"/>
<manifest>
<attribute name="Specification-Version" value="${build.version}" />
<attribute name="Implementation-Version" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="junit" depends="rtest-jar">
<junit printsummary="yes" showoutput="yes" fork="yes" forkmode="once">
<jvmarg value="-Djava.util.logging.config.file=rtest/logging.properties"/>
<classpath refid="rtest.run.classpath"/>
<sysproperty key="appserver.url" value="http://${appserver.resin.host}:${appserver.resin.port}"/>
<syspropertyset>
<propertyref prefix="java.naming" />
</syspropertyset>
<formatter type="plain" />
<batchtest todir="${build.dir}">
<fileset dir="${build.dir}/rtest/classes">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-special" depends="rtest-jar">
<junit printsummary="true" showoutput="true" fork="true" forkmode="once">
<jvmarg value="-Djava.util.logging.config.file=rtest/logging.properties"/>
<classpath refid="rtest.run.classpath"/>
<syspropertyset>
<propertyref prefix="java.naming" />
</syspropertyset>
<formatter type="plain" />
<batchtest todir="${build.dir}">
<fileset dir="${build.dir}/rtest/classes">
<include name="${junit.special.tests}" />
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-debug" depends="rtest-jar">
<junit printsummary="yes" showoutput="yes" fork="yes" forkmode="once">
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=7891"/>
<jvmarg value="-Djava.util.logging.config.file=rtest/logging.properties"/>
<classpath refid="rtest.run.classpath"/>
<syspropertyset>
<propertyref prefix="java.naming" />
</syspropertyset>
<formatter type="plain" />
<batchtest todir="${build.dir}">
<fileset dir="${build.dir}/rtest/classes">
<include name="${junit.special.tests}" />
</fileset>
</batchtest>
</junit>
</target>
<target name="build-docs" description="downloads docs from wiki and processes them into the build/docs dir">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="master.classpath"/>
<property name="gc.name" value="subetha"/>
<property name="wiki.baseurl" value="http://code.google.com/p/${gc.name}/wiki"/>
<mkdir dir="${docs.dir}"/>
<svn><ls repository="http://${gc.name}.googlecode.com/svn" path="wiki" filterType="file" filterContains=".wiki"/></svn>
<propertyregex property="wiki.pages" input="${svn.ls}" regexp="\.wiki" replace=""/>
<echo message="Getting wiki pages: ${wiki.pages}"/>
<!-- Get files from wiki-->
<for list="${wiki.pages}" param="wiki.page" parallel="yes">
<sequential>
<get dest="${docs.dir}/@{wiki.page}.html" src="${wiki.baseurl}/@{wiki.page}?show=content"/>
</sequential>
</for>
<!-- Replace links in files -->
<for list="${wiki.pages}" param="wiki.page">
<sequential>
<replace dir="${docs.dir}" token="/p/${gc.name}/wiki/@{wiki.page}" value="@{wiki.page}.html"/>
</sequential>
</for>
<!-- link back to the wiki, if we haven't downloaded the content -->
<replace dir="${docs.dir}" token="/p/${gc.name}/wiki" value="${wiki.baseurl}"/>
</target>
<target name="javadoc" depends="init-dist, classes">
<javadoc
destdir="${build.dir}/javadoc"
packagenames="*"
classpathref="javadoc.classpath"
author="true"
version="true"
Windowtitle="SubEtha Javadoc"
useexternalfile="true"
>
<fileset dir="${src.java.dir}">
<include name="**/*.java" />
</fileset>
<doctitle><![CDATA[<h1>SubEtha</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright © ${YEAR} SubEtha. All Rights Reserved. Build version: ${build.version}</i>]]></bottom>
</javadoc>
</target>
<target name="init-dist">
<input addproperty="build.version" message="Version number?" />
<property name="dist.name" value="${name}-${build.version}" />
<property name="build.dist.dir" location="${build.dir}/${name}-${build.version}"/>
<property name="build.dist.zip" location="${build.dir}/${dist.name}.zip"/>
</target>
<target name="dist" depends="clean, init-dist, war, build-docs, javadoc">
<copy todir="${build.dist.dir}">
<fileset dir="${build.dir}">
<include name="*.war" />
</fileset>
<fileset dir="${build.dir}">
<include name="javadoc/**" />
<include name="docs/**" />
</fileset>
<fileset dir=".">
<include name="README.html" />
<include name="LICENSE.txt" />
<include name="example-subetha.xml" />
<include name="build.xml" />
<include name=".project" />
<include name=".classpath" />
<include name="etc/**" />
<include name="bin/**" />
<include name="lib/**" />
<include name="src/**" />
<include name="rtest/**" />
<include name="loadtest/**" />
<exclude name="etc/local/**"/>
</fileset>
</copy>
<dirname property="build.dist.dir.dirname" file="${build.dist.dir}" />
<basename property="build.dist.dir.basename" file="${build.dist.dir}" />
<zip zipfile="${build.dist.zip}" basedir="${build.dist.dir.dirname}">
<include name="${build.dist.dir.basename}/**" />
</zip>
</target>
<!-- Note this doesn't work. See https://forum.hibernate.org/viewtopic.php?uid=482&f=6&t=999592&start=0 -->
<target name="ddl" depends="classes">
<mkdir dir="${build.dir}/ddl" />
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="rtest.build.classpath" />
<hibernatetool destdir="${build.dir}/ddl">
<classpath>
<path refid="rtest.build.classpath" />
<path location="${src.java.dir}" />
</classpath>
<!-- This property seems to be ignored -->
<property key="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<!-- This manages to convey the dialect -->
<jpaconfiguration persistenceunit="subetha" propertyfile="mysql5.properties"/>
<!-- This generates a 0-byte file. It's broken. -->
<hbm2ddl export="false" format="true" outputfilename="mysql5.sql" />
</hibernatetool>
</target>
<target name="update-smtp" depends="">
<copy file="../SubethaSMTP/target/subethasmtp-UNVERSIONED.jar" todir="${lib.dist.dir}" />
</target>
</project>