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