-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
453 lines (407 loc) · 18.8 KB
/
Copy pathbuild.xml
File metadata and controls
453 lines (407 loc) · 18.8 KB
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<?xml version="1.0" standalone='yes'?>
<project name="Woodstox XML processor" basedir="." default="readme">
<!-- Source directories -->
<property name="dir.src" location="${basedir}/src" />
<property name="dir.src.java" location="${dir.src}/java" />
<property name="dir.src.samples" location="${dir.src}/samples" />
<property name="dir.src.test" location="${dir.src}/test" />
<property name="dir.resource" location="${dir.src}/resources" />
<property name="dir.releasenotes" location="${basedir}/release-notes" />
<!-- Libs -->
<property name="dir.lib" location="${basedir}/lib" />
<!-- Build-related -->
<property name="dir.build" location="${basedir}/build" />
<property name="dir.build.classes" location="${dir.build}/classes" />
<property name="dir.build.classes.woodstox" location="${dir.build.classes}/woodstox" />
<property name="dir.build.classes.samples" location="${dir.build.classes}/samples" />
<!-- Documentation -->
<property name="dir.doc" location="${basedir}/doc" />
<property name="dir.javadoc" location="${dir.build}/javadoc" />
<!-- Test suite -->
<property name="dir.test" location="${basedir}/test" />
<property name="dir.classes.test" location="${dir.test}/classes" />
<property name="dir.test.results" location="${dir.test}/results" />
<property name="dir.test.xmlresults" location="${dir.test.results}/xml" />
<!-- Distribution -->
<property name="dir.dist" location="${basedir}/dist" />
<property name="dir.snapshot" location="${basedir}/build/snapshot" />
<!-- Version information -->
<!-- Woodstox version info: -->
<property name="IMPL_TITLE" value="Woodstox XML-processor" />
<property name="IMPL_VERSION" value="4.4.2" />
<property name="IMPL_VENDOR" value="http://woodstox.codehaus.org" />
<property name="API_TITLE" value="Stax 1.0 API" />
<property name="API_VERSION" value="1.0.0" />
<property name="API_VENDOR" value="http://jcp.org/en/jsr/detail?id=173" />
<!-- And finally version dependency spec between Woodstox core
and Stax API package.
-->
<property name="REQ_STAX2_VERSION" value="3.1.4" />
<!-- jars needed for compilation -->
<path id="classpath.compile">
<fileset dir="${dir.lib}" includes="stax-api*.jar" />
<fileset dir="${dir.lib}" includes="stax2-api*.jar" />
<fileset dir="${dir.lib}" includes="sax2.jar" />
<!-- these are needed for optional MSV-based validators -->
<fileset dir="${dir.lib}/msv" includes="*.jar" />
<!-- 17-Dec-2008, tatu: adding OSGi bundle activation
support, to register providers as services
-->
<fileset dir="${dir.lib}/osgi" includes="*.jar" />
</path>
<path id="junit-libs">
<fileset dir="${dir.lib}">
<include name="test/junit*.jar" />
</fileset>
</path>
<!-- Source files to include in source packages (tar, zip) -->
<patternset id="woodstox-dist-src-files">
<include name="src/java/com/**/*.java" />
<include name="src/samples/**/*.java" />
<include name="src/resources/*" />
<include name="build*.xml" />
<include name="project.xml" />
</patternset>
<patternset id="wstx-dist-misc-files">
<include name="src/test/**/*.java" />
<include name="src/test/**/*.xml" />
<include name="src/test/**/*.dtd" />
<include name="src/java/**/*.html" />
<include name="src/maven/*.pom" />
<include name="release-notes/*" />
<include name="release-notes/asl/*" />
<include name="release-notes/bsd/*" />
<include name="release-notes/lgpl/*" />
<!-- need jars too; at least the api jar, but let's copy
all for now... it's nice to have the unit tests in there
too. This way src packages are proper subsets of binary ones
-->
<include name="lib/*.jar" />
<include name="lib/*/*.jar" />
</patternset>
<import file="build-osgi.xml" />
<import file="build-coverage.xml" />
<import file="build-maven-deploy.xml" />
<import file="repackage-msv.xml" />
<!--*********************************************************************-->
<!-- The readme target shows a brief description of all targets -->
<!-- supported by this ant build file -->
<!--*********************************************************************-->
<target name="readme">
<echo message = "${ant.project.name}'s Available Targets" />
<echo message = "---------------------------------------------------" />
<echo message = "1) readme - Displays this information (default target)." />
<echo message = "2) clean - Remove any generated files/directories." />
<echo message = "3) compile - Compile all ${ant.project.name} code (including tests and samples)" />
<echo message = "4) jars - Compile and create all jars for non-test ${ant.project.name} code (see build.xml for specific ones)." />
<echo message = "5) javadoc - Generate ${ant.project.name} code documentation." />
<echo message = " for JUnit tests." />
<echo message = "6) test - Run JUnit tests." />
<echo message = "7) dist - Create distribution directory and copy necessary files there" />
<echo message = "8) all - Run the clean, compile, javadoc," />
<echo message = " test and dist targets." />
<echo message = "" />
<echo message = "Available command-line arguments:" />
<echo message = "---------------------------------" />
<echo message = "-Dlicense : allowed values 'asl', 'lgpl' (chooses license to use for jars)" />
</target>
<target name="prepare">
<!-- make build directories -->
<mkdir dir="${dir.build}" />
<mkdir dir="${dir.build.classes}" />
<mkdir dir="${dir.build.classes.woodstox}" />
<mkdir dir="${dir.build.classes.samples}" />
<!-- make docs directories -->
<mkdir dir="${dir.doc}" />
<mkdir dir="${dir.javadoc}" />
<!-- make test output directories -->
<mkdir dir="${dir.test}" />
<mkdir dir="${dir.classes.test}" />
<mkdir dir="${dir.test.results}" />
<mkdir dir="${dir.test.xmlresults}" />
<!-- and finally distribution dir -->
<mkdir dir="${dir.dist}" />
<mkdir dir="${dir.snapshot}" />
</target>
<!-- ***********************************************
- supporting dummy tasks
- ***********************************************-->
<!-- This task ensures that license is either set to a
- valid value, or can use the default (ASL)
-->
<target name="check_license">
<!-- Let's set license to default ("asl") if not
explicitly specified on command-line args
-->
<property name="license" value="asl" />
<!-- And then check that explicitly set one was valid
- (default one will always be....)
-->
<condition property="license_ok">
<or>
<equals arg1="${license}" arg2="asl" />
<equals arg1="${license}" arg2="lgpl" />
</or>
</condition>
<fail unless="license_ok"
message="Unrecognized license property value '${license}': excepted either 'asl' (for ASL2.0) or 'lgpl' (for LGPL2.1)"
/>
<echo message="Ok, using license '${license}' for jar(s)." />
</target>
<!-- ***********************************************
- clean - Removes all generated files/directories
- ***********************************************-->
<target name="clean">
<delete dir="${dir.build}"/>
<delete dir="${dir.doc}"/>
<delete dir="${dir.test}"/>
<delete dir="${dir.dist}"/>
<delete file="cobertura.ser" />
</target>
<target name="compile" depends="compile.woodstox, compile.samples, compile.test" />
<target name="compile.woodstox" depends="prepare,copy-resources">
<javac srcdir="${dir.src.java}" destdir="${dir.build.classes.woodstox}"
includeantruntime="false"
source="1.4" target="1.4"
debug="true"
>
<!-- Uncomment to see warnings: too verbose for default, due to deprecation warns
<compilerarg value="-Xlint:deprecation" />
-->
<include name="com/ctc/**/*.java" />
<include name="test/**/*.java" />
<classpath refid="classpath.compile" />
</javac>
</target>
<target name="compile.samples" depends="compile.woodstox">
<!-- 03-Aug-2006, TSa: Let's also compile samples, to ensure they
won't get obsolete with impl/api changes
-->
<javac srcdir="${dir.src.samples}" destdir="${dir.build.classes.samples}"
includeantruntime="false"
source="1.4" target="1.4">
<include name="*.java" />
<classpath refid="classpath.compile" />
</javac>
</target>
<target name="copy-resources" depends="prepare">
<mkdir dir="${dir.build.classes.woodstox}/META-INF/services" />
<copy toDir="${dir.build.classes.woodstox}/META-INF/services">
<fileset dir="${dir.resource}">
<include name="javax.xml.stream.*" />
<include name="org.codehaus.stax2.*" />
</fileset>
</copy>
</target>
<!-- Dummy target that just includes all individual jars...
(OSGi ones from included file)
-->
<target name="jars" depends="jars.osgi, jar.stax2test, repackage-msv" />
<!-- This jar is only needed for testing purposes, to specify
- which Stax implementation to use
-->
<target name="jar.resources" depends="compile,copy-resources">
<jar jarfile="${dir.build}/service-def-${IMPL_VERSION}.jar" filesonly="true" >
<fileset dir="${dir.build.classes.woodstox}">
<include name="META-INF/services/*" />
</fileset>
</jar>
</target>
<!-- 15-Mar-2008, TSa: Let's also package up Stax2 compatibility
test suite, for other stax2 impls to use
-->
<target name="jar.stax2test" depends="compile.test">
<jar jarfile="${dir.build}/stax2test-${REQ_STAX2_VERSION}.jar" filesonly="true" compress="true">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="${dir.classes.test}">
<include name="org/codehaus/stax/test/**/*.class" />
<include name="stax2/**/*.class" />
</fileset>
</jar>
</target>
<target name="javadoc" depends="prepare">
<!-- Build a dirpath that contains just the "source" tree -->
<javadoc windowtitle="${ant.project.name}"
destdir="${dir.javadoc}"
author="true"
version="true">
<packageset dir="${dir.src.java}" defaultexcludes="yes">
<include name="com/ctc/**" />
</packageset>
<classpath refid="classpath.compile" />
<!-- Need to link Stax API and regular JDK 5 classes -->
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
<link href="http://woodstox.codehaus.org/javadoc/stax-api/1.0" />
<group title="Woodstox" packages="com.ctc.wstx*" />
</javadoc>
</target>
<target name="dist" depends="compile,jars,javadoc">
<!-- First, let's copy the binary jars to dist -->
<copy todir="${dir.dist}">
<fileset dir="${dir.build}" includes="woodstox*.jar" />
<fileset dir="${dir.lib}/msv" includes="msv-core*.jar" />
<fileset dir="${dir.lib}/msv" includes="xsdlib*.jar" />
</copy>
<!-- Including MSV jars (note: ones we have repackaged)
-->
<copy todir="${dir.dist}">
<fileset dir="${dir.build}" includes="woodstox-msv-*.jar" />
</copy>
<!-- Then let's create the source distribution tar packages
-->
<property name="SRC_CORE" value="woodstox-core-src-${IMPL_VERSION}" />
<!-- Need to first copy to a tmp dir, to get the additional
directory (so tar/zip contents won't explode directly
in current dir)
-->
<property name="DIR_CORE" value="woodstox-${IMPL_VERSION}" />
<delete dir="${dir.build}/${DIR_CORE}" />
<mkdir dir="${dir.build}/${DIR_CORE}" />
<copy todir="${dir.build}/${DIR_CORE}">
<fileset dir="${basedir}">
<patternset refid="woodstox-dist-src-files" />
<patternset refid="wstx-dist-misc-files" />
</fileset>
</copy>
<delete file="${dir.dist}/${SRC_CORE}.tar.gz" />
<tar basedir="${dir.build}"
includes="${DIR_CORE}/**"
destfile="${dir.dist}/${SRC_CORE}.tar.gz"
compression="gzip"
/>
<!-- as well as zip -->
<zip basedir="${dir.build}"
includes="${DIR_CORE}/**"
destfile="${dir.dist}/${SRC_CORE}.zip"
/>
<!-- And create source jars for IDE support -->
<!-- Can't really use patternset, as that'd include "src/java" -->
<jar basedir="${dir.src.java}" filesonly="true" compress="true"
destfile="${dir.dist}/woodstox-core-asl-${IMPL_VERSION}-sources.jar"
includes="com/**/*.java"
/>
<jar basedir="${dir.src.java}" filesonly="true" compress="true"
destfile="${dir.dist}/woodstox-core-lgpl-${IMPL_VERSION}-sources.jar"
includes="com/ctc/wstx/**/*.java"
/>
<!-- Then copy javadocs -->
<copy todir="${dir.dist}">
<fileset dir="${dir.javadoc}/.." includes="javadoc/**/*" />
</copy>
<!-- And to appease gods of Maven, need to create somewhat bogus jars
(since they are not appropriately split)
-->
<jar destfile="${dir.dist}/woodstox-core-asl-${IMPL_VERSION}-javadoc.jar"
filesonly="true" compress="true" basedir="${dir.javadoc}" includes="**/*.*"
/>
<jar destfile="${dir.dist}/woodstox-core-lgpl-${IMPL_VERSION}-javadoc.jar"
filesonly="true" compress="true" basedir="${dir.javadoc}" includes="**/*.*"
/>
<!-- Plus, let's also just copy README and compatibility files, in
addition to being included in source package
-->
<copy todir="${dir.dist}" >
<fileset dir="." includes="release-notes/*" />
<fileset dir="." includes="release-notes/asl/*" />
<fileset dir="." includes="release-notes/bsd/*" />
<fileset dir="." includes="release-notes/lgpl/*" />
</copy>
<!-- And also additional Maven stuff -->
<copy todir="${dir.dist}">
<fileset dir="${dir.src}/maven" includes="w*.pom" />
<globmapper from="*.pom" to="*-${IMPL_VERSION}.pom" />
<filterset>
<filter token="VERSION" value="${IMPL_VERSION}" />
<filter token="REQ_STAX2_VERSION" value="${REQ_STAX2_VERSION}" />
</filterset>
</copy>
<copy todir="${dir.snapshot}">
<fileset dir="${dir.src}/maven" includes="w*.pom" />
<globmapper from="*.pom" to="*-${IMPL_VERSION}-SNAPSHOT.pom" />
<filterset>
<filter token="VERSION" value="${IMPL_VERSION}-SNAPSHOT" />
<filter token="REQ_STAX2_VERSION" value="${REQ_STAX2_VERSION}-SNAPSHOT" />
</filterset>
</copy>
<!-- Let's also validate well-formedness of resulting POM files -->
<xmlvalidate lenient="true">
<!-- lenient: check only well-formedness, no dtd/schema (yet?) -->
<fileset dir="${dir.dist}" includes="*.pom" />
<fileset dir="${dir.snapshot}" includes="*.pom" />
</xmlvalidate>
</target>
<target name="all" depends="clean,javadoc,test,dist">
<!-- This target simply depends on others to do its job -->
</target>
<!--*********************************************************************-->
<!-- Tasks from here down are in support of junit tests. -->
<!--*********************************************************************-->
<target name="all-tests" depends="test" />
<!-- Running a single Unit Test -->
<target name="test.single" depends="compile.test">
<fail unless="test" message="Must define -Dtest" />
<!-- showoutput 'yes' to allow outputting debug msgs... -->
<junit fork="no" maxmemory="128M" showoutput="yes" printsummary="yes">
<formatter type="plain" usefile="no" />
<test name="${test}" />
<classpath refid="classpath.compile" />
<classpath>
<pathelement path="${dir.build.classes.woodstox}" />
<pathelement location="${dir.classes.test}" />
<path refid="junit-libs"/>
</classpath>
</junit>
</target>
<!-- Compiling and running Woodstox-specific tests
- (including, for now, Stax2 tests)
-->
<target name="compile.test" depends="compile.woodstox">
<javac srcdir="${dir.src.test}" destdir="${dir.classes.test}"
includeantruntime="false"
source="1.4" target="1.4"
debug="true"
>
<include name="**/*.java" />
<classpath refid="classpath.compile" />
<classpath>
<pathelement path="${dir.build.classes.woodstox}"/>
<path refid="junit-libs"/>
</classpath>
</javac>
<!-- 08-Jun-2009, tatu: need to copy some test files too -->
<copy todir="${dir.classes.test}">
<fileset dir="${dir.src.test}">
<include name="**/*.wsdl" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="test" depends="compile.test">
<!-- showoutput 'yes' to allow outputting debug msgs... -->
<junit fork="yes" forkmode="once" maxmemory="128M"
printsummary="yes" haltonfailure="no" showoutput="yes">
<batchtest fork="yes" todir="${dir.test.xmlresults}">
<fileset dir="${dir.classes.test}">
<!-- Need to exclude inner classes... -->
<exclude name="**/*$*.class"/>
<include name="**/Test*.class"/>
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="classpath.compile" />
<classpath>
<pathelement path="${dir.build.classes.woodstox}" />
<pathelement location="${dir.classes.test}" />
<path refid="junit-libs"/>
</classpath>
</junit>
<junitreport todir="${dir.test.results}">
<fileset dir="${dir.test.xmlresults}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${dir.test.results}" />
</junitreport>
</target>
</project>