/
build.xml
376 lines (350 loc) · 13.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
<!-- $Id: build.xml 333 2006-04-24 12:11:53Z apr $ -->
<project name="jPOS" default="compile" basedir="."
xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
<!-- Give user a chance to override without editing this file -->
<property file="${user.home}/.ant.properties"/>
<property file="custom.properties"/>
<!-- And then our defaults -->
<property file="build.properties"/>
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="jPOS" />
<property name="name" value="jpos" />
<property name="archive" value="${name}-${version}" />
<property name="lib.dir" value="lib"/>
<property name="bin.dir" value="bin"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.doc" value="${build.dir}/doc"/>
<property name="build.lib" value="${build.dir}/lib"/>
<property name="build.bin" value="${build.dir}/bin"/>
<property name="build.test" value="${build.dir}/test"/>
<property name="build.modules" value="${build.dir}/modules"/>
<property name="build.webapps" value="${build.dir}/webapps"/>
<property name="build.deploy" value="${build.dir}/deploy"/>
<property name="build.deploy.lib" value="${build.deploy}/lib"/>
<property name="build.log" value="${build.dir}/log"/>
<property name="build.javadoc" value="${build.dir}/javadoc"/>
<property name="modules.ignore.list" value="${modules.dir}/ignore.list" />
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="test-classes.dir" value="${build.dir}/test-classes"/>
<property name="deprecation" value="false" />
<property name="nowarn" value="true" />
<property name="debug" value="on"/>
<patternset id="support.files">
<include name="**/*.hbm.xml"/>
<include name="**/*.cfg.xml"/>
<include name="**/*.man"/>
<include name="**/*.properties"/>
</patternset>
<path id="main.classpath">
<fileset dir="${build.lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${classes.dir}"/>
</path>
<target name="prepare">
<tstamp>
<format property="subversion" pattern="yyyy.MM.dd.hh.mm.ss"/>
</tstamp>
<tstamp>
<format property="date" pattern="yyyy.MM.dd.hh.mm.ss"/>
</tstamp>
<echo
message="Build ${Name}-${version}.${subversion}"/>
<touch file="modules/ignore.list" />
<touch file="modules/include.list" />
<mkdir dir="${bin.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.lib}"/>
<mkdir dir="${build.bin}"/>
<mkdir dir="${build.doc}"/>
<mkdir dir="${build.cfg}"/>
<mkdir dir="${build.modules}"/>
<mkdir dir="${build.deploy}"/>
<mkdir dir="${build.deploy.lib}"/>
<mkdir dir="${build.webapps}/root"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}/log"/>
<chmod perm="ug+x">
<fileset dir="${bin.dir}">
<include name="q2" />
<include name="bsh" />
<include name="*.sh" />
</fileset>
</chmod>
</target>
<target name="jar" depends="modules, support, main"
description="creates jpos.jar">
<jar jarfile="${build.dir}/${name}.jar"
basedir="${classes.dir}"
manifest="${classes.dir}/MANIFEST.MF"
includes="**" />
</target>
<target name="unjar" depends="modules, support, main">
<unjar dest="${classes.dir}">
<fileset dir="${build.lib}">
<include name="**/*.jar"/>
</fileset>
</unjar>
</target>
<target name="singlejar" depends="unjar, jar"
description="creates a single jpos.jar including all supporting jars" />
<target name="clean" description="clean up build and dist directories">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="info" depends="manifest">
<echo message="java.vm.info=${java.vm.info}"/>
<echo message="java.vm.name=${java.vm.name}"/>
<echo message="java.vm.vendor=${java.vm.vendor}"/>
<echo message="java.vm.version=${java.vm.version}"/>
<echo message="os.arch=${os.arch}"/>
<echo message="os.name=${os.name}"/>
<echo message="os.version=${os.version}"/>
<echo message="java.home=${java.home}"/>
<echo message="java.class.path=${java.class.path}"/>
<echo message="file.encoding=${file.encoding}"/>
<echo message="file.separator=${file.separator}"/>
<echo message="user.home=${user.home}"/>
<echo message="user.name=${user.name}"/>
<echo message="user.language=${user.language}"/>
<echo message="q2.classpath=${q2.classpath}"/>
<echo message="filter.properties=${filter.properties}" />
</target>
<target name="main" depends="prepare, copy-lib, copy-bin, manifest">
<javac srcdir="${build.src}" destdir="${classes.dir}"
debug="${debug}" nowarn="${nowarn}"
target="1.5" source="1.5"
deprecation="${deprecation}">
<classpath refid="main.classpath"/>
</javac>
</target>
<target name="compile" depends="modules, main, jar"
description="compile all" />
<target name="modules" depends="prepare, copy-lib">
<filter filtersfile="${filter.properties}" />
<copy todir="${build.modules}" flatten="false" filtering="false">
<fileset dir="${modules.dir}" includesfile="${modules.include.list}" />
</copy>
<copy todir="${build.deploy}" flatten="true" filtering="true">
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="**/deploy/*.xml"/>
<include name="**/deploy/*.inc"/>
</fileset>
</copy>
<copy todir="${build.lib}" flatten="true">
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="*/lib/*.jar"/>
<include name="*/lib/*.dll"/>
<include name="*/lib/*.so"/>
</fileset>
</copy>
<copy todir="${build.bin}" flatten="true">
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="*/bin/*"/>
</fileset>
</copy>
<copy todir="${build.deploy.lib}" flatten="true">
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="**/deploy/lib/*.jar"/>
</fileset>
</copy>
<copy todir="${build.dir}" filtering="true">
<mapper type="regexp" from="^\w*[/|\\](.*)" to="\1" />
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
<include name="**/*.cfg"/>
<include name="**/*.man"/>
<include name="**/cfg/**"/>
<exclude name="**/cfg/_*" />
</fileset>
</copy>
<chmod perm="ug+x">
<fileset dir="${build.cfg}">
<include name="*.sh" />
</fileset>
</chmod>
<copy todir="${build.webapps}" flatten="false">
<mapper type="regexp" from="^\w*[/|\\]\w*[/|\\](.*)" to="\1" />
<fileset dir="${build.modules}" excludesfile="${modules.ignore.list}">
<include name="**/webapps/**"/>
</fileset>
</copy>
<antcall target="support" />
<subant target="prepare">
<fileset dir="${modules.dir}" excludesfile="${modules.ignore.list}">
<include name="**/build.xml"/>
</fileset>
</subant>
<subant>
<fileset dir="${modules.dir}" excludesfile="${modules.ignore.list}">
<include name="**/build.xml"/>
</fileset>
</subant>
</target>
<target name="setup">
<subant target="setup">
<fileset dir="${modules.dir}" excludesfile="${modules.ignore.list}">
<include name="**/build.xml"/>
</fileset>
</subant>
</target>
<target name="doc" depends="main, modules">
<ant dir="doc" inheritAll="false" target="all.doc" />
</target>
<target name="copy-lib" depends="prepare">
<copy todir="${build.lib}">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="copy-bin" depends="prepare">
<copy todir="${build.bin}">
<fileset dir="${bin.dir}">
<include name="*"/>
</fileset>
</copy>
<chmod perm="ug+x">
<fileset dir="${build.bin}" />
</chmod>
</target>
<target name="zip" depends="clean, jar"
description="create zip distribution">
<copy todir="${build.dir}">
<fileset dir=".">
<include name="README"/>
<include name="LICENSE"/>
<include name="COPYRIGHT"/>
<include name="build.xml"/>
<include name="build.properties"/>
</fileset>
</copy>
<chmod perm="ug+x">
<fileset dir="${build.bin}">
<include name="q2" />
<include name="bsh" />
<include name="*.sh" />
</fileset>
</chmod>
<zip zipfile="${dist.dir}/${archive}.zip" basedir="${build.dir}"
includes="**/*">
<exclude name="classes/**" />
<exclude name="doc/**" />
<exclude name="src/**" />
<exclude name="test/**" />
<exclude name="tmpdoc/**" />
<exclude name="webapps/**" />
<exclude name="log/**" />
<exclude name="bin/release" />
<exclude name="jpos.jar" />
</zip>
</target>
<target name="support" depends="prepare">
<filter filtersfile="${filter.properties}" />
<copy todir="${classes.dir}" flatten="false" overwrite="true" filtering="true">
<fileset dir="${build.src}">
<patternset refid="support.files"/>
</fileset>
<fileset dir="${build.cfg}">
<include name="hibernate.cfg.xml"/>
<include name="*.properties"/>
</fileset>
<fileset dir=".">
<include name="LICENSE"/>
<include name="COPYRIGHT"/>
</fileset>
</copy>
</target>
<target name="manifest" depends="modules">
<pathconvert refid="main.classpath" property="q2.classpath"
pathsep=" ">
<mapper type="flatten" />
<map from="" to="lib/" />
</pathconvert>
<concat destfile="${classes.dir}/MANIFEST.MF">Manifest-Version: 1.0
Specification-Title: ${Name}
Specification-Vendor: jPOS.org
Specification-Version: ${Name}-${version}
Implementation-Title: ${Name}
Implementation-Vendor: jPOS.org
Implementation-Version: ${Name}-${subversion}
Class-path: ${q2.classpath}
Main-Class: org.jpos.q2.Q2
Sealed: false</concat>
</target>
<target name="modules-dist" depends="modules">
<subant target="dist" inheritall="true">
<fileset dir="${modules.dir}" excludesfile="${modules.ignore.list}">
<include name="**/build.xml"/>
</fileset>
</subant>
</target>
<target name="dist" depends="zip" description='Builds source distribution' />
<target name="javadoc" depends="modules, compile"
description="generate javadocs">
<mkdir dir="${build.javadoc}" />
<javadoc sourcepath="${build.src}"
destdir="${build.javadoc}"
windowtitle="jPOS ${version} API Documentation"
doctitle="jPOS ${version} API Documentation"
header="jPOS ${version} API Documentation"
footer="jPOS.org"
public="true" noindex="false" author="true"
classpathref="main.classpath"
packagenames="*"
/>
</target>
<target name="test" depends="compile, support"
description="perform unit tests">
<mkdir dir="${build.test}"/>
<mkdir dir="${test-classes.dir}"/>
<javac srcdir="${build.test}" destdir="${test-classes.dir}"
debug="${debug}" nowarn="${nowarn}"
target="1.4" source="1.4"
deprecation="${deprecation}">
<classpath refid="main.classpath" />
</javac>
<junit printsummary="yes" haltonfailure="yes" showoutput="true"
dir="${test-classes.dir}"
fork="true"
forkmode="perBatch"
failureproperty="junit.failure" errorproperty="junit.error"
haltonerror="no">
<classpath>
<pathelement location="${test-classes.dir}" />
<pathelement location="${classes.dir}" />
<fileset dir="${build.lib}">
<include name="*.jar"/>
</fileset>
</classpath>
<formatter type="plain" />
<batchtest fork="yes" todir="${build.test}">
<fileset dir="${build.test}">
<include name="**/*AllTests.java"/>
<include name="**/*TestCase.java"/>
</fileset>
</batchtest>
</junit>
<fail message="Unittest failures - please check" if="junit.failure" />
<fail message="Unittest errors - please check" if="junit.error" />
</target>
<target name="run" depends="jar"
description="invoke jPOS under Ant's JVM">
<java
jar="${build.dir}/jpos.jar"
fork="true"
dir="${build.dir}">
</java>
</target>
<target name="checkstyle" depends="modules">
<cs:checkstyle config="checkstyle.xml">
<fileset dir="${build.src}" includes="**/*.java"/>
<formatter type="plain"/>
</cs:checkstyle>
</target>
</project>