~pbms-core/pbms/async_read

« back to all changes in this revision

Viewing changes to mybs/java/build.xml

  • Committer: paul-mccullagh
  • Date: 2008-03-26 11:35:17 UTC
  • Revision ID: paul-mccullagh-afb1610c21464a577ae428d72fc725eb986c05a5
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version='1.0'?>
 
2
<!--
 
3
   Copyright (C) 2002-2005 MySQL AB
 
4
 
 
5
   This program is free software; you can redistribute it and/or modify
 
6
   it under the terms of version 2 of the GNU General Public License as 
 
7
   published by the Free Software Foundation.
 
8
 
 
9
   There are special exceptions to the terms and conditions of the GPL 
 
10
   as it is applied to this software. View the full text of the 
 
11
   exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
 
12
   software distribution.
 
13
 
 
14
   This program is distributed in the hope that it will be useful,
 
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
   GNU General Public License for more details.
 
18
 
 
19
   You should have received a copy of the GNU General Public License
 
20
   along with this program; if not, write to the Free Software
 
21
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
-->
 
23
 
 
24
<!-- version $Id: build.xml 6428 2007-05-15 17:38:53Z mmatthews $ -->
 
25
 
 
26
<project name="MySQL Connector/J" default="dist" basedir=".">
 
27
        <property name="major_version" value="5"/>
 
28
        <property name="minor_version" value="0"/>
 
29
        <property name="subminor_version" value="7"/>
 
30
        <property name="version_status" value="se"/>
 
31
 
 
32
        <property name="version" value="${major_version}.${minor_version}.${subminor_version}${version_status}"/>
 
33
        <property name="prodName" value="mysql-connector-java"/>
 
34
        <property name="extra.version" value=""/>
 
35
        <property name="full.version" value="${version}${extra.version}"/>
 
36
        <property name="fullProdName" value="${prodName}-${version}${extra.version}"/>
 
37
        <property name="sourceDir" value="./src"/>
 
38
        <property name="buildDir" value="./build"/>
 
39
        <property name="distDir" value="./dist"/>
 
40
        <property name="junit.results" value="${buildDir}/junit"/>
 
41
        <property name="debug.enable" value="on" />
 
42
 
 
43
        <!-- 
 
44
        
 
45
             The following property is needed for building the docs. It's
 
46
             set to the defaults for my development environment, but can be passed
 
47
             on the command line to ant via -D switches. 
 
48
        -->
 
49
 
 
50
        <property name="com.mysql.jdbc.docs.sourceDir" value="/home/mmatthew/work/docs/prebuilt"/>
 
51
 
 
52
        <taskdef resource="net/sf/antcontrib/antlib.xml">
 
53
                <classpath>
 
54
                        <pathelement location="${sourceDir}/lib/ant-contrib.jar"/>
 
55
                </classpath>
 
56
        </taskdef>
 
57
 
 
58
        <path id="built.driver.only.classpath">
 
59
                <pathelement location="${buildDir}/${fullProdName}" />
 
60
        </path>
 
61
 
 
62
        <path id="project.build.classpath">
 
63
                <fileset dir="${buildDir}/${fullProdName}/lib-nodist">
 
64
                        <include name="**/*.jar"/>
 
65
                </fileset>
 
66
 
 
67
                <fileset dir="${buildDir}/${fullProdName}/lib">
 
68
                        <include name="**/*.jar"/>
 
69
                </fileset>
 
70
 
 
71
                <pathelement location="${buildDir}/${fullProdName}" />
 
72
        </path>
 
73
 
 
74
        <target name="init" depends="-init-copy, -init-no-crypto">
 
75
                <!-- If we're building under cruise control, update ourself -->
 
76
                
 
77
                <if>
 
78
                        <isset property="cctimestamp" />
 
79
                        <then>
 
80
                                <exec executable="svn">
 
81
                                        <arg line="up" />
 
82
                                </exec>
 
83
                        </then>
 
84
                </if>
 
85
 
 
86
                <!-- We need the following for source distributions as there we
 
87
             can't dynamically alter the classpath, and not having this
 
88
                     directory present causes the build to fail -->
 
89
 
 
90
                <mkdir dir="${buildDir}/${fullProdName}/lib-nodist" />
 
91
 
 
92
                <available file="${com.mysql.jdbc.docs.sourceDir}" property="com.mysql.jdbc.docs.sourcesPresent" />
 
93
 
 
94
                <available classname="com.mchange.v2.c3p0.QueryConnectionTester" 
 
95
                        classpathref="project.build.classpath" 
 
96
                        property="com.mysql.jdbc.c3p0Present" />
 
97
 
 
98
                <available classname="org.apache.log4j.Logger" 
 
99
                        classpathref="project.build.classpath" 
 
100
                        property="com.mysql.jdbc.log4jPresent" />
 
101
 
 
102
                <available classname="org.jboss.resource.adapter.jdbc.ValidConnectionChecker" 
 
103
                        classpathref="project.build.classpath" 
 
104
                        property="com.mysql.jdbc.jbossPresent" />
 
105
        </target>
 
106
 
 
107
        <target name="-init-copy" depends="clean">
 
108
                <tstamp/>
 
109
 
 
110
                <filter token="VERSION" value="${version}"/>
 
111
 
 
112
                <copy todir="${buildDir}/${fullProdName}" filtering="true">
 
113
                        <fileset dir="${sourceDir}/" excludes="**/CVS">
 
114
                                <patternset id="classjar" >
 
115
                                        <exclude name="**/*.class*"/>
 
116
                                        <exclude name="**/*.jar"/>
 
117
                                </patternset>
 
118
                        </fileset>
 
119
 
 
120
                        <filterset>
 
121
                                <filter token="MYSQL_CJ_MAJOR_VERSION" value="${major_version}"/>
 
122
                                <filter token="MYSQL_CJ_MINOR_VERSION" value="${minor_version}"/>
 
123
                                <filter token="MYSQL_CJ_SUBMINOR_VERSION" value="${subminor_version}"/>
 
124
                                <filter token="MYSQL_CJ_VERSION_STATUS" value="${version_status}"/>
 
125
                                <filter token="MYSQL_CJ_VERSION" value="${version}"/>
 
126
                                <filter token="MYSQL_CJ_FULL_PROD_NAME" value="${fullProdName}"/>
 
127
                        </filterset>
 
128
                </copy>
 
129
 
 
130
                <copy todir="${buildDir}/${fullProdName}" filtering="false">
 
131
                        <fileset dir="${sourceDir}" excludes="**/CVS">
 
132
                                <patternset id="dojar" >
 
133
                                        <include name="**/*.jar*"/>
 
134
                                </patternset>
 
135
                        </fileset>
 
136
                </copy>
 
137
        </target>
 
138
 
 
139
        <target name="-init-no-crypto" depends="-init-copy" if="com.mysql.jdbc.noCryptoBuild">
 
140
                <copy file="${sourceDir}//lib-nodist/ExportControlledNoCrypto.notjava"
 
141
                        toFile="${buildDir}/${fullProdName}/com/mysql/jdbc/ExportControlled.java"
 
142
                        overwrite="true"/>
 
143
        </target>
 
144
 
 
145
        <!-- 
 
146
                This is the target we use to make MySQL AB GPL-licensed and binaries 
 
147
                as well as commercially-licensed binaries that include source files.
 
148
        -->
 
149
 
 
150
        <target name="full-package" description="Builds driver, binary .jar file, docs and packages (.zip, .tar.gz) suitable for distribution that _do_ contain sources" 
 
151
                depends="full-dist, -make-packages, -create-archives"/>
 
152
 
 
153
        <!-- This is the target we use to make MySQL AB Commercially-licensed binaries -->
 
154
 
 
155
        <target name="full-package-no-sources" description="Builds driver, binary .jar file, docs and packages (.zip, .tar.gz) suitable for distribution that do _not_ contain sources"
 
156
                        depends="full-dist, -make-packages, -remove-sources, -create-archives"/>
 
157
 
 
158
        <target name="full-dist" description="Builds driver, binary .jar file and docs, basically a distribution 'image'"
 
159
                depends="-dist-trace, dist, -bundle-docs"/>
 
160
 
 
161
        <target name="package" depends="dist, -make-packages, -create-archives"/>
 
162
 
 
163
        <target name="-remove-sources">
 
164
                <echo>Removing sources from ${distDir}/toArchive</echo>
 
165
                <delete>
 
166
                        <fileset dir="${distDir}/toArchive">
 
167
                                <include name="**/*.java"/>
 
168
                        </fileset>
 
169
                </delete>
 
170
 
 
171
                <delete dir="${distDir}/toArchive/${fullProdName}/src"/>
 
172
        </target>
 
173
 
 
174
        <target name="-create-archives" depends="-make-packages">
 
175
                <tar destfile="${distDir}/${fullProdName}.tar.gz"
 
176
                        compression="gzip" longfile="gnu">
 
177
                        <tarfileset dir="${toPackage}">
 
178
                                <patternset refid="non.test.sources" />
 
179
                        </tarfileset>
 
180
                </tar>
 
181
 
 
182
                <checksum file="${distDir}/${fullProdName}.tar.gz" forceOverwrite="yes" fileext=".md5"/>
 
183
 
 
184
                <delete file="${distDir}/${fullProdName}.zip"/>
 
185
 
 
186
                <zip zipfile="${distDir}/${fullProdName}.zip">
 
187
                        <fileset dir="${toPackage}">
 
188
                                <patternset refid="non.test.sources" />
 
189
                        </fileset>
 
190
                </zip>
 
191
 
 
192
                <checksum file="${distDir}/${fullProdName}.zip" forceOverwrite="yes" fileext=".md5"/>
 
193
 
 
194
                <!-- Build a Maven bundle for upload to their repository -->
 
195
 
 
196
                <checksum file="${distDir}/${fullProdName}.zip" forceOverwrite="yes" fileext=".md5"/>
 
197
 
 
198
                <tempfile destdir="${buildDir}" prefix="maven-bundle-" property="mavenUploadDir" />
 
199
 
 
200
                <mkdir dir="${mavenUploadDir}" />
 
201
 
 
202
                <copy file="${buildDir}/${fullProdName}/${fullProdName}-bin.jar"
 
203
                        toFile="${mavenUploadDir}/${fullProdName}.jar" />
 
204
 
 
205
                <copy file="${buildDir}/${fullProdName}/doc/sources/pom.xml"
 
206
                        toDir="${mavenUploadDir}" filtering="true">
 
207
                </copy>
 
208
 
 
209
                <copy file="./COPYING"
 
210
                        toDir="${mavenUploadDir}" />
 
211
 
 
212
                <copy file="./EXCEPTIONS-CONNECTOR-J"
 
213
                                        toDir="${mavenUploadDir}" />
 
214
 
 
215
                <jar jarfile="${distDir}/${fullProdName}.bundle.jar" 
 
216
                                        basedir="${mavenUploadDir}" />
 
217
        </target>
 
218
 
 
219
        <target name="-make-packages" depends="dist">
 
220
                <property name="toPackage" value="${distDir}/toArchive"/>
 
221
                <property name="packageDest" value = "${toPackage}/${fullProdName}"/>
 
222
 
 
223
                <delete dir="${toPackage}" />
 
224
                <mkdir dir="${toPackage}"/>
 
225
                <mkdir dir="${packageDest}"/>
 
226
 
 
227
                <delete file="${distDir}/${fullProdName}.tar.gz"/>
 
228
 
 
229
                <patternset id="non.test.sources" >
 
230
                        <exclude name="**/*.nb*"/>
 
231
                        <exclude name="**/*.bak"/>
 
232
                        <exclude name="**/*.*~"/>
 
233
                        <exclude name="**/lib-nodist/*"/>
 
234
                        <exclude name="**/lib-coverage/*"/>
 
235
                        <exclude name="**/clover/*"/>
 
236
                        <exclude name="**/checkstyle/*"/>
 
237
                        <exclude name="**/.*"/>
 
238
                </patternset>
 
239
 
 
240
                <copy todir="${packageDest}">
 
241
                        <fileset dir="${buildDir}/${fullProdName}"
 
242
                                includes="debug/*, docs/**, *.jar" excludes="docs/sources">
 
243
                                <patternset refid="non.test.sources"/>
 
244
                        </fileset>
 
245
 
 
246
                        <fileset dir="." includes="src/com/**, src/doc/**, src/lib/*, src/org/**, src/testsuite/**, build.xml, CHANGES, COPYING, EXCEPTIONS-CONNECTOR-J, README">
 
247
                                <patternset refid="non.test.sources"/>
 
248
                        </fileset>
 
249
                </copy>
 
250
 
 
251
                <!-- Fix CRLF for various platforms -->
 
252
                <copy file="${packageDest}/README" tofile="${packageDest}/README.txt"/>
 
253
                <copy file="${packageDest}/docs/README.txt" tofile="${packageDest}/docs/README"/>
 
254
 
 
255
                <!-- For Windows-y platforms -->
 
256
 
 
257
                <fixcrlf srcdir="${packageDest}"
 
258
                        tab="remove" tablength="8"
 
259
                        eol="crlf" includes="**/README.txt"/>
 
260
 
 
261
                <!-- For Unix-y platforms -->
 
262
 
 
263
                <fixcrlf srcdir="${packageDest}"
 
264
                                        tab="remove" tablength="8"
 
265
                                        eol="lf" includes="**/README"/>
 
266
 
 
267
                <if>
 
268
                        <isset property="com.mysql.jdbc.commercialBuild"/>
 
269
                        <then>
 
270
                                <!-- These are the GPL and FLOSS exceptions. They don't get shipped with
 
271
                                                                         commercial builds -->
 
272
 
 
273
                                <delete file="${packageDest}/COPYING"/>
 
274
                                <delete file="${packageDest}/EXCEPTIONS-CONNECTOR-J"/>
 
275
 
 
276
                                <!-- Pull in the commercial license itself -->
 
277
 
 
278
                                <copy file="${sourceDir}/lib-nodist/LICENSE.mysql" toDir="${packageDest}"/>
 
279
 
 
280
                                <loadfile property="commercialLicenseText"
 
281
                                        srcFile="${sourceDir}/lib-nodist/commercialLicense.txt"/>
 
282
                                <replaceregexp 
 
283
                                        match="Copyright.*1307.[^replaceregexp]*USA"
 
284
                                        replace="${commercialLicenseText}"
 
285
                                        flags="s">
 
286
                                        <fileset dir="${packageDest}" includes="**/*"/>
 
287
                                </replaceregexp>
 
288
                        </then>
 
289
                </if>
 
290
        </target>
 
291
 
 
292
        <target name="dist" depends="init, compile">
 
293
 
 
294
                <delete file="${buildDir}/${fullProdName}-bin.jar" />
 
295
                <delete file="${distDir}/${fullProdName}.jar" />
 
296
 
 
297
                <mkdir dir="${distDir}" />
 
298
                <mkdir dir="${buildDir}/META-INF" />
 
299
 
 
300
                <!-- JDBC-4.0 support of service provider mechanism -->
 
301
 
 
302
                <mkdir dir="${buildDir}/META-INF/services/" />
 
303
                <echo file="${buildDir}/META-INF/services/java.sql.Driver"
 
304
                        message="com.mysql.jdbc.Driver" />
 
305
 
 
306
                <manifest file="${buildDir}/META-INF/MANIFEST.MF">
 
307
                        <attribute name="Built-By" value="${user.name}" />
 
308
 
 
309
                        <section name="common">
 
310
                                <attribute name="Specification-Title" value="JDBC" />
 
311
                                <attribute name="Specification-Version" value="3.0" />
 
312
                                <attribute name="Specification-Vendor" value="Sun Microsystems Inc." />
 
313
                                <attribute name="Implementation-Title" value="MySQL Connector/J" />
 
314
                                <attribute name="Implementation-Version" value="${full.version}" />
 
315
                                <attribute name="Implementation-Vendor-Id" value="com.mysql" />
 
316
                                <attribute name="Implementation-Vendor" value="MySQL AB" />
 
317
                        </section>
 
318
                </manifest>
 
319
 
 
320
                <jar jarfile="${buildDir}/${fullProdName}/${fullProdName}-bin.jar" 
 
321
                        basedir="${buildDir}/${fullProdName}" 
 
322
                        includes="**/*.class,**/*.properties*,COPYING,README" 
 
323
                        excludes="testsuite/**" 
 
324
                        index="true" 
 
325
                        manifest="${buildDir}/META-INF/MANIFEST.MF"/>
 
326
        </target>
 
327
 
 
328
        <target name="-dist-trace" depends="init, compile-driver-trace">
 
329
 
 
330
                <delete file="${buildDir}/${fullProdName}-bin-g.jar"/>
 
331
 
 
332
                <mkdir dir="${distDir}" />
 
333
                <mkdir dir="${buildDir}/${fullProdName}/debug"/>
 
334
 
 
335
                <manifest file="${buildDir}/MANIFEST.MF">
 
336
                        <attribute name="Built-By" value="${user.name}" />
 
337
 
 
338
                        <section name="common">
 
339
                                <attribute name="Specification-Title" value="JDBC" />
 
340
                                <attribute name="Specification-Version" value="3.0" />
 
341
                                <attribute name="Specification-Vendor" value="Sun Microsystems Inc." />
 
342
                                <attribute name="Implementation-Title" value="MySQL Connector/J (trace/debug enabled)" />
 
343
                                <attribute name="Implementation-Version" value="${full-version} (trace/debug-enabled)" />
 
344
                                <attribute name="Implementation-Vendor" value="MySQL AB" />
 
345
                        </section>
 
346
                </manifest>
 
347
 
 
348
                <jar jarfile="${buildDir}/${fullProdName}/debug/${fullProdName}-bin-g.jar"
 
349
                                basedir="${buildDir}/${fullProdName}"
 
350
                                includes="**/*.class,**/*.properties*,COPYING,README"
 
351
                                excludes="testsuite/**"
 
352
                                index="true"
 
353
                                manifest="${buildDir}/MANIFEST.MF"
 
354
                        />
 
355
        </target>
 
356
 
 
357
        <target name="-bundle-docs" depends="init">
 
358
                <copy file="${com.mysql.jdbc.docs.sourceDir}/en/html/connector-j.html"
 
359
                        todir="${buildDir}/${fullProdName}/docs"
 
360
                        failonerror="true"/>
 
361
                <copy file="${com.mysql.jdbc.docs.sourceDir}/en/pdf/connector-j.pdf"
 
362
                        todir="${buildDir}/${fullProdName}/docs"
 
363
                        failonerror="true"/>
 
364
                <copy file="${com.mysql.jdbc.docs.sourceDir}/en/txt/connector-j.txt"
 
365
                        tofile="${buildDir}/${fullProdName}/docs/README.txt"
 
366
                        failonerror="true"/>
 
367
                <copy todir="${buildDir}/${fullProdName}/docs/release-test-output" failonerror="false">
 
368
                        <fileset dir="${com.mysql.jdbc.docs.sourceDir}/release-test-output" excludes="**/CVS">
 
369
                        </fileset>
 
370
                </copy>
 
371
        </target>
 
372
 
 
373
        <target name="test-all-multi" depends="compile">
 
374
                <delete dir="${buildDir}/junit" />
 
375
                <antcall target="test-multijvm" />
 
376
                <antcall target="test-compliance-multijvm" />
 
377
                
 
378
                <fail message="Tests failed. Check logs and/or reports in ${buildDir}/junit." 
 
379
                        if="tests.compliance.failed"/>
 
380
        </target>
 
381
 
 
382
        <!-- Runs compliance testsuite against multiple JVMs and server configs -->
 
383
 
 
384
        <target name="test-multijvm" depends="compile">
 
385
                <for list="1,2,3,4,5,6,7,8" param="jvm.number">
 
386
                        <sequential>
 
387
                                <if>
 
388
                                        <isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
 
389
                                        <then>
 
390
                                                <for list="1,2,3,4,5,6,7,8" param="url.number">
 
391
                                                        <sequential>
 
392
                                                                <if>
 
393
                                                                        <isset property="com.mysql.jdbc.testsuite.url.@{url.number}"/>
 
394
                                                                        <then>
 
395
                                                                                <make-output-hier 
 
396
                                                                                jdbcUrl="${com.mysql.jdbc.testsuite.url.@{url.number}}" 
 
397
                                                                                junitOutput="${junit.results}" 
 
398
                                                                                jvm="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}" 
 
399
                                                                                unitOrCompliance="unit" />
 
400
 
 
401
                                                                                <property name="test.multi.junitOut.@{url.number}" value="eraseMe" />
 
402
                                                                                <var name="test.multi.junitOut.@{url.number}" unset="true" />
 
403
 
 
404
                                                                                <loadfile srcfile="${junit.results}/hier" 
 
405
                                                                                property="test.multi.junitOut.@{url.number}" />
 
406
 
 
407
                                                                                <antcall target="test">
 
408
                                                                                        <param name="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url.@{url.number}}" />
 
409
                                                                                        <param name="test.result.prefix" value="/${test.multi.junitOut.@{url.number}}" />
 
410
                                                                                        <param name="com.mysql.jdbc.testsuite.jvm" value="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}"/>
 
411
                                                                                </antcall>
 
412
                                                                        </then>
 
413
                                                                </if>
 
414
                                                        </sequential>
 
415
                                                </for>
 
416
                                        </then>
 
417
                                </if>
 
418
                        </sequential>
 
419
                </for>
 
420
        </target>
 
421
 
 
422
        <target name="-set-test-result-prefix" unless="${test.result.prefix}">
 
423
                <property name="test.result.prefix" value=""/>
 
424
        </target>
 
425
 
 
426
        <target name="test" depends="compile, -set-test-result-prefix">
 
427
                <property name="com.mysql.jdbc.testsuite.jvm" value="java"/>
 
428
                <mkdir dir="${junit.results}"/>
 
429
                <echo message="Running unit tests against ${com.mysql.jdbc.testsuite.url} with jvm ${com.mysql.jdbc.testsuite.jvm}"/>
 
430
 
 
431
                <property name="junit.unitregress.results" value="${junit.results}/${test.result.prefix}/unitregress" />
 
432
 
 
433
                <mkdir dir="${junit.results}/${test.result.prefix}"/>
 
434
                <mkdir dir="${junit.unitregress.results}"/>
 
435
 
 
436
                <mkdir dir="${junit.unitregress.results}/report"/>
 
437
 
 
438
                <junit printSummary="yes" 
 
439
                        fork="on" 
 
440
                        forkmode="once"
 
441
                        jvm="${com.mysql.jdbc.testsuite.jvm}"
 
442
                        errorProperty="tests.failed"
 
443
                        failureProperty="tests.failed">
 
444
                        <jvmarg value="-Xmx256m" />
 
445
 
 
446
                        <!-- For java.sql.SavePoint on old JVMs -->
 
447
 
 
448
                        <jvmarg value="-Xverify:none" />
 
449
 
 
450
                        <sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>
 
451
 
 
452
                        <classpath>
 
453
                                <fileset dir="${sourceDir}/lib-nodist">
 
454
                                        <include name="**/*.jar"/>
 
455
                                </fileset>
 
456
                                <fileset dir="${buildDir}/${fullProdName}/lib">
 
457
                                        <include name="**/*.jar"/>
 
458
                                </fileset>
 
459
                                <pathelement location="${buildDir}/${fullProdName}" />
 
460
                                <pathelement path="${java.class.path}" />
 
461
                        </classpath>
 
462
 
 
463
                        <formatter type="xml"/>
 
464
 
 
465
                        <batchtest todir="${junit.unitregress.results}" >
 
466
                                <fileset dir="${buildDir}/${fullProdName}">
 
467
                                        <include name="**/*Test.java" />
 
468
                                        <exclude name="**/perf/*.java"/>
 
469
                                </fileset>
 
470
                        </batchtest>
 
471
                </junit>
 
472
 
 
473
                <junitreport todir="${junit.unitregress.results}/report">
 
474
                        <fileset dir="${junit.unitregress.results}">
 
475
                                <include name="**/TEST-*.xml"/>
 
476
                        </fileset>
 
477
                        <report format="frames" todir="${junit.unitregress.results}/report"/>
 
478
                </junitreport>
 
479
 
 
480
                <!-- Don't fail the build if we're doing multi-tests -->
 
481
                <if>
 
482
                        <equals arg1="${test.result.prefix}" arg2="" />
 
483
                        <then>
 
484
                                <fail message="Tests failed. Check logs and/or reports in ${junit.results}." if="tests.failed"/>
 
485
                        </then>
 
486
                        <else>
 
487
                                <echo message="Not checking test failures because we're doing a multi-test..." />
 
488
                        </else>
 
489
                </if>
 
490
 
 
491
        </target>
 
492
 
 
493
        <!-- Runs compliance testsuite against multiple JVMs and server configs -->
 
494
 
 
495
        <target name="test-compliance-multijvm" depends="compile">
 
496
                <for list="1,2,3,4,5,6,7,8" param="jvm.number">
 
497
                        <sequential>
 
498
                                <if>
 
499
                                        <isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
 
500
                                        <then>
 
501
                                                <for list="1,2,3,4,5,6,7,8" param="url.number">
 
502
                                                        <sequential>
 
503
                                                                <if>
 
504
                                                                        <isset property="com.mysql.jdbc.compliance.url.@{url.number}"/>
 
505
                                                                        <then>
 
506
                                                                                <make-output-hier 
 
507
                                                                                        jdbcUrl="${com.mysql.jdbc.compliance.url.@{url.number}}" 
 
508
                                                                                        junitOutput="${junit.results}"
 
509
                                                                                        jvm="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}" 
 
510
                                                                                        unitOrCompliance="compliance"/>
 
511
 
 
512
                                                                                <property name="test.compliance.multi.junitOut.@{url.number}" value="eraseMe" />
 
513
                                                                                <var name="test.compliance.multi.junitOut.@{url.number}" unset="true" />
 
514
 
 
515
                                                                                <loadfile srcfile="${junit.results}/hier" property="test.compliance.multi.junitOut.@{url.number}" />
 
516
 
 
517
                                                                                <antcall target="test-compliance">
 
518
                                                                                        <param name="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url.@{url.number}}"/>
 
519
                                                                                        <param name="com.mysql.jdbc.testsuite.jvm" value="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}"/>
 
520
                                                                                        <param name="test.result.prefix" value="/${test.compliance.multi.junitOut.@{url.number}}"/>
 
521
                                                                                </antcall>
 
522
                                                                        </then>
 
523
                                                                </if>
 
524
                                                        </sequential>
 
525
                                                </for>
 
526
                                        </then>
 
527
                                </if>
 
528
                        </sequential>
 
529
                </for>
 
530
        </target>
 
531
 
 
532
        <!-- 
 
533
        
 
534
                Tests for JDBC compliance. The JDBC compliance testsuite
 
535
            is not shipped with MySQL Connector/J as it is not licensible
 
536
            except from Sun.
 
537
             
 
538
            The properties com.mysql.jdbc.compliance.url and
 
539
            jdbc-compliance-location must be set
 
540
            prior to running this test. 
 
541
             
 
542
        -->
 
543
 
 
544
        <target name="test-compliance" depends="compile">
 
545
                <property name="com.mysql.jdbc.test.jvm" value="java"/>
 
546
                <mkdir dir="${junit.results}"/>
 
547
                <echo message="Running compliance tests against ${com.mysql.jdbc.compliance.url} with jvm ${com.mysql.jdbc.testsuite.jvm}"/>
 
548
 
 
549
                <property name="junit.compliance.results" 
 
550
                        value="${junit.results}/${test.result.prefix}/compliance"/>
 
551
 
 
552
                <mkdir dir="${junit.results}/${test.result.prefix}"/>
 
553
                <mkdir dir="${junit.compliance.results}"/>
 
554
                <mkdir dir="${junit.compliance.results}/report"/>
 
555
 
 
556
                <junit fork="on" forkmode="once"
 
557
                    printsummary="yes" jvm="${com.mysql.jdbc.testsuite.jvm}"
 
558
                        errorProperty="tests.compliance.failed"
 
559
                        failureProperty="tests.compliance.failed">
 
560
                        <jvmarg value="-Xmx256m"/>
 
561
 
 
562
                        <!-- For java.sql.SavePoint on old JVMs -->
 
563
 
 
564
                        <jvmarg value="-Xverify:none"/>
 
565
 
 
566
                        <sysproperty key="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url}"/>
 
567
 
 
568
                        <classpath>
 
569
                                <pathelement location="${buildDir}/${fullProdName}"/>
 
570
                                <fileset dir="${sourceDir}/lib-nodist">
 
571
                                        <include name="**/*.jar"/>
 
572
                                </fileset>
 
573
                                <fileset dir="${buildDir}/${fullProdName}/lib">
 
574
                                        <include name="**/*.jar"/>
 
575
                                </fileset>
 
576
                                <pathelement path="${java.class.path}" />
 
577
                                <pathelement location="${jdbc-compliance-location}"/>
 
578
                        </classpath>
 
579
 
 
580
                        <formatter type="xml"/>
 
581
 
 
582
                        <test todir="${junit.compliance.results}" 
 
583
                                name="com.mysql.jdbc.compliance.tests.BatchUpdateTest"/>
 
584
                        <test todir="${junit.compliance.results}" 
 
585
                                name="com.mysql.jdbc.compliance.tests.ConnectionTest"/>
 
586
                        <test todir="${junit.compliance.results}" 
 
587
                                name="com.mysql.jdbc.compliance.tests.DatabaseMetaDataTest"/>
 
588
                        <test todir="${junit.compliance.results}" 
 
589
                                name="com.mysql.jdbc.compliance.tests.EscapeSyntaxTest"/>
 
590
                        <test todir="${junit.compliance.results}" 
 
591
                                name="com.mysql.jdbc.compliance.tests.PreparedStatementTest"/>
 
592
                        <test todir="${junit.compliance.results}" 
 
593
                                name="com.mysql.jdbc.compliance.tests.ResultSetMetadataTest"/>
 
594
                        <test todir="${junit.compliance.results}" 
 
595
                                name="com.mysql.jdbc.compliance.tests.ResultSetTest"/>
 
596
                        <test todir="${junit.compliance.results}" 
 
597
                                name="com.mysql.jdbc.compliance.tests.StatementTest"/>
 
598
                </junit>
 
599
 
 
600
                <junitreport todir="${junit.compliance.results}/report">
 
601
                        <fileset dir="${junit.compliance.results}">
 
602
                                <include name="**/TEST-*.xml"/>
 
603
                        </fileset>
 
604
                        <report format="frames" todir="${junit.compliance.results}/report"/>
 
605
                </junitreport>
 
606
 
 
607
                <!-- Don't fail the build if we're doing multi-tests -->
 
608
                <if>
 
609
                        <equals arg1="${test.result.prefix}" arg2="" />
 
610
                        <then>
 
611
                                <fail message="Tests failed. Check logs and/or reports in ${junit.compliance.results}." if="tests.compliance.failed"/>
 
612
                        </then>
 
613
                        <else>
 
614
                                <echo message="Not checking test failures because we're doing a multi-test..." />
 
615
                        </else>
 
616
                </if>
 
617
 
 
618
        </target>
 
619
 
 
620
        <target name="compile" depends="init, compile-driver, compile-testsuite, compile.integration">
 
621
        </target>
 
622
 
 
623
        <target name="compile-trace" depends="init, compile-driver-trace">
 
624
        </target>
 
625
 
 
626
        <!-- Compiles the driver itself -->
 
627
 
 
628
        <target name="compile-driver" depends="init, -clean-output">
 
629
                <javac srcdir="${buildDir}/${fullProdName}" 
 
630
                        destdir="${buildDir}/${fullProdName}" 
 
631
                        deprecation="off" 
 
632
                        debug="${debug.enable}" 
 
633
                        excludes="testsuite/**, 
 
634
                           java.java,
 
635
                           mybsj.java,
 
636
                           com/mysql/jdbc/integration/**,
 
637
                           com/mysql/jdbc/log/Log4JLogger.java">
 
638
                        <classpath refid="project.build.classpath" />
 
639
                </javac>
 
640
        </target>
 
641
 
 
642
        <!-- Compiles a version of the driver with AspectJ tracing -->
 
643
 
 
644
        <target name="compile-driver-trace" depends="init">
 
645
                <taskdef 
 
646
                              resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
 
647
                        <classpath>
 
648
                                <pathelement location="${sourceDir}/lib/aspectjtools.jar"/>
 
649
                        </classpath>
 
650
                </taskdef>
 
651
 
 
652
 
 
653
                <iajc destDir="${buildDir}/${fullProdName}">
 
654
                        <sourceroots>
 
655
                                <pathelement location="${buildDir}/${fullProdName}/org"/>
 
656
                                <pathelement location="${buildDir}/${fullProdName}/com"/>
 
657
                        </sourceroots>
 
658
                        <classpath refid="project.build.classpath"/>
 
659
                        <classpath>
 
660
                                <pathelement location="${sourceDir}/lib/aspectjtools.jar"/>
 
661
                        </classpath>
 
662
                </iajc>
 
663
        </target>
 
664
 
 
665
        <!-- Compiles integration 'helpers' for third-party software -->
 
666
        <target name="compile.integration" 
 
667
                depends="compile-driver, 
 
668
                                 compile-integration-c3p0, 
 
669
                         compile-integration-jboss,
 
670
                                 compile-integration-log4j"/>
 
671
 
 
672
        <target name="compile-integration-c3p0" 
 
673
                depends="compile-driver"
 
674
                if="com.mysql.jdbc.c3p0Present">
 
675
                <javac srcdir="${buildDir}/${fullProdName}" 
 
676
                                destdir="${buildDir}/${fullProdName}" 
 
677
                                deprecation="off" 
 
678
                                debug="${debug.enable}" 
 
679
                                includes="com/mysql/jdbc/integration/c3p0/**">
 
680
                        <classpath refid="project.build.classpath" />
 
681
                </javac>
 
682
        </target>
 
683
 
 
684
        <target name="compile-integration-jboss" 
 
685
                        depends="compile-driver"
 
686
                        if="com.mysql.jdbc.jbossPresent">
 
687
                <javac srcdir="${buildDir}/${fullProdName}" 
 
688
                                        destdir="${buildDir}/${fullProdName}" 
 
689
                                        deprecation="off" 
 
690
                                        debug="${debug.enable}" 
 
691
                                        includes="com/mysql/jdbc/integration/jboss/**">
 
692
                        <classpath refid="project.build.classpath" />
 
693
                </javac>
 
694
        </target>
 
695
 
 
696
        <target name="compile-integration-log4j" 
 
697
                        depends="compile-driver"
 
698
                        if="com.mysql.jdbc.log4jPresent">
 
699
                <javac srcdir="${buildDir}/${fullProdName}" 
 
700
                                destdir="${buildDir}/${fullProdName}" 
 
701
                                deprecation="off" 
 
702
                                debug="${debug.enable}" 
 
703
                                includes="com/mysql/jdbc/log/Log4JLogger.java">
 
704
                        <classpath refid="project.build.classpath" />
 
705
                </javac>
 
706
        </target>
 
707
 
 
708
        <!-- Compiles the JUnit testsuite -->
 
709
 
 
710
        <target name="compile-testsuite" depends="init, compile-driver">
 
711
                <javac 
 
712
                        srcdir="${buildDir}/${fullProdName}" 
 
713
                        destdir="${buildDir}/${fullProdName}" 
 
714
                        deprecation="off" 
 
715
                        debug="${debug.enable}"
 
716
                        includes="testsuite/**"
 
717
                        excludes="testsuite/requiresNonRedists/**">
 
718
                        <classpath refid="project.build.classpath"/>
 
719
                </javac>
 
720
        </target>
 
721
 
 
722
        <target name="real-clean">
 
723
                <delete dir="${buildDir}"/>
 
724
                <delete>
 
725
                        <fileset dir="${distDir}" 
 
726
                                includes="${fullProdName}.zip,${fullProdName}.tar.gz"/>
 
727
                </delete>
 
728
        </target>
 
729
 
 
730
        <target name="clean" unless="com.mysql.jdbc.noCleanBetweenCompiles">
 
731
                <delete dir="${buildDir}"/>
 
732
        </target>
 
733
 
 
734
        <target name="-clean-output" unless="com.mysql.jdbc.noCleanBetweenCompiles">
 
735
                <delete>
 
736
                        <fileset dir="${buildDir}" 
 
737
                                                includes="**/*.class"/>
 
738
                </delete>
 
739
        </target>
 
740
 
 
741
        <target name="docs-generate-properties-table" depends="compile-driver">
 
742
                <tempfile property="properties-xml" suffix=".xml" />
 
743
 
 
744
                <java classname="com.mysql.jdbc.util.PropertiesDocGenerator"
 
745
                        output="${properties-xml}" classpath="${buildDir}/${fullProdName}"/>
 
746
                <tempfile property="docsPropXslTempfile" suffix="xsl"/>
 
747
                <copy file="${buildDir}/${fullProdName}/doc/sources/connPropsToDocbook.xsl" tofile="${docsPropXslTempfile}"/>
 
748
 
 
749
                <style in="${properties-xml}" style="${docsPropXslTempfile}"
 
750
                       out="${buildDir}/${fullProdName}/docs/sources/connPropsDocBook.xml"/>
 
751
                <delete file="${properties-xml}"/>
 
752
                <delete file="${docsPropXslTempfile}"/>
 
753
        </target>
 
754
 
 
755
        <target name="docs-generate-error-mapping-table" depends="compile-driver">
 
756
                <tempfile property="errorsMapping-xml" suffix=".xml" />
 
757
 
 
758
                <java classname="com.mysql.jdbc.util.ErrorMappingsDocGenerator"
 
759
                                output="${errorsMapping-xml}" classpath="${buildDir}/${fullProdName}"/>
 
760
                <tempfile property="docsErrorXslTempfile" suffix="xsl"/>
 
761
                <copy file="${buildDir}/${fullProdName}/doc/sources/errorMapToDocbook.xsl" tofile="${docsErrorXslTempfile}"/>
 
762
 
 
763
                <style in="${errorsMapping-xml}" style="${docsErrorXslTempfile}"
 
764
                               out="${buildDir}/${fullProdName}/docs/sources/errorMappingDocBook.xml"/>
 
765
                <delete file="${docsErrorXslTempfile}"/>
 
766
        </target>
 
767
 
 
768
        <!-- 
 
769
             Targets below this point are for code coverage and depend on
 
770
             the 'Emma' project which you can download from 
 
771
             http://emma.sourceforge.net/
 
772
        -->
 
773
 
 
774
        <target name="emma" description="turns on EMMA instrumentation/reporting" >
 
775
                <!-- directory that contains emma.jar and emma_ant.jar: -->
 
776
                <property name="emma.dir" value="${sourceDir}/lib-coverage" />
 
777
 
 
778
                <path id="emma.lib" >
 
779
                        <pathelement location="${emma.dir}/emma.jar" />
 
780
                        <pathelement location="${emma.dir}/emma_ant.jar" />
 
781
                </path>
 
782
 
 
783
                <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
 
784
 
 
785
                <property name="emma.enabled" value="true" />
 
786
                <property name="emma.coverage.dir" value="${buildDir}/${fullProdName}-coverage" />
 
787
        </target>
 
788
 
 
789
        <target name="instrument" depends="init, compile" 
 
790
                description="runs the examples" >
 
791
 
 
792
                <emma enabled="${emma.enabled}" >
 
793
                        <instr instrpathref="built.driver.only.classpath"
 
794
                     destdir="${buildDir}/${fullProdName}"      
 
795
                     metadatafile="${emma.coverage.dir}/metadata.emma"
 
796
                     merge="true"
 
797
                         mode="overwrite">
 
798
                                <filter excludes="*Test*" />
 
799
                                <filter excludes="org.junit.*" />
 
800
                        </instr>
 
801
                </emma>
 
802
 
 
803
        </target>
 
804
 
 
805
        <target name="test-emma-report" depends="test-coverage, test-coverage-compliance">
 
806
                <emma enabled="${emma.enabled}" >
 
807
                        <report sourcepath="${buildDir}/${fullProdName}" >
 
808
                                <fileset dir="${emma.coverage.dir}" >
 
809
                                        <include name="*.emma" />
 
810
                                </fileset>
 
811
 
 
812
                                <txt outfile="${emma.coverage.dir}/coverage.txt" />
 
813
                                <html outfile="${emma.coverage.dir}/coverage.html" />
 
814
                        </report>
 
815
                </emma>
 
816
        </target>
 
817
 
 
818
        <target name="test-coverage-all-report" depends="test-coverage-multijvm, test-coverage-compliance-multijvm">
 
819
                <emma enabled="${emma.enabled}" >
 
820
                        <report sourcepath="${buildDir}/${fullProdName}" >
 
821
                                <fileset dir="${emma.coverage.dir}" >
 
822
                                        <include name="*.emma" />
 
823
                                </fileset>
 
824
 
 
825
                                <txt outfile="${emma.coverage.dir}/coverage.txt" />
 
826
                                <html outfile="${emma.coverage.dir}/coverage.html" />
 
827
                        </report>
 
828
                </emma>
 
829
        </target>
 
830
 
 
831
 
 
832
        <target name="test-coverage" depends="instrument">
 
833
                <property name="com.mysql.jdbc.testsuite.jvm" value="java"/>
 
834
                <mkdir dir="${junit.results}"/>
 
835
                <echo message="Running unit tests against ${com.mysql.jdbc.testsuite.url} with jvm ${com.mysql.jdbc.testsuite.jvm}"/>
 
836
 
 
837
                <property name="junit.unitregress.results" value="${junit.results}/${test.result.prefix}/unitregress" />
 
838
 
 
839
                <mkdir dir="${junit.results}/${test.result.prefix}"/>
 
840
                <mkdir dir="${junit.unitregress.results}"/>
 
841
 
 
842
                <mkdir dir="${junit.unitregress.results}/report"/>
 
843
 
 
844
                <junit printSummary="yes" fork="on" jvm="${com.mysql.jdbc.testsuite.jvm}">
 
845
                        <jvmarg value="-Xmx256m" />
 
846
                        <jvmarg value="-Xverify:none" />
 
847
                        <!-- For java.sql.SavePoint on old JVMs -->
 
848
                        <jvmarg value="-Demma.coverage.out.file=${emma.coverage.dir}/coverage.emma" />
 
849
                        <jvmarg value="-Demma.coverage.out.merge=true" />
 
850
                        <sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>
 
851
                        <classpath>
 
852
                                <fileset dir="${sourceDir}/lib-nodist">
 
853
                                        <include name="**/*.jar"/>
 
854
                                </fileset>
 
855
                                <fileset dir="${buildDir}/${fullProdName}/lib">
 
856
                                        <include name="**/*.jar"/>
 
857
                                </fileset>
 
858
                                <pathelement location="${buildDir}/${fullProdName}" />
 
859
                                <pathelement path="${java.class.path}" />
 
860
                                <pathelement location="${emma.dir}/emma.jar" />
 
861
                                <pathelement location="${emma.dir}/emma_ant.jar" />
 
862
                        </classpath>
 
863
 
 
864
                        <formatter type="xml"/>
 
865
 
 
866
                        <batchtest fork="yes" todir="${junit.unitregress.results}">
 
867
                                <fileset dir="${buildDir}/${fullProdName}">
 
868
                                        <include name="**/*Test.java" />
 
869
                                        <exclude name="**/perf/*.java"/>
 
870
                                </fileset>
 
871
                        </batchtest>
 
872
                </junit>
 
873
 
 
874
 
 
875
                <junitreport todir="${junit.unitregress.results}/report">
 
876
                        <fileset dir="${junit.unitregress.results}">
 
877
                                <include name="**/TEST-*.xml"/>
 
878
                        </fileset>
 
879
                        <report format="frames" todir="${junit.unitregress.results}/report"/>
 
880
                </junitreport>
 
881
        </target>
 
882
 
 
883
        <target name="test-coverage-compliance" depends="instrument">
 
884
                <property name="com.mysql.jdbc.test.jvm" value="java"/>
 
885
                <mkdir dir="${junit.results}"/>
 
886
                <echo message="Running compliance tests against ${com.mysql.jdbc.compliance.url} with jvm ${com.mysql.jdbc.testsuite.jvm}"/>
 
887
 
 
888
                <property name="junit.compliance.results" 
 
889
                        value="${junit.results}/${test.result.prefix}/compliance"/>
 
890
 
 
891
                <mkdir dir="${junit.results}/${test.result.prefix}"/>
 
892
                <mkdir dir="${junit.compliance.results}"/>
 
893
                <mkdir dir="${junit.compliance.results}/report"/>
 
894
 
 
895
                <junit printsummary="yes" jvm="${com.mysql.jdbc.testsuite.jvm}">
 
896
                        <jvmarg value="-Xmx256m"/>
 
897
                        <jvmarg value="-Xverify:none"/>
 
898
                        <!-- For java.sql.SavePoint on old JVMs -->
 
899
                        <jvmarg value="-Demma.coverage.out.file=${emma.coverage.dir}/coverage.emma" />
 
900
                        <jvmarg value="-Demma.coverage.out.merge=true" />
 
901
                        <sysproperty key="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url}"/>
 
902
                        <classpath>
 
903
                                <pathelement location="${buildDir}/${fullProdName}"/>
 
904
                                <fileset dir="${sourceDir}/lib-nodist">
 
905
                                        <include name="**/*.jar"/>
 
906
                                </fileset>
 
907
                                <fileset dir="${buildDir}/${fullProdName}/lib">
 
908
                                        <include name="**/*.jar"/>
 
909
                                </fileset>
 
910
                                <pathelement path="${java.class.path}" />
 
911
                                <pathelement location="${jdbc-compliance-location}"/>
 
912
                                <pathelement location="${emma.dir}/emma.jar" />
 
913
                                <pathelement location="${emma.dir}/emma_ant.jar" />
 
914
                        </classpath>
 
915
 
 
916
                        <formatter type="xml"/>
 
917
 
 
918
 
 
919
                        <test fork="yes" todir="${junit.compliance.results}" 
 
920
                                name="com.mysql.jdbc.compliance.tests.BatchUpdateTest"/>
 
921
                        <test fork="yes" todir="${junit.compliance.results}" 
 
922
                                name="com.mysql.jdbc.compliance.tests.ConnectionTest"/>
 
923
                        <test fork="yes" todir="${junit.compliance.results}" 
 
924
                                name="com.mysql.jdbc.compliance.tests.DatabaseMetaDataTest"/>
 
925
                        <test fork="yes" todir="${junit.compliance.results}" 
 
926
                                name="com.mysql.jdbc.compliance.tests.EscapeSyntaxTest"/>
 
927
                        <test fork="yes" todir="${junit.compliance.results}" 
 
928
                                name="com.mysql.jdbc.compliance.tests.PreparedStatementTest"/>
 
929
                        <test fork="yes" todir="${junit.compliance.results}" 
 
930
                                name="com.mysql.jdbc.compliance.tests.ResultSetMetadataTest"/>
 
931
                        <test fork="yes" todir="${junit.compliance.results}" 
 
932
                                name="com.mysql.jdbc.compliance.tests.ResultSetTest"/>
 
933
                        <test fork="yes" todir="${junit.compliance.results}" 
 
934
                                name="com.mysql.jdbc.compliance.tests.StatementTest"/>
 
935
                </junit>
 
936
 
 
937
                <junitreport todir="${junit.compliance.results}/report">
 
938
                        <fileset dir="${junit.compliance.results}">
 
939
                                <include name="**/TEST-*.xml"/>
 
940
                        </fileset>
 
941
                        <report format="frames" todir="${junit.compliance.results}/report"/>
 
942
                </junitreport>
 
943
        </target>
 
944
 
 
945
        <!-- Makes output directory hierarchy based on MySQL server version,
 
946
             os information and jvm version -->
 
947
 
 
948
        <macrodef name="make-output-hier">
 
949
                <attribute name="jvm" />
 
950
                <attribute name="jdbcUrl" />
 
951
                <attribute name="unitOrCompliance" />
 
952
                <attribute name="junitOutput" />
 
953
                <sequential>
 
954
                        <java fork="true" jvm="@{jvm}" classname="com.mysql.jdbc.util.VersionFSHierarchyMaker">
 
955
 
 
956
                                <jvmarg value="-Xmx256m" />
 
957
                                <jvmarg value="-Xverify:none" />
 
958
                                <!-- For java.sql.SavePoint on old JVMs -->
 
959
                                <jvmarg value="-Demma.coverage.out.file=${emma.coverage.dir}/coverage.emma" />
 
960
                                <jvmarg value="-Demma.coverage.out.merge=true" />
 
961
 
 
962
                                <sysproperty key="com.mysql.jdbc.testsuite.url" value="@{jdbcUrl}" />
 
963
 
 
964
                                <classpath>
 
965
                                        <fileset dir="${sourceDir}/lib-nodist">
 
966
                                                <include name="**/*.jar" />
 
967
                                        </fileset>
 
968
                                        <fileset dir="${buildDir}/${fullProdName}/lib">
 
969
                                                <include name="**/*.jar" />
 
970
                                        </fileset>
 
971
                                        <pathelement location="${buildDir}/${fullProdName}" />
 
972
                                        <pathelement path="${java.class.path}" />
 
973
                                        <pathelement location="${emma.dir}/emma.jar" />
 
974
                                        <pathelement location="${emma.dir}/emma_ant.jar" />
 
975
                                </classpath>
 
976
                                <arg line="@{unitOrCompliance} @{junitOutput} @{junitOutput}/hier" />
 
977
                        </java>
 
978
                </sequential>
 
979
        </macrodef>
 
980
 
 
981
        <!-- Runs compliance testsuite against multiple JVMs and 
 
982
             server configs, and produces coverage reports -->
 
983
 
 
984
        <target name="test-coverage-multijvm" depends="instrument">
 
985
                <for list="1,2,3,4,5,6,7,8" param="jvm.number">
 
986
                        <sequential>
 
987
                                <if>
 
988
                                        <isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
 
989
                                        <then>
 
990
                                                <for list="1,2,3,4,5,6,7,8" param="url.number">
 
991
                                                        <sequential>
 
992
                                                                <if>
 
993
                                                                        <isset property="com.mysql.jdbc.testsuite.url.@{url.number}"/>
 
994
                                                                        <then>
 
995
                                                                                <make-output-hier 
 
996
                                                                                jdbcUrl="${com.mysql.jdbc.testsuite.url.@{url.number}}" 
 
997
                                                                                junitOutput="${junit.results}" 
 
998
                                                                                jvm="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}" 
 
999
                                                                                unitOrCompliance="unit" />
 
1000
 
 
1001
                                                                                <property name="test.coverage.multi.junitOut.@{url.number}" value="eraseMe" />
 
1002
                                                                                <var name="test.coverage.multi.junitOut.@{url.number}" unset="true" />
 
1003
 
 
1004
                                                                                <loadfile srcfile="${junit.results}/hier" 
 
1005
                                                                                property="test.coverage.multi.junitOut.@{url.number}" />
 
1006
 
 
1007
                                                                                <antcall target="test-coverage">
 
1008
                                                                                        <param name="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url.@{url.number}}" />
 
1009
                                                                                        <param name="test.result.prefix" value="/${test.coverage.multi.junitOut.@{url.number}}" />
 
1010
                                                                                        <param name="com.mysql.jdbc.testsuite.jvm" value="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}"/>
 
1011
                                                                                </antcall>
 
1012
                                                                        </then>
 
1013
                                                                </if>
 
1014
                                                        </sequential>
 
1015
                                                </for>
 
1016
                                        </then>
 
1017
                                </if>
 
1018
                        </sequential>
 
1019
                </for>
 
1020
        </target>
 
1021
 
 
1022
        <!-- Runs compliance testsuite against multiple JVMs and server configs, collecting
 
1023
               coverage data -->
 
1024
 
 
1025
        <target name="test-coverage-compliance-multijvm" depends="instrument">
 
1026
                <for list="1,2,3,4,5,6,7,8" param="jvm.number"  xmlns:ac="antlib:net.sf.antcontrib">
 
1027
                        <sequential>
 
1028
                                <if>
 
1029
                                        <isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
 
1030
                                        <then>
 
1031
                                                <for list="1,2,3,4,5,6,7,8" param="url.number">
 
1032
                                                        <sequential>
 
1033
                                                                <if>
 
1034
                                                                        <isset property="com.mysql.jdbc.compliance.url.@{url.number}"/>
 
1035
                                                                        <then>
 
1036
                                                                                <make-output-hier 
 
1037
                                                                                        jdbcUrl="${com.mysql.jdbc.compliance.url.@{url.number}}" 
 
1038
                                                                                        junitOutput="${junit.results}"
 
1039
                                                                                        jvm="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}" 
 
1040
                                                                                        unitOrCompliance="compliance"/>
 
1041
 
 
1042
                                                                                <property name="test.coverage.compliance.multi.junitOut.@{url.number}" value="eraseMe" />
 
1043
                                                                                <var name="test.coverage.compliance.multi.junitOut.@{url.number}" unset="true" />
 
1044
 
 
1045
                                                                                <loadfile srcfile="${junit.results}/hier" property="test.coverage.compliance.multi.junitOut.@{url.number}" />
 
1046
 
 
1047
                                                                                <antcall target="test-coverage-compliance">
 
1048
                                                                                        <param name="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url.@{url.number}}"/>
 
1049
                                                                                        <param name="com.mysql.jdbc.testsuite.jvm" value="${com.mysql.jdbc.testsuite.jvm.@{jvm.number}}"/>
 
1050
                                                                                        <param name="test.result.prefix" value="/${test.coverage.compliance.multi.junitOut.@{url.number}}"/>
 
1051
                                                                                </antcall>
 
1052
                                                                        </then>
 
1053
                                                                </if>
 
1054
                                                        </sequential>
 
1055
                                                </for>
 
1056
                                        </then>
 
1057
                                </if>
 
1058
                        </sequential>
 
1059
                </for>
 
1060
        </target>
 
1061
</project>