3
Copyright (C) 2002-2005 MySQL AB
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.
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.
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.
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
24
<!-- version $Id: build.xml 6428 2007-05-15 17:38:53Z mmatthews $ -->
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"/>
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" />
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.
50
<property name="com.mysql.jdbc.docs.sourceDir" value="/home/mmatthew/work/docs/prebuilt"/>
52
<taskdef resource="net/sf/antcontrib/antlib.xml">
54
<pathelement location="${sourceDir}/lib/ant-contrib.jar"/>
58
<path id="built.driver.only.classpath">
59
<pathelement location="${buildDir}/${fullProdName}" />
62
<path id="project.build.classpath">
63
<fileset dir="${buildDir}/${fullProdName}/lib-nodist">
64
<include name="**/*.jar"/>
67
<fileset dir="${buildDir}/${fullProdName}/lib">
68
<include name="**/*.jar"/>
71
<pathelement location="${buildDir}/${fullProdName}" />
74
<target name="init" depends="-init-copy, -init-no-crypto">
75
<!-- If we're building under cruise control, update ourself -->
78
<isset property="cctimestamp" />
80
<exec executable="svn">
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 -->
90
<mkdir dir="${buildDir}/${fullProdName}/lib-nodist" />
92
<available file="${com.mysql.jdbc.docs.sourceDir}" property="com.mysql.jdbc.docs.sourcesPresent" />
94
<available classname="com.mchange.v2.c3p0.QueryConnectionTester"
95
classpathref="project.build.classpath"
96
property="com.mysql.jdbc.c3p0Present" />
98
<available classname="org.apache.log4j.Logger"
99
classpathref="project.build.classpath"
100
property="com.mysql.jdbc.log4jPresent" />
102
<available classname="org.jboss.resource.adapter.jdbc.ValidConnectionChecker"
103
classpathref="project.build.classpath"
104
property="com.mysql.jdbc.jbossPresent" />
107
<target name="-init-copy" depends="clean">
110
<filter token="VERSION" value="${version}"/>
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"/>
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}"/>
130
<copy todir="${buildDir}/${fullProdName}" filtering="false">
131
<fileset dir="${sourceDir}" excludes="**/CVS">
132
<patternset id="dojar" >
133
<include name="**/*.jar*"/>
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"
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.
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"/>
153
<!-- This is the target we use to make MySQL AB Commercially-licensed binaries -->
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"/>
158
<target name="full-dist" description="Builds driver, binary .jar file and docs, basically a distribution 'image'"
159
depends="-dist-trace, dist, -bundle-docs"/>
161
<target name="package" depends="dist, -make-packages, -create-archives"/>
163
<target name="-remove-sources">
164
<echo>Removing sources from ${distDir}/toArchive</echo>
166
<fileset dir="${distDir}/toArchive">
167
<include name="**/*.java"/>
171
<delete dir="${distDir}/toArchive/${fullProdName}/src"/>
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" />
182
<checksum file="${distDir}/${fullProdName}.tar.gz" forceOverwrite="yes" fileext=".md5"/>
184
<delete file="${distDir}/${fullProdName}.zip"/>
186
<zip zipfile="${distDir}/${fullProdName}.zip">
187
<fileset dir="${toPackage}">
188
<patternset refid="non.test.sources" />
192
<checksum file="${distDir}/${fullProdName}.zip" forceOverwrite="yes" fileext=".md5"/>
194
<!-- Build a Maven bundle for upload to their repository -->
196
<checksum file="${distDir}/${fullProdName}.zip" forceOverwrite="yes" fileext=".md5"/>
198
<tempfile destdir="${buildDir}" prefix="maven-bundle-" property="mavenUploadDir" />
200
<mkdir dir="${mavenUploadDir}" />
202
<copy file="${buildDir}/${fullProdName}/${fullProdName}-bin.jar"
203
toFile="${mavenUploadDir}/${fullProdName}.jar" />
205
<copy file="${buildDir}/${fullProdName}/doc/sources/pom.xml"
206
toDir="${mavenUploadDir}" filtering="true">
209
<copy file="./COPYING"
210
toDir="${mavenUploadDir}" />
212
<copy file="./EXCEPTIONS-CONNECTOR-J"
213
toDir="${mavenUploadDir}" />
215
<jar jarfile="${distDir}/${fullProdName}.bundle.jar"
216
basedir="${mavenUploadDir}" />
219
<target name="-make-packages" depends="dist">
220
<property name="toPackage" value="${distDir}/toArchive"/>
221
<property name="packageDest" value = "${toPackage}/${fullProdName}"/>
223
<delete dir="${toPackage}" />
224
<mkdir dir="${toPackage}"/>
225
<mkdir dir="${packageDest}"/>
227
<delete file="${distDir}/${fullProdName}.tar.gz"/>
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="**/.*"/>
240
<copy todir="${packageDest}">
241
<fileset dir="${buildDir}/${fullProdName}"
242
includes="debug/*, docs/**, *.jar" excludes="docs/sources">
243
<patternset refid="non.test.sources"/>
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"/>
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"/>
255
<!-- For Windows-y platforms -->
257
<fixcrlf srcdir="${packageDest}"
258
tab="remove" tablength="8"
259
eol="crlf" includes="**/README.txt"/>
261
<!-- For Unix-y platforms -->
263
<fixcrlf srcdir="${packageDest}"
264
tab="remove" tablength="8"
265
eol="lf" includes="**/README"/>
268
<isset property="com.mysql.jdbc.commercialBuild"/>
270
<!-- These are the GPL and FLOSS exceptions. They don't get shipped with
271
commercial builds -->
273
<delete file="${packageDest}/COPYING"/>
274
<delete file="${packageDest}/EXCEPTIONS-CONNECTOR-J"/>
276
<!-- Pull in the commercial license itself -->
278
<copy file="${sourceDir}/lib-nodist/LICENSE.mysql" toDir="${packageDest}"/>
280
<loadfile property="commercialLicenseText"
281
srcFile="${sourceDir}/lib-nodist/commercialLicense.txt"/>
283
match="Copyright.*1307.[^replaceregexp]*USA"
284
replace="${commercialLicenseText}"
286
<fileset dir="${packageDest}" includes="**/*"/>
292
<target name="dist" depends="init, compile">
294
<delete file="${buildDir}/${fullProdName}-bin.jar" />
295
<delete file="${distDir}/${fullProdName}.jar" />
297
<mkdir dir="${distDir}" />
298
<mkdir dir="${buildDir}/META-INF" />
300
<!-- JDBC-4.0 support of service provider mechanism -->
302
<mkdir dir="${buildDir}/META-INF/services/" />
303
<echo file="${buildDir}/META-INF/services/java.sql.Driver"
304
message="com.mysql.jdbc.Driver" />
306
<manifest file="${buildDir}/META-INF/MANIFEST.MF">
307
<attribute name="Built-By" value="${user.name}" />
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" />
320
<jar jarfile="${buildDir}/${fullProdName}/${fullProdName}-bin.jar"
321
basedir="${buildDir}/${fullProdName}"
322
includes="**/*.class,**/*.properties*,COPYING,README"
323
excludes="testsuite/**"
325
manifest="${buildDir}/META-INF/MANIFEST.MF"/>
328
<target name="-dist-trace" depends="init, compile-driver-trace">
330
<delete file="${buildDir}/${fullProdName}-bin-g.jar"/>
332
<mkdir dir="${distDir}" />
333
<mkdir dir="${buildDir}/${fullProdName}/debug"/>
335
<manifest file="${buildDir}/MANIFEST.MF">
336
<attribute name="Built-By" value="${user.name}" />
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" />
348
<jar jarfile="${buildDir}/${fullProdName}/debug/${fullProdName}-bin-g.jar"
349
basedir="${buildDir}/${fullProdName}"
350
includes="**/*.class,**/*.properties*,COPYING,README"
351
excludes="testsuite/**"
353
manifest="${buildDir}/MANIFEST.MF"
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"
361
<copy file="${com.mysql.jdbc.docs.sourceDir}/en/pdf/connector-j.pdf"
362
todir="${buildDir}/${fullProdName}/docs"
364
<copy file="${com.mysql.jdbc.docs.sourceDir}/en/txt/connector-j.txt"
365
tofile="${buildDir}/${fullProdName}/docs/README.txt"
367
<copy todir="${buildDir}/${fullProdName}/docs/release-test-output" failonerror="false">
368
<fileset dir="${com.mysql.jdbc.docs.sourceDir}/release-test-output" excludes="**/CVS">
373
<target name="test-all-multi" depends="compile">
374
<delete dir="${buildDir}/junit" />
375
<antcall target="test-multijvm" />
376
<antcall target="test-compliance-multijvm" />
378
<fail message="Tests failed. Check logs and/or reports in ${buildDir}/junit."
379
if="tests.compliance.failed"/>
382
<!-- Runs compliance testsuite against multiple JVMs and server configs -->
384
<target name="test-multijvm" depends="compile">
385
<for list="1,2,3,4,5,6,7,8" param="jvm.number">
388
<isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
390
<for list="1,2,3,4,5,6,7,8" param="url.number">
393
<isset property="com.mysql.jdbc.testsuite.url.@{url.number}"/>
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" />
401
<property name="test.multi.junitOut.@{url.number}" value="eraseMe" />
402
<var name="test.multi.junitOut.@{url.number}" unset="true" />
404
<loadfile srcfile="${junit.results}/hier"
405
property="test.multi.junitOut.@{url.number}" />
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}}"/>
422
<target name="-set-test-result-prefix" unless="${test.result.prefix}">
423
<property name="test.result.prefix" value=""/>
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}"/>
431
<property name="junit.unitregress.results" value="${junit.results}/${test.result.prefix}/unitregress" />
433
<mkdir dir="${junit.results}/${test.result.prefix}"/>
434
<mkdir dir="${junit.unitregress.results}"/>
436
<mkdir dir="${junit.unitregress.results}/report"/>
438
<junit printSummary="yes"
441
jvm="${com.mysql.jdbc.testsuite.jvm}"
442
errorProperty="tests.failed"
443
failureProperty="tests.failed">
444
<jvmarg value="-Xmx256m" />
446
<!-- For java.sql.SavePoint on old JVMs -->
448
<jvmarg value="-Xverify:none" />
450
<sysproperty key="com.mysql.jdbc.testsuite.url" value="${com.mysql.jdbc.testsuite.url}"/>
453
<fileset dir="${sourceDir}/lib-nodist">
454
<include name="**/*.jar"/>
456
<fileset dir="${buildDir}/${fullProdName}/lib">
457
<include name="**/*.jar"/>
459
<pathelement location="${buildDir}/${fullProdName}" />
460
<pathelement path="${java.class.path}" />
463
<formatter type="xml"/>
465
<batchtest todir="${junit.unitregress.results}" >
466
<fileset dir="${buildDir}/${fullProdName}">
467
<include name="**/*Test.java" />
468
<exclude name="**/perf/*.java"/>
473
<junitreport todir="${junit.unitregress.results}/report">
474
<fileset dir="${junit.unitregress.results}">
475
<include name="**/TEST-*.xml"/>
477
<report format="frames" todir="${junit.unitregress.results}/report"/>
480
<!-- Don't fail the build if we're doing multi-tests -->
482
<equals arg1="${test.result.prefix}" arg2="" />
484
<fail message="Tests failed. Check logs and/or reports in ${junit.results}." if="tests.failed"/>
487
<echo message="Not checking test failures because we're doing a multi-test..." />
493
<!-- Runs compliance testsuite against multiple JVMs and server configs -->
495
<target name="test-compliance-multijvm" depends="compile">
496
<for list="1,2,3,4,5,6,7,8" param="jvm.number">
499
<isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
501
<for list="1,2,3,4,5,6,7,8" param="url.number">
504
<isset property="com.mysql.jdbc.compliance.url.@{url.number}"/>
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"/>
512
<property name="test.compliance.multi.junitOut.@{url.number}" value="eraseMe" />
513
<var name="test.compliance.multi.junitOut.@{url.number}" unset="true" />
515
<loadfile srcfile="${junit.results}/hier" property="test.compliance.multi.junitOut.@{url.number}" />
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}}"/>
534
Tests for JDBC compliance. The JDBC compliance testsuite
535
is not shipped with MySQL Connector/J as it is not licensible
538
The properties com.mysql.jdbc.compliance.url and
539
jdbc-compliance-location must be set
540
prior to running this test.
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}"/>
549
<property name="junit.compliance.results"
550
value="${junit.results}/${test.result.prefix}/compliance"/>
552
<mkdir dir="${junit.results}/${test.result.prefix}"/>
553
<mkdir dir="${junit.compliance.results}"/>
554
<mkdir dir="${junit.compliance.results}/report"/>
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"/>
562
<!-- For java.sql.SavePoint on old JVMs -->
564
<jvmarg value="-Xverify:none"/>
566
<sysproperty key="com.mysql.jdbc.compliance.url" value="${com.mysql.jdbc.compliance.url}"/>
569
<pathelement location="${buildDir}/${fullProdName}"/>
570
<fileset dir="${sourceDir}/lib-nodist">
571
<include name="**/*.jar"/>
573
<fileset dir="${buildDir}/${fullProdName}/lib">
574
<include name="**/*.jar"/>
576
<pathelement path="${java.class.path}" />
577
<pathelement location="${jdbc-compliance-location}"/>
580
<formatter type="xml"/>
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"/>
600
<junitreport todir="${junit.compliance.results}/report">
601
<fileset dir="${junit.compliance.results}">
602
<include name="**/TEST-*.xml"/>
604
<report format="frames" todir="${junit.compliance.results}/report"/>
607
<!-- Don't fail the build if we're doing multi-tests -->
609
<equals arg1="${test.result.prefix}" arg2="" />
611
<fail message="Tests failed. Check logs and/or reports in ${junit.compliance.results}." if="tests.compliance.failed"/>
614
<echo message="Not checking test failures because we're doing a multi-test..." />
620
<target name="compile" depends="init, compile-driver, compile-testsuite, compile.integration">
623
<target name="compile-trace" depends="init, compile-driver-trace">
626
<!-- Compiles the driver itself -->
628
<target name="compile-driver" depends="init, -clean-output">
629
<javac srcdir="${buildDir}/${fullProdName}"
630
destdir="${buildDir}/${fullProdName}"
632
debug="${debug.enable}"
633
excludes="testsuite/**,
636
com/mysql/jdbc/integration/**,
637
com/mysql/jdbc/log/Log4JLogger.java">
638
<classpath refid="project.build.classpath" />
642
<!-- Compiles a version of the driver with AspectJ tracing -->
644
<target name="compile-driver-trace" depends="init">
646
resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
648
<pathelement location="${sourceDir}/lib/aspectjtools.jar"/>
653
<iajc destDir="${buildDir}/${fullProdName}">
655
<pathelement location="${buildDir}/${fullProdName}/org"/>
656
<pathelement location="${buildDir}/${fullProdName}/com"/>
658
<classpath refid="project.build.classpath"/>
660
<pathelement location="${sourceDir}/lib/aspectjtools.jar"/>
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"/>
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}"
678
debug="${debug.enable}"
679
includes="com/mysql/jdbc/integration/c3p0/**">
680
<classpath refid="project.build.classpath" />
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}"
690
debug="${debug.enable}"
691
includes="com/mysql/jdbc/integration/jboss/**">
692
<classpath refid="project.build.classpath" />
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}"
702
debug="${debug.enable}"
703
includes="com/mysql/jdbc/log/Log4JLogger.java">
704
<classpath refid="project.build.classpath" />
708
<!-- Compiles the JUnit testsuite -->
710
<target name="compile-testsuite" depends="init, compile-driver">
712
srcdir="${buildDir}/${fullProdName}"
713
destdir="${buildDir}/${fullProdName}"
715
debug="${debug.enable}"
716
includes="testsuite/**"
717
excludes="testsuite/requiresNonRedists/**">
718
<classpath refid="project.build.classpath"/>
722
<target name="real-clean">
723
<delete dir="${buildDir}"/>
725
<fileset dir="${distDir}"
726
includes="${fullProdName}.zip,${fullProdName}.tar.gz"/>
730
<target name="clean" unless="com.mysql.jdbc.noCleanBetweenCompiles">
731
<delete dir="${buildDir}"/>
734
<target name="-clean-output" unless="com.mysql.jdbc.noCleanBetweenCompiles">
736
<fileset dir="${buildDir}"
737
includes="**/*.class"/>
741
<target name="docs-generate-properties-table" depends="compile-driver">
742
<tempfile property="properties-xml" suffix=".xml" />
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}"/>
749
<style in="${properties-xml}" style="${docsPropXslTempfile}"
750
out="${buildDir}/${fullProdName}/docs/sources/connPropsDocBook.xml"/>
751
<delete file="${properties-xml}"/>
752
<delete file="${docsPropXslTempfile}"/>
755
<target name="docs-generate-error-mapping-table" depends="compile-driver">
756
<tempfile property="errorsMapping-xml" suffix=".xml" />
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}"/>
763
<style in="${errorsMapping-xml}" style="${docsErrorXslTempfile}"
764
out="${buildDir}/${fullProdName}/docs/sources/errorMappingDocBook.xml"/>
765
<delete file="${docsErrorXslTempfile}"/>
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/
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" />
778
<path id="emma.lib" >
779
<pathelement location="${emma.dir}/emma.jar" />
780
<pathelement location="${emma.dir}/emma_ant.jar" />
783
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />
785
<property name="emma.enabled" value="true" />
786
<property name="emma.coverage.dir" value="${buildDir}/${fullProdName}-coverage" />
789
<target name="instrument" depends="init, compile"
790
description="runs the examples" >
792
<emma enabled="${emma.enabled}" >
793
<instr instrpathref="built.driver.only.classpath"
794
destdir="${buildDir}/${fullProdName}"
795
metadatafile="${emma.coverage.dir}/metadata.emma"
798
<filter excludes="*Test*" />
799
<filter excludes="org.junit.*" />
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" />
812
<txt outfile="${emma.coverage.dir}/coverage.txt" />
813
<html outfile="${emma.coverage.dir}/coverage.html" />
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" />
825
<txt outfile="${emma.coverage.dir}/coverage.txt" />
826
<html outfile="${emma.coverage.dir}/coverage.html" />
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}"/>
837
<property name="junit.unitregress.results" value="${junit.results}/${test.result.prefix}/unitregress" />
839
<mkdir dir="${junit.results}/${test.result.prefix}"/>
840
<mkdir dir="${junit.unitregress.results}"/>
842
<mkdir dir="${junit.unitregress.results}/report"/>
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}"/>
852
<fileset dir="${sourceDir}/lib-nodist">
853
<include name="**/*.jar"/>
855
<fileset dir="${buildDir}/${fullProdName}/lib">
856
<include name="**/*.jar"/>
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" />
864
<formatter type="xml"/>
866
<batchtest fork="yes" todir="${junit.unitregress.results}">
867
<fileset dir="${buildDir}/${fullProdName}">
868
<include name="**/*Test.java" />
869
<exclude name="**/perf/*.java"/>
875
<junitreport todir="${junit.unitregress.results}/report">
876
<fileset dir="${junit.unitregress.results}">
877
<include name="**/TEST-*.xml"/>
879
<report format="frames" todir="${junit.unitregress.results}/report"/>
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}"/>
888
<property name="junit.compliance.results"
889
value="${junit.results}/${test.result.prefix}/compliance"/>
891
<mkdir dir="${junit.results}/${test.result.prefix}"/>
892
<mkdir dir="${junit.compliance.results}"/>
893
<mkdir dir="${junit.compliance.results}/report"/>
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}"/>
903
<pathelement location="${buildDir}/${fullProdName}"/>
904
<fileset dir="${sourceDir}/lib-nodist">
905
<include name="**/*.jar"/>
907
<fileset dir="${buildDir}/${fullProdName}/lib">
908
<include name="**/*.jar"/>
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" />
916
<formatter type="xml"/>
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"/>
937
<junitreport todir="${junit.compliance.results}/report">
938
<fileset dir="${junit.compliance.results}">
939
<include name="**/TEST-*.xml"/>
941
<report format="frames" todir="${junit.compliance.results}/report"/>
945
<!-- Makes output directory hierarchy based on MySQL server version,
946
os information and jvm version -->
948
<macrodef name="make-output-hier">
949
<attribute name="jvm" />
950
<attribute name="jdbcUrl" />
951
<attribute name="unitOrCompliance" />
952
<attribute name="junitOutput" />
954
<java fork="true" jvm="@{jvm}" classname="com.mysql.jdbc.util.VersionFSHierarchyMaker">
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" />
962
<sysproperty key="com.mysql.jdbc.testsuite.url" value="@{jdbcUrl}" />
965
<fileset dir="${sourceDir}/lib-nodist">
966
<include name="**/*.jar" />
968
<fileset dir="${buildDir}/${fullProdName}/lib">
969
<include name="**/*.jar" />
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" />
976
<arg line="@{unitOrCompliance} @{junitOutput} @{junitOutput}/hier" />
981
<!-- Runs compliance testsuite against multiple JVMs and
982
server configs, and produces coverage reports -->
984
<target name="test-coverage-multijvm" depends="instrument">
985
<for list="1,2,3,4,5,6,7,8" param="jvm.number">
988
<isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
990
<for list="1,2,3,4,5,6,7,8" param="url.number">
993
<isset property="com.mysql.jdbc.testsuite.url.@{url.number}"/>
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" />
1001
<property name="test.coverage.multi.junitOut.@{url.number}" value="eraseMe" />
1002
<var name="test.coverage.multi.junitOut.@{url.number}" unset="true" />
1004
<loadfile srcfile="${junit.results}/hier"
1005
property="test.coverage.multi.junitOut.@{url.number}" />
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}}"/>
1022
<!-- Runs compliance testsuite against multiple JVMs and server configs, collecting
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">
1029
<isset property="com.mysql.jdbc.testsuite.jvm.@{jvm.number}"/>
1031
<for list="1,2,3,4,5,6,7,8" param="url.number">
1034
<isset property="com.mysql.jdbc.compliance.url.@{url.number}"/>
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"/>
1042
<property name="test.coverage.compliance.multi.junitOut.@{url.number}" value="eraseMe" />
1043
<var name="test.coverage.compliance.multi.junitOut.@{url.number}" unset="true" />
1045
<loadfile srcfile="${junit.results}/hier" property="test.coverage.compliance.multi.junitOut.@{url.number}" />
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}}"/>