-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.xml
428 lines (360 loc) · 16.5 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
<?xml version='1.0'?>
<project name="juxy" default="compile" basedir=".">
<property name="src.dir" location="${basedir}/src"/>
<property name="tests.dir" location="${basedir}/tests"/>
<property name="xmltests.dir" location="${basedir}/xmlTest"/>
<property name="classes.dir" location="${basedir}/classes"/>
<property name="test.classes.dir" location="${basedir}/test-classes"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="tools.dir" location="${basedir}/tools"/>
<property name="depcache.dir" location="${basedir}/depcache"/>
<property name="build.dir" location="${basedir}/build"/>
<!-- emma coverage properties -->
<property name="instr.classes.dir" location="${basedir}/instr-classes"/>
<property name="coverage.report.dir" location="${basedir}/cvgreport"/>
<property name="metrics.file" location="${basedir}/metrics.txt"/>
<path id="compile.classpath">
<pathelement path="${classes.dir}"/>
<fileset dir="${lib.dir}" >
<include name="*.jar"/>
</fileset>
<pathelement path="${tools.dir}/junit.jar"/>
</path>
<path id="compile-tests.classpath">
<path refid="compile.classpath"/>
<pathelement path="${tools.dir}/ant-testutil.jar"/>
</path>
<path id="test.classpath">
<pathelement path="${tests.dir}/xml/resolver/resources.jar"/> <!-- for testing of URI resolution -->
<pathelement path="${test.classes.dir}"/>
<pathelement path="${tests.dir}/xml/resolver/resources2.jar"/> <!-- for testing of URI resolution -->
<path refid="compile-tests.classpath"/>
</path>
<path id="oracle.xdk.test.classpath">
<pathelement path="${test.classes.dir}"/>
<pathelement path="${classes.dir}"/>
<pathelement path="${lib.dir}/xmlparserv2.jar"/>
<fileset dir="${lib.dir}" >
<include name="*.jar"/>
<exclude name="xerces*.jar"/>
<exclude name="xalan*.jar"/>
<exclude name="saxon*.jar"/>
</fileset>
<pathelement path="${tools.dir}/junit.jar"/>
<pathelement path="${tools.dir}/ant-testutil.jar"/>
</path>
<path id="instr.classpath">
<pathelement path="${classes.dir}"/>
</path>
<path id="run-instr-tests.classpath">
<pathelement path="${tests.dir}/xml/resolver/resources.jar"/> <!-- for testing of URI resolution -->
<pathelement location="${instr.classes.dir}/classes"/>
<pathelement location="${test.classes.dir}"/>
<pathelement path="${tests.dir}/xml/resolver/resources2.jar"/> <!-- for testing of URI resolution -->
<fileset dir="${lib.dir}" >
<include name="*.jar"/>
</fileset>
<pathelement path="${tools.dir}/junit.jar"/>
<path refid="emma.lib"/>
</path>
<target name="init">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${test.classes.dir}"/>
<mkdir dir="${test.classes.dir}/META-INF"/>
</target>
<target name="clean" description="Cleans up all compiled classes">
<delete dir="${classes.dir}" failonerror="false" />
<delete dir="${depcache.dir}" failonerror="false"/>
<delete dir="${instr.classes.dir}" failonerror="false"/>
<delete dir="${test.classes.dir}" failonerror="false"/>
<delete dir="${build.dir}" failonerror="false"/>
<delete dir="${coverage.report.dir}" failonerror="false"/>
<delete file="coverage.ec"/>
<delete file="coverage.em"/>
</target>
<target name="compile-src" depends="init">
<depend srcdir="${src.dir}" destdir="${classes.dir}" cache="${depcache.dir}" closure="no"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
includes="org/**"
classpathref="compile.classpath"
debug="true"
source="1.4"
/>
</target>
<target name="compile-tests" depends="compile-src">
<depend srcdir="${tests.dir}" destdir="${test.classes.dir}" cache="${depcache.dir}" closure="no"/>
<javac srcdir="${tests.dir}" destdir="${test.classes.dir}"
includes="org/**"
classpathref="compile-tests.classpath"
debug="true"
source="1.4"
/>
<copy todir="${test.classes.dir}/META-INF">
<fileset dir="${tests.dir}/META-INF">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${test.classes.dir}/xml">
<fileset dir="${tests.dir}/xml">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="compile-x2j" depends="init">
<xslt basedir="${xmltests.dir}" destdir="${build.dir}/java"
style="${xmltests.dir}/x2j.xsl">
<mapper type="regexp" from="^([A-Z][A-Za-z0-9]*).xml" to="\1.java"/>
</xslt>
</target>
<target name="compile-xmltests" depends="init, compile-x2j">
<depend srcdir="${build.dir}/java" destdir="${test.classes.dir}" cache="${depcache.dir}" closure="no"/>
<javac srcdir="${build.dir}/java" destdir="${test.classes.dir}"
includes="*"
classpathref="compile.classpath"
debug="true"
source="1.4"
/>
</target>
<target name="compile" depends="init, compile-src, compile-tests, compile-xmltests" />
<target name="remake" depends="clean, test-all" description="Remakes all source codes and runs all tests"/>
<fileset id="all.tests.except.verifier" dir="${tests.dir}">
<include name="org/**/UTest*.java" />
<exclude name="org/**/UTestVerifierTask.java" />
</fileset>
<fileset id="verifier.task.tests" dir="${tests.dir}">
<include name="org/**/UTestVerifierTask.java" />
</fileset>
<path id="verifiertask.test.classpath">
<fileset dir="${lib.dir}">
<include name="saxon*.jar"/>
<include name="xerces*.jar"/>
</fileset>
<pathelement path="${test.classes.dir}"/>
<pathelement path="${tools.dir}/ant-testutil.jar"/>
</path>
<target name="test-verifiertask">
<ut files="verifier.task.tests"
jvmargs="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl"
classpath="verifiertask.test.classpath"/>
<!--
<antcall target="ut">
<param name="files" value="verifier.task.tests"/>
<param name="jvmargs" value="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl"/>
<param name="classpath" value="verifiertask.test.classpath"/>
</antcall>
-->
</target>
<target name="test-all" depends="compile" description="Runs all tests under the Xalan and Saxon engines" >
<echo message="Running tests with Oracle XDK ..."/>
<ut files="all.tests.except.verifier"
jvmargs="-Djavax.xml.parsers.DocumentBuilderFactory=oracle.xml.jaxp.JXDocumentBuilderFactory -Djavax.xml.parsers.SAXParserFactory=oracle.xml.jaxp.JXSAXParserFactory -Dorg.xml.sax.driver=oracle.xml.jaxp.JXSAXParser -Djavax.xml.transform.TransformerFactory=oracle.xml.jaxp.JXSAXTransformerFactory"
classpath="test.classpath"/>
<echo message="Running tests with Saxon XSLT ..."/>
<ut files="all.tests.except.verifier"
jvmargs="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl"
classpath="test.classpath"/>
<echo message="Running tests with Java 1.5 XSLTC ..."/>
<ut files="all.tests.except.verifier"
jvmargs="-Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"
classpath="test.classpath"/>
<echo message="Running tests with Xalan XSLTC ..."/>
<ut files="all.tests.except.verifier"
jvmargs="-Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl"
classpath="test.classpath"/>
<echo message="Running tests with Xalan XSLT ..."/>
<ut files="all.tests.except.verifier"
jvmargs="-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"
classpath="test.classpath"/>
<!-- run unit tests for veriier task -->
<antcall target="test-verifiertask"/>
</target>
<target name="test-xml" depends="compile-xmltests" description="Runs all XML tests" >
<echo message=""/>
<echo message="Starting XML tests..."/>
<path id="run.classpath">
<path refid="compile.classpath"/>
<pathelement path="${test.classes.dir}"/>
</path>
<mkdir dir="${build.dir}/reports"/>
<junit printsummary="yes" haltonfailure="yes" fork="yes"
showoutput="yes">
<jvmarg value="-ea"/>
<jvmarg value="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl"/>
<classpath refid="run.classpath" />
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.dir}/reports">
<fileset dir="${build.dir}/java">
<include name="*.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${build.dir}/reports">
<fileset dir="${build.dir}/reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.dir}/reports/html"/>
</junitreport>
</target>
<target name="ut">
<junit printsummary="yes" haltonfailure="no" fork="yes" forkmode="once" showoutput="false">
<jvmarg line="-ea ${jvmargs}"/>
<classpath refid="${classpath}" />
<formatter type="plain" usefile="false"/>
<batchtest fork="yes">
<fileset refid="${files}"/>
</batchtest>
</junit>
</target>
<target name="build" description="Creates Juxy build" >
<property file="${basedir}/build.properties"/>
<copy file="${src.dir}/org/tigris/juxy/Version.tpl" tofile="${src.dir}/org/tigris/juxy/Version.java" overwrite="true"/>
<replace file="${src.dir}/org/tigris/juxy/Version.java" token="@@version" value="${version}"/>
<antcall target="clean"/>
<antcall target="test-all"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/lib"/>
<mkdir dir="${build.dir}/doc"/>
<copy file="${basedir}/www/index.html" todir="${build.dir}/doc" />
<antcall target="doc">
<param name="doc.dir" location="${build.dir}/doc/javadoc"/>
</antcall>
<copy file="${basedir}/samples-build.xml" tofile="${build.dir}/build.xml" />
<copy todir="${build.dir}/lib">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<exclude name="saxon*.jar"/>
<exclude name="xmlparserv2.jar"/>
</fileset>
</copy>
<copy todir="${build.dir}">
<fileset dir="${basedir}">
<include name="samples/**"/>
<include name="License.txt"/>
<include name="samples.catalog"/>
</fileset>
</copy>
<jar destfile="${build.dir}/juxy.jar" basedir="${classes.dir}" includes="org/**" excludes="org/**/verifier/**">
<manifest>
<attribute name="Version" value="${version}"/>
</manifest>
</jar>
<jar destfile="${build.dir}/juxy_ant.jar">
<manifest>
<attribute name="Version" value="${version}"/>
</manifest>
<fileset dir="${classes.dir}" includes="org/**/verifier/**"/>
<fileset dir="${classes.dir}" includes="org/tigris/juxy/util/SAXUtil.class, org/tigris/juxy/util/JuxyURIResolver.class, org/tigris/juxy/util/ExceptionUtil.class"/>
<fileset dir="${classes.dir}" includes="org/tigris/juxy/XSLTKeys.class, org/tigris/juxy/Version.class, org/tigris/juxy/JuxyRuntimeException.class"/>
<fileset dir="${basedir}" includes="juxy_ant.properties"/>
</jar>
<ant dir="${build.dir}" antfile="build.xml" target="run-samples" inheritall="false" inheritrefs="false" />
<jar destfile="${build.dir}/juxy_src.jar">
<manifest>
<attribute name="Version" value="${version}"/>
</manifest>
<fileset dir="${src.dir}" includes="org/**"/>
</jar>
<zip file="juxy-${version}.zip">
<fileset dir="${build.dir}">
<include name="**/*"/>
</fileset>
</zip>
</target>
<target name="doc" depends="init" description="Creates javadoc, specify -Ddoc.dir for javadoc directory">
<condition property="doc.dir" value="${basedir}/apidocs" >
<not><isset property="doc.dir"/></not>
</condition>
<mkdir dir="${doc.dir}"/>
<property file="${basedir}/api-files.properties"/>
<javadoc sourcefiles="${api-files}"
destdir="${doc.dir}"
packagenames="org.tigris.juxy.*"
windowtitle="Juxy - XSLT unit testing from Java"
package="true" >
<classpath refid="compile.classpath" />
</javadoc>
</target>
<!-- ================================================== -->
<!-- generates project metrics -->
<!-- ================================================== -->
<target name="metrics" description="generates metrics for the project">
<taskdef name="javancss" classname="javancss.JavancssAntTask">
<classpath>
<pathelement location="${tools.dir}/javancss.jar"/>
<pathelement location="${tools.dir}/ccl.jar"/>
<pathelement location="${tools.dir}/jhbasic.jar"/>
</classpath>
</taskdef>
<javancss srcdir="${src.dir}" includes="**/*.java/"
generateReport="true"
outputfile="${metrics.file}"
format="plain"/>
</target>
<path id="emma.lib" >
<pathelement location="${tools.dir}/emma.jar" />
<pathelement location="${tools.dir}/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
<target name="init-coverage" depends="clean" >
<mkdir dir="${coverage.report.dir}"/>
<mkdir dir="${instr.classes.dir}"/>
</target>
<target name="coverage-ut">
<junit printsummary="yes" haltonfailure="yes" fork="no" showoutput="yes">
<jvmarg line="-ea"/>
<sysproperty key="javax.xml.transform.TransformerFactory" value="net.sf.saxon.TransformerFactoryImpl"/>
<classpath refid="run-instr-tests.classpath" />
<formatter type="plain" usefile="false"/>
<batchtest fork="yes">
<fileset refid="all.tests.except.verifier"/>
</batchtest>
</junit>
</target>
<target name="coverage-report">
<emma enabled="true">
<report sourcepath="${src.dir}" >
<infileset dir="${basedir}" includes="*.em, *.ec" />
<txt outfile="${coverage.report.dir}/coverage.txt" />
<html outfile="${coverage.report.dir}/coverage.html" />
</report>
</emma>
</target>
<target name="coverage-instr">
<emma enabled="true">
<instr instrpathref="instr.classpath"
destdir="${instr.classes.dir}"
merge="no"
mode="fullcopy"/>
</emma>
</target>
<target name="coverage" depends="init-coverage" description="Measures tests coverage">
<antcall target="compile-tests"/>
<antcall target="coverage-instr"/>
<antcall target="coverage-ut"/>
<antcall target="coverage-report"/>
</target>
<macrodef name="ut">
<attribute name="files" default="all.tests.except.verifier"/>
<attribute name="jvmargs"/>
<attribute name="classpath" default="test.classpath"/>
<sequential>
<junit printsummary="yes" haltonfailure="no" fork="yes" forkmode="once" showoutput="false">
<jvmarg line="-ea @{jvmargs}"/>
<classpath refid="@{classpath}" />
<formatter type="plain" usefile="false"/>
<batchtest fork="yes">
<fileset refid="@{files}"/>
</batchtest>
</junit>
</sequential>
</macrodef>
<target name="svn-tag">
<exec
executable="svn">
<arg value="cp"/>
<arg value="-m'Tagging Juxy ${version}.'"/>
<arg value="http://juxy.tigris.org/svn/juxy/trunk"/>
<arg value="http://juxy.tigris.org/svn/juxy/tags/${version}"/>
</exec>
</target>
</project>