-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.xml
1680 lines (1486 loc) · 73.9 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" encoding="UTF-8"?>
<!--
/* Copyright 2002-2005 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<!-- @version $Id: build.xml,v 1.2 2008-04-07 14:08:37 ewestfal Exp $ -->
<!--
ObJectRelationalBridge ANT build configuration.
initial author: Thomas Mahler
-->
<project name="ObJectRelationalBridge" default="jar" basedir=".">
<description>
ObJectRelationalBridge ANT build configuration
</description>
<!-- Allow any user specific values to override the defaults -->
<property environment="env"/>
<property file="${user.home}/build.properties" />
<property file="build.properties"/>
<!-- Load the profile set in build.properties -->
<property file="profile/${profile}.profile"/>
<!-- Set default values for properties not initialized by profile -->
<property name="torque.delimiter" value=";"/>
<property name="validationQuery" value=""/>
<property name="testOnBorrow" value="true"/>
<property name="testOnReturn" value="false"/>
<!-- Clover initialization-->
<property name="clover.initstring" location="${build.dir}/coverage.db"/>
<path id="compilation-classpath">
<pathelement path="${build.dest}"/>
<pathelement path="${build.desttest}"/>
<pathelement path="${build.desttools}"/>
<fileset dir="${lib}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
<pathelement path="${j2ee.jars}"/>
</path>
<path id="runtime-classpath">
<!-- set at top position, because OJB properties-files should be found first -->
<pathelement path="${build.dir}/test/ojb"/>
<path refid="compilation-classpath"/>
</path>
<property name="runtime.classpath" refid="runtime-classpath"/>
<!-- ================================================================== -->
<!-- I N I T -->
<!-- ================================================================== -->
<target name="init"
depends="environment-check,
set-archive-name,
set-archive-name-date"/>
<target name="force-jdk">
<property name="ant.java.version" value="1.8" />
<property name="JDK" value="+JDK13"/>
<property name="JDBC" value="+JDBC30"/>
<property name="excludes" value=""/>
<echo message="forcing JDK 1.8"/>
</target>
<target name="environment-check" depends="force-jdk">
<!--
<fail message="Please make JUnit available in the classpath, e.g. by copying the junit.jar from OJB's lib subdirectory into the lib subdirectory of your Ant installation (${env.ANT_HOME}/lib).">
<condition>
<not>
<available classname="junit.framework.TestCase"/>
</not>
</condition>
</fail>
-->
<fail message="In order to compile OJB with JDK 1.2 you need to download cglib from http://cglib.sourceforge.net and put the jar into OJB's lib folder.">
<condition>
<and>
<isset property="jdk-12"/>
<not>
<available classname="net.sf.cglib.proxy.Proxy"
classpathref="compilation-classpath"/>
</not>
</and>
</condition>
</fail>
<fail message="Please make the JNDI classes (javax.naming.*) available in your classpath. Download them from http://java.sun.com/products/jndi/downloads/index.html and copy the jndi.jar into OJB's lib directory.">
<condition>
<not>
<available classname="javax.naming.InitialContext"
classpathref="compilation-classpath"/>
</not>
</condition>
</fail>
</target>
<target name="set-archive-name-date" if="useDate">
<property name="archive" value="${ojb-filename-prefix}-${DSTAMP}"/>
</target>
<target name="set-archive-name" unless="useDate">
<property name="archive" value="${ojb-filename-prefix}"/>
</target>
<!-- ================================================================== -->
<!-- Prepare target directories -->
<!-- ================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dest}"/>
<mkdir dir="${build.desttest}"/>
<mkdir dir="${build.desttools}"/>
<mkdir dir="${build.destjca}"/>
<mkdir dir="${dist}"/>
<copy todir="${build.src}">
<fileset dir="${src.java}"/>
</copy>
<copy todir="${build.srctest}">
<fileset dir="${src.test}"/>
</copy>
<copy todir="${build.srctools}">
<fileset dir="${src.tools}"/>
</copy>
<copy todir="${build.srcjca}">
<fileset dir="${src.jca}"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Preprocess Java Source Code -->
<!-- ================================================================== -->
<target name="preprocess" depends="prepare">
<echo message="using switches: ${JDK}, ${JDBC}"/>
<java fork="no"
classname="org.hsqldb.util.CodeSwitcher"
failonerror="true"
classpathref="compilation-classpath">
<arg value="${build.src}" />
<arg value="${JDK}"/>
<arg value="${JDBC}"/>
</java>
<java fork="no"
classname="org.hsqldb.util.CodeSwitcher"
failonerror="true"
classpathref="compilation-classpath">
<arg value="${build.srctest}" />
<arg value="${JDK}"/>
<arg value="${JDBC}"/>
</java>
<java fork="no"
classname="org.hsqldb.util.CodeSwitcher"
failonerror="true"
classpathref="compilation-classpath">
<arg value="${build.srctools}" />
<arg value="${JDK}"/>
<arg value="${JDBC}"/>
</java>
<replace dir="${build.src}" token="$$VERSION$$" value="${version}"/>
<replace dir="${build.src}" token="$$VERSION$$" value="${version}"/>
<replace dir="${build.src}" token="$$MAJOR$$" value="${major}"/>
<replace dir="${build.src}" token="$$MINOR$$" value="${minor}"/>
<replace dir="${build.src}" token="$$BUILD$$" value="${build}"/>
<replace dir="${build.src}" token="$$DATE$$" value="${versiondate}"/>
</target>
<!-- ================================================================== -->
<!-- Delete all the directories created in prepare -->
<!-- ================================================================== -->
<target name="clean" depends="init"
description="Cleans the build and distribution directories.">
<delete dir="${build.dir}" verbose="false"/>
<delete dir="${dist}" verbose="false"/>
</target>
<!-- ================================================================== -->
<!-- Build all the sources with debug and deprecation -->
<!-- ================================================================== -->
<target name="main" depends="prepare, preprocess"
description="Compile all Java sources with debugging on.">
<javac srcdir="${build.src}" destdir="${build.dest}" excludes="${excludes}"
debug="on" debuglevel="source,lines,vars" deprecation="${deprecation}">
<classpath refid="compilation-classpath" />
</javac>
<javac srcdir="${build.srctest}" destdir="${build.desttest}" excludes="${excludes}"
debug="on" debuglevel="source,lines,vars" deprecation="${deprecation}">
<classpath refid="compilation-classpath" />
</javac>
<javac srcdir="${build.srctools}" destdir="${build.desttools}" excludes="${excludes}"
debug="on" debuglevel="source,lines,vars" deprecation="${deprecation}">
<classpath refid="compilation-classpath" />
</javac>
</target>
<!-- include OJB JDORI implementation -->
<target name="with-jdori" depends="prepare"
description="Compile OJB JDORI">
<copy todir="${build.src}">
<fileset dir="${src.dir}/jdori"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- cleanup, preprocessing, compile and building -->
<!-- of oql parser and documentation -->
<!-- ================================================================== -->
<target name="all" depends="clean,preprocess,oql,main,ojb-blank"
description="rebuild all sources (incl. preprocessing)"/>
<!-- ================================================================== -->
<!-- Same as main, but optimization, no debug and no deprecation -->
<!-- ================================================================== -->
<target name="main-opt" depends="prepare, preprocess"
description="Same as main, but with debugging off and optimizations on.">
<javac nowarn="true" srcdir="${build.src}" destdir="${build.dest}" excludes="${excludes}"
debug="off" deprecation="off" optimize="on">
<classpath refid="compilation-classpath"/>
</javac>
<javac nowarn="true" srcdir="${build.srctest}" destdir="${build.desttest}" excludes="${excludes}"
debug="off" deprecation="off" optimize="on">
<classpath refid="compilation-classpath"/>
</javac>
<javac nowarn="true" srcdir="${build.srctools}" destdir="${build.desttools}" excludes="${excludes}"
debug="off" deprecation="off" optimize="on">
<classpath refid="compilation-classpath"/>
</javac>
<javac nowarn="true" srcdir="${build.srcjca}" destdir="${build.destjca}" excludes="${excludes}"
debug="on" deprecation="${deprecation}">
<classpath refid="compilation-classpath" />
</javac>
</target>
<!-- ================================================================== -->
<!-- set the runtime jdbc driver -->
<!-- if the property useP6Spy is set, the P6Spy Tracing driver is used. -->
<!-- I did not find any other way to set this property with two -->
<!-- conditional tasks. Maybe there's a better solution ? -->
<!-- ================================================================== -->
<target name="checkP6Spy" depends="">
<condition property="shouldUseP6Spy">
<istrue value="${useP6Spy}">
</istrue>
</condition>
</target>
<target name="useP6Spy" if="shouldUseP6Spy">
<echo message="using P6Spy to trace JDBC calls."/>
<property name="jdbcRuntimeDriver" value="com.p6spy.engine.spy.P6SpyDriver"/>
</target>
<target name="dontUseP6Spy" unless="shouldUseP6Spy">
<echo message="NOT using P6Spy to trace JDBC calls."/>
<property name="jdbcRuntimeDriver" value="${torque.database.driver}"/>
</target>
<target name="prepare-repository" depends="checkP6Spy, useP6Spy, dontUseP6Spy">
<delete dir="${build.test}" verbose="false"/>
<copy todir="${build.test}/ojb">
<fileset dir="${build.srctest}/org/apache/ojb"
includes="Test_*,database*,repository*,*.properties,*.dtd,*.jdo,*.ccf">
<exclude name="build.properties" />
<exclude name="build.xml" />
</fileset>
<filterset>
<filter token="JCD_ALIAS" value="${jcdAlias}" />
<filter token="DBMS_NAME" value="${dbmsName}" />
<filter token="JDBC_LEVEL" value="${jdbcLevel}" />
<filter token="DRIVER_NAME" value="${jdbcRuntimeDriver}" />
<filter token="URL_PROTOCOL" value="${urlProtocol}" />
<filter token="URL_SUBPROTOCOL" value="${urlSubprotocol}" />
<filter token="URL_DBALIAS" value="${urlDbalias}" />
<filter token="USER_NAME" value="${torque.database.user}" />
<filter token="USER_PASSWD" value="${torque.database.password}" />
<filter token="VALIDATION_QUERY" value="${validationQuery}" />
<filter token="TEST_ON_BORROW" value="${testOnBorrow}" />
<filter token="TEST_ON_RETURN" value="${testOnReturn}" />
</filterset>
</copy>
<copy file="${src.test}/org/apache/ojb/faraway-db/OJB_FarAway.properties" tofile="${build.test}/OJB_FarAway.properties"/>
<copy file="${src.test}/org/apache/ojb/faraway-db/OJB_FarAway.script" tofile="${build.test}/OJB_FarAway.script"/>
</target>
<target name="prepare-testdb"
description="prepare testdb using torque or ddlutils"
depends="prepare-testdb-torque, prepare-testdb-ddlutils"/>
<target name="prepare-testdb-torque"
description="prepare testdb using torque"
depends="prepare, prepare-repository"
unless="use-ddlutils">
<copy todir="${build.test}">
<fileset dir="${src.dir}/schema" includes="*.xml,*.dtd"/>
<filterset>
<filter token="DATABASE_DEFAULT" value="${torque.project}" />
</filterset>
</copy>
<antcall target="getJSQLDriver"/>
<!-- create sql scripts -->
<ant dir="."
antfile="${torque.buildFile}"
target="sql"/>
<!-- create db -->
<ant dir="."
antfile="${torque.buildFile}"
target="create-db"/>
<!-- create data sql -->
<ant dir="."
antfile="${torque.buildFile}"
target="datasql"/>
<!-- create tables -->
<ant dir="."
antfile="${torque.buildFile}"
target="insert-sql"/>
</target>
<target name="prepare-testdb-ddlutils"
description="prepare testdb using DdlUtils"
depends="prepare, prepare-repository"
if="use-ddlutils">
<taskdef name="ddl2Database"
classname="org.apache.ddlutils.task.DdlToDatabaseTask"
classpathref="runtime-classpath"/>
<taskdef name="ojbData"
classname="org.apache.ojb.broker.ant.RepositoryDataTask"
classpathref="runtime-classpath"/>
<copy todir="${build.test}">
<fileset dir="${src.dir}/schema" includes="*.xml,*.dtd"/>
<filterset>
<filter token="DATABASE_DEFAULT" value="${project}" />
</filterset>
</copy>
<ddl2Database usedelimitedsqlidentifiers="false">
<database driverclassname="${torque.database.driver}"
url="${torque.database.createUrl}"
username="${torque.database.user}"
password="${torque.database.password}"/>
<fileset dir="${build.test}"
includes="*schema.xml"/>
<createdatabase failonerror="false"/>
<writeschematodatabase alterdatabase="false"/>
</ddl2Database>
<ojbData usedelimitedsqlidentifiers="false"
ojbpropertiesfile="${build.test}/ojb/OJB.properties" >
<database driverclassname="${torque.database.driver}"
url="${torque.database.createUrl}"
username="${torque.database.user}"
password="${torque.database.password}"/>
<fileset dir="${build.test}"
includes="*schema.xml"/>
<writedatatodatabase datafile="${build.test}/ojbtest-data-new.xml"/>
</ojbData>
</target>
<!-- ================================================================== -->
<!-- dump testdb using torque -->
<!-- ================================================================== -->
<target name="dump-testdb"
description="dump testdb using torque">
<ant dir="."
antfile="${torque.buildFile}"
target="project-datadtd-classpath"/>
<ant dir="."
antfile="${torque.buildFile}"
target="project-datadump-classpath"/>
</target>
<!-- ================================================================== -->
<!-- Build the JAR file using main-opt -->
<!-- ================================================================== -->
<target name="jar" depends="" description="Builds the binary ojb-xxx.jar in the dist directory.">
<ant target="main-opt"/>
<ant target="jar-internal"/>
</target>
<!-- ================================================================== -->
<!-- Build the JAR file using main-debug -->
<!-- ================================================================== -->
<target name="jar-debug" description="Builds the binary ojb-xxx.jar in the dist directory in debug mode.">
<ant target="main"/>
<ant target="jar-internal"/>
</target>
<target name="jar-internal" depends="init">
<delete file="${dist}/${archive}.jar"/>
<delete file="${dist}/${archive}-junit.jar"/>
<delete file="${dist}/${archive}-src.jar"/>
<delete file="${dist}/${archive}-tools.jar"/>
<delete file="${build.dest}/MANIFEST.MF"/>
<copy file="${source}/etc/MANIFEST.MF" tofile="${build.dest}/MANIFEST.MF"/>
<replace file="${build.dest}/MANIFEST.MF" token="$$VERSION$$" value="${version}"/>
<copy todir="${build.dest}">
<fileset dir="${source}/etc" excludes="MANIFEST.MF"/>
</copy>
<jar jarfile="${dist}/${archive}.jar" basedir="${build.dest}"
manifest="${build.dest}/MANIFEST.MF"
includes="LICENSE,NOTICE,README,javax/**,org/**"
excludes="org/apache/ojb/tools/**"/>
<jar jarfile="${dist}/${archive}-junit.jar" basedir="${build.desttest}"
manifest="${build.dest}/MANIFEST.MF"
includes="LICENSE,NOTICE,README,org/**"/>
<jar jarfile="${dist}/${archive}-sources.jar" basedir="${build.src}"
manifest="${build.dest}/MANIFEST.MF"
includes="LICENSE,NOTICE,README,org/**"/>
<jar jarfile="${dist}/${archive}-tools.jar" basedir="${build.desttools}"
manifest="${build.dest}/MANIFEST.MF"
includes="LICENSE,NOTICE,README,org/apache/ojb/tools/**"/>
</target>
<!-- ================================================================== -->
<!-- Build sample war-file for deployment in tomcat -->
<!-- ================================================================== -->
<target name="war" depends="jar, prepare-testdb"
description="Builds a sample war-file for deployment in tomcat">
<delete file="${dist}/ojb-servlet.war"/>
<delete dir="${build.dir}/WEB-INF" verbose="false"/>
<mkdir dir="${build.dir}/WEB-INF/classes"/>
<mkdir dir="${build.dir}/WEB-INF/lib"/>
<!-- 1. apache-ojb-xxx.jar -->
<copy file="${dist}/${archive}.jar" todir="${build.dir}/WEB-INF/lib"/>
<!-- 2. OJB.properties and repository*.* files -->
<copy todir="${build.dir}/WEB-INF/classes">
<fileset dir="${build.test}/ojb" includes="*.properties,*.dtd,*.xml"/>
</copy>
<!-- 3. additional jar files -->
<copy todir="${build.dir}/WEB-INF/lib">
<fileset dir="${lib}">
<include name="*.jar"/>
<exclude name="ant.jar"/>
<exclude name="antlr.debug.jar"/>
<exclude name="antlr_compiletime.jar"/>
<exclude name="junit.jar"/>
<exclude name="optional.jar"/>
<exclude name="xalan.jar"/>
<exclude name="ejb.jar"/>
<exclude name="servlet.jar"/>
<exclude name="jakarta-regexp-1.2.jar"/>
<exclude name="torque-3.0-b3-dev.jar"/>
<exclude name="velocity-1.3-dev.jar"/>
</fileset>
</copy>
<!-- 4. don't forget the jdbc driver -->
<!-- In this case the jdbc driver is in hsqldb.jar, which has been
written in step 3. already -->
<!-- 5. the business code, that is your servlet-->
<copy todir="${build.dir}/WEB-INF/classes">
<fileset dir="${build.desttest}" includes="org/apache/ojb/servlet/**"/>
</copy>
<jar jarfile="${dist}/ojb-servlet.war" basedir="${build.dir}"
includes="WEB-INF/**"/>
</target>
<!-- ================================================================== -->
<!-- Build sample war-file for deployment in tomcat -->
<!-- ================================================================== -->
<target name="lockservlet-war" depends="jar, prepare, prepare-repository"
description="Builds The Lockserver servlet for deployment in tomcat">
<property name="build.servlet" value="${build.dir}/lock-servlet"/>
<delete file="${dist}/ojb-lockserver.war"/>
<delete dir="${build.servlet}/WEB-INF" verbose="false"/>
<mkdir dir="${build.servlet}/WEB-INF/classes"/>
<mkdir dir="${build.servlet}/WEB-INF/lib"/>
<!-- 1. apache-ojb-xxx.jar -->
<copy file="${dist}/${archive}.jar" todir="${build.servlet}/WEB-INF/lib"/>
<!-- 2. OJB.properties and repository*.* files -->
<copy todir="${build.servlet}/WEB-INF/classes">
<fileset dir="${build.test}/ojb" includes="*.properties,*.dtd,*.xml">
<exclude name="Test_*"/>
</fileset>
</copy>
<copy todir="${build.servlet}/WEB-INF">
<fileset dir="${build.srctest}/org/apache/ojb" includes="web.xml"/>
</copy>
<!-- 3. additional jar files -->
<copy todir="${build.servlet}/WEB-INF/lib">
<fileset dir="${lib}">
<include name="**/*.jar"/>
<exclude name="jdo*.jar"/>
<exclude name="ant-*.jar"/>
<exclude name="xerces*.jar"/>
<exclude name="xml-*.jar"/>
<exclude name="xalan*.jar"/>
<exclude name="jakarta-regexp*.jar"/>
<exclude name="torque*.jar"/>
<exclude name="velocity*.jar"/>
<exclude name="xdoclet*.jar"/>
<exclude name="xjava*.jar"/>
</fileset>
</copy>
<!-- 4. the business code, that is our servlet-->
<copy todir="${build.servlet}/WEB-INF/classes">
<fileset dir="${build.dest}" includes="org/apache/ojb/broker/locking/**"/>
</copy>
<jar jarfile="${dist}/ojb-lockserver.war" basedir="${build.servlet}"
includes="WEB-INF/**"/>
</target>
<!-- ================================================================== -->
<!-- Build the sample jar-files -->
<!-- ================================================================== -->
<target name="sample-jars"
description="Build jars containing the sources of the tutorials and sample classes">
<!-- Tutorial 1 src -->
<delete file="${dist}/${tutorial1.src-jar.name}"
failonerror="false"/>
<jar jarfile="${dist}/${tutorial1.src-jar.name}"
basedir="${tutorial1.src.dir}"
includes="${tutorial1.src.includes}"/>
<!-- Tutorial 1 src -->
<delete file="${dist}/${tutorial2.src-jar.name}"
failonerror="false"/>
<jar jarfile="${dist}/${tutorial2.src-jar.name}"
basedir="${tutorial2.src.dir}"
includes="${tutorial2.src.includes}"/>
<!-- Tutorial 1 src -->
<delete file="${dist}/${tutorial5.src-jar.name}"
failonerror="false"/>
<jar jarfile="${dist}/${tutorial5.src-jar.name}"
basedir="${tutorial5.src.dir}"
includes="${tutorial5.src.includes}"/>
<!-- Misc src -->
<delete file="${dist}/${miscsamples.src-jar.name}"
failonerror="false"/>
<jar jarfile="${dist}/${miscsamples.src-jar.name}"
basedir="${miscsamples.src.dir}"
includes="${miscsamples.src.includes}"/>
</target>
<!-- ================================================================== -->
<!-- Build sample jar-file for a new project -->
<!-- ================================================================== -->
<target name="ojb-blank" depends="init,jar-debug"
description="Build a sample project">
<property name="build.ojb-blank" value="${build.dir}/ojb-blank"/>
<delete file="${dist}/ojb-blank.jar" failonerror="false"/>
<delete dir="${build.ojb-blank}" verbose="false" failonerror="false"/>
<mkdir dir="${build.ojb-blank}"/>
<mkdir dir="${build.ojb-blank}/src"/>
<mkdir dir="${build.ojb-blank}/src/java"/>
<mkdir dir="${build.ojb-blank}/src/schema"/>
<mkdir dir="${build.ojb-blank}/src/resources"/>
<mkdir dir="${build.ojb-blank}/src/test"/>
<mkdir dir="${build.ojb-blank}/lib"/>
<copy file="${dist}/${archive}.jar" todir="${build.ojb-blank}/lib"/>
<copy todir="${build.ojb-blank}/src/resources">
<fileset dir="${src.test}/org/apache/ojb"
includes="${ojb-blank.resource.includes}"/>
<filterset>
<filter token="VALIDATION_QUERY" value="${validationQuery}"/>
<filter token="TEST_ON_BORROW" value="${testOnBorrow}"/>
<filter token="TEST_ON_RETURN" value="${testOnReturn}"/>
</filterset>
</copy>
<copy todir="${build.ojb-blank}">
<fileset dir="${src.ojb-blank}"/>
<filterset>
<filter token="OJB_JAR" value="${archive}.jar"/>
</filterset>
</copy>
<copy todir="${build.ojb-blank}/src/schema">
<fileset dir="${source}/schema">
<include name="ojbcore-schema.xml"/>
</fileset>
</copy>
<copy file="build-torque.xml" todir="${build.ojb-blank}/src/schema"/>
<copy todir="${build.ojb-blank}/lib">
<fileset dir="${lib}"
includes="${ojb-blank.lib.includes}"/>
</copy>
<jar jarfile="${dist}/ojb-blank.jar"
basedir="${build.dir}"
includes="ojb-blank/**"/>
</target>
<!-- ================================================================== -->
<!-- Build quickstart samples using hsqldb -->
<!-- ================================================================== -->
<target name="ojb-quickstart"
depends="ojb-blank"
description="Build the sample projects for the tutorials">
<mkdir dir="${build.dir}/ojb-quickstart"/>
<property name="build.ojb-quickstart" value="${build.dir}/ojb-quickstart/ojb-blank"/>
<!-- We're using fresh ojb-blank's and copy the tutorial source into it
to generate the quickstart apps -->
<!-- Tutorial 1 -->
<delete dir="${build.ojb-quickstart}" verbose="false" failonerror="false"/>
<unjar src="${dist}/ojb-blank.jar" dest="${build.dir}/ojb-quickstart"/>
<copy todir="${build.ojb-quickstart}/src/java">
<fileset dir="${tutorial1.src.dir}"
includes="${tutorial1.src.includes}"/>
</copy>
<ant antfile="${build.ojb-quickstart}/build.xml"
inheritall="false"
dir="${build.ojb-quickstart}"
target="setup-db">
<property name="databaseName" value="${tutorial1.database.name}"/>
<property name="jar.name" value="${tutorial1.quickstart-jar.name}"/>
<property name="source.main.class" value="${tutorial1.main.class}"/>
<property name="target.dir" value="target"/>
<!-- For some reason we have to override the createUrl -->
<property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/database/${tutorial1.database.name}"/>
</ant>
<ant antfile="${build.ojb-quickstart}/build.xml"
inheritall="false"
dir="${build.ojb-quickstart}"
target="dist">
<property name="databaseName" value="${tutorial1.database.name}"/>
<property name="jar.name" value="${tutorial1.quickstart-jar.name}"/>
<property name="source.main.class" value="${tutorial1.main.class}"/>
<property name="target.dir" value="target"/>
<property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/database/${tutorial1.database.name}"/>
</ant>
<move file="${build.ojb-quickstart}/target/${tutorial1.quickstart-jar.name}" todir="${dist}"/>
<!-- Tutorial 2 -->
<delete dir="${build.ojb-quickstart}" verbose="false" failonerror="false"/>
<unjar src="${dist}/ojb-blank.jar" dest="${build.dir}/ojb-quickstart"/>
<copy todir="${build.ojb-quickstart}/src/java">
<fileset dir="${tutorial2.src.dir}"
includes="${tutorial2.src.includes}"/>
</copy>
<ant antfile="${build.ojb-quickstart}/build.xml"
inheritall="false"
dir="${build.ojb-quickstart}"
target="setup-db">
<property name="databaseName" value="${tutorial2.database.name}"/>
<property name="jar.name" value="${tutorial2.quickstart-jar.name}"/>
<property name="source.main.class" value="${tutorial2.main.class}"/>
<property name="target.dir" value="target"/>
<!-- For some reason we have to override the createUrl -->
<property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/database/${tutorial2.database.name}"/>
</ant>
<ant antfile="${build.ojb-quickstart}/build.xml"
inheritall="false"
dir="${build.ojb-quickstart}"
target="dist">
<property name="databaseName" value="${tutorial2.database.name}"/>
<property name="jar.name" value="${tutorial2.quickstart-jar.name}"/>
<property name="source.main.class" value="${tutorial2.main.class}"/>
<property name="target.dir" value="target"/>
<property name="torque.database.createUrl" value="jdbc:hsqldb:${build.ojb-quickstart}/build/database/${tutorial2.database.name}"/>
</ant>
<move file="${build.ojb-quickstart}/target/${tutorial2.quickstart-jar.name}" todir="${dist}"/>
</target>
<!-- ================================================================== -->
<!-- Build the webapp sample -->
<!-- ================================================================== -->
<target name="webapp-sample"
depends="init,jar-debug"
description="Build the webapp sample">
<mkdir dir="${build.dir}/webapp-sample"/>
<copy todir="${build.dir}/webapp-sample">
<fileset dir="${webapp-sample.src.dir}"
excludes="**/*.jar"/>
<filterset>
<filter token="OJB_JAR" value="${archive}.jar"/>
</filterset>
</copy>
<copy todir="${build.dir}/webapp-sample">
<fileset dir="${webapp-sample.src.dir}"
includes="**/*.jar"/>
</copy>
<!-- The sample comes only with libraries that OJB itself does not need
i.e. Struts (1.2.4) and JSTL (jakarta implementation). All other
libs will be copied from OJB's lib folder -->
<copy todir="${build.dir}/webapp-sample/lib">
<fileset dir="${lib}"
includes="${webapp-sample.lib.includes}"/>
</copy>
<copy file="${dist}/${archive}.jar"
todir="${build.dir}/webapp-sample/lib"/>
<!-- Likewise we copy common resource files -->
<mkdir dir="${build.dir}/webapp-sample/src/schema"/>
<copy todir="${build.dir}/webapp-sample/src/schema">
<fileset dir="${source}/schema">
<include name="ojbcore-schema.xml"/>
</fileset>
</copy>
<copy file="build-torque.xml" todir="${build.dir}/webapp-sample/src/schema"/>
<copy todir="${build.dir}/webapp-sample/src/resources">
<fileset dir="${src.test}/org/apache/ojb"
includes="${webapp-sample.resource.includes}"/>
<filterset>
<filter token="VALIDATION_QUERY" value="${validationQuery}"/>
<filter token="TEST_ON_BORROW" value="${testOnBorrow}"/>
<filter token="TEST_ON_RETURN" value="${testOnReturn}"/>
</filterset>
</copy>
<!-- Note that we don't pre-build the webapp simply because it will get too big -->
<jar jarfile="${dist}/webapp-sample.jar"
basedir="${build.dir}"
includes="webapp-sample/**"/>
</target>
<!-- ================================================================== -->
<!-- Build the documentation -->
<!-- ================================================================== -->
<target name="sitedoc-prepare" depends="prepare">
<fail message="Please set the ANT_HOME environment variable to the root of your Ant installation.">
<condition>
<not>
<isset property="env.ANT_HOME"/>
</not>
</condition>
</fail>
<fail message="To generate OJB docs, please set the environment variables as described in Forrest documentation.
If you don't have yet installed Forrest, you can get it from http://forrest.apache.org.">
<condition>
<not>
<isset property="env.FORREST_HOME"/>
</not>
</condition>
</fail>
<fail message="Please check Forrest enviroment variables (e.g. between 0.6 and 0.7 these values change).">
<condition>
<not>
<isset property="env.FORREST_HOME"/>
</not>
</condition>
</fail>
<fail message="Please make the Apache XML Commons Resolver library available in the classpath, e.g. by copying the xml-commons-resolver jar file from the 'tools/ant/lib' subdirectory of your Forrest installation (${env.FORREST_HOME}/tools/ant/lib) into the lib subdirectory of your Ant installation (${env.ANT_HOME}/lib).">
<condition>
<not>
<available classname="org.apache.xml.resolver.Resolver"/>
</not>
</condition>
</fail>
<echo message="*** Preparing generation of documentation ..."/>
<delete dir="${build.doc}" failonerror="false"/>
<mkdir dir="${build.doc}"/>
<!-- Copy generated javadoc into the forrest structure in the temporary directoy -->
<copy todir="${forrest.javadoc.destdir}">
<fileset dir="${build.javadoc}"/>
</copy>
</target>
<target name="run-forrest"
description="Generates the complete site documentation using Forrest">
<!-- Copy auxiliary documentation src files to the temporary directory -->
<copy file="${forrest.staticfiles.srcdir}/repository.dtd"
tofile="${forrest.staticfiles.destdir}/repository.dtd.txt" />
<copy file="${forrest.staticfiles.srcdir}/repository.xml"
tofile="${forrest.staticfiles.destdir}/repository.xml.txt" />
<copy file="${forrest.staticfiles.srcdir}/repository_database.xml"
tofile="${forrest.staticfiles.destdir}/repository_database.xml.txt" />
<copy file="${forrest.staticfiles.srcdir}/repository_internal.xml"
tofile="${forrest.staticfiles.destdir}/repository_internal.xml.txt" />
<copy file="${forrest.staticfiles.srcdir}/repository_junit.xml"
tofile="${forrest.staticfiles.destdir}/repository_junit.xml.txt" />
<copy file="${forrest.staticfiles.srcdir}/repository_user.xml"
tofile="${forrest.staticfiles.destdir}/repository_user.xml.txt" />
<copy file="${miscsamples.src.dir}/org/apache/ojb/tutorials/PBExample.java"
tofile="${forrest.staticfiles.destdir}/PBExamples.txt" />
<copy file="${forrest.staticfiles.srcdir}/OJB.properties"
tofile="${forrest.staticfiles.destdir}/OJB.properties.txt" />
<copy file="release-notes.txt"
tofile="${forrest.staticfiles.destdir}/release-notes.txt" />
<mkdir dir="${forrest.staticfiles.destdir}/dtdx"/>
<!-- ** workaround part 1**
This is needed to use a plugin which generates a html file of .dtd
files. The plugin only work with resources in forrest classpath. This
should be fixed in next version of forrest
-->
<echo>Workaround: Copy repository.dtd to a Forrest installation directory</echo>
<copy file="${forrest.staticfiles.srcdir}/repository.dtd"
todir="${env.FORREST_HOME}/main/webapp/resources/schema/dtd"/>
<!-- Do temporary copy OJB's repository.dtd to Forrest directory, will be removed at end of process -->
<!-- Copy all forrest src stuff to a temporary directoy -->
<copy todir="${build.doc}">
<fileset dir="${src.forrest}"/>
</copy>
<!-- clean forrest build -->
<ant antfile="${env.FORREST_HOME}/main/forrest.build.xml"
dir="${build.doc}"
inheritall="false"
target="clean">
<property name="forrest.home" value="${env.FORREST_HOME}"/>
</ant>
<!-- Run, Forrest! Run! :-) -->
<echo>
** Start running Forrest in '${forrest-mode}' mode **
</echo>
<ant antfile="${env.FORREST_HOME}/main/forrest.build.xml"
dir="${build.doc}"
inheritall="false"
target="${forrest-mode}">
<property name="forrest.home" value="${env.FORREST_HOME}"/>
</ant>
<!-- ** workaround part 2 **
This is needed to use a plugin which generates a html file of .dtd
files. The plugin only work with resources in forrest classpath. This
should be fixed in next version of forrest
-->
<delete file="${env.FORREST_HOME}/main/webapp/resources/schema/dtd/repository.dtd"/>
</target>
<target name="doc" depends="javadoc,sitedoc-prepare"
description="Generates complete API- and site documentation">
<!-- start forrest in "site" mode -->
<antcall target="run-forrest">
<param name="forrest-mode" value="site"/>
</antcall>
<!-- Finally we can copy the generated documentation to its designated place -->
<mkdir dir="${doc}"/>
<copy todir="${doc}">
<fileset dir="${forrest.output.dir}"/>
</copy>
</target>
<!--
Specific developer target, sync Forrest webApp directory with OJB's
Forrest documentation files. Use this target in combination with
target 'dev-doc-forrest'
-->
<target name="dev-doc-sync" depends=""
description="dev-target: Copy changed doc files to forrest src directory">
<echo>Copy changed doc files to Forrest working directory</echo>
<copy todir="${build.doc}">
<fileset dir="${src.forrest}"/>
</copy>
</target>
<!--
Specific developer target, run Forrest as webApp to render OJB's
Forrest documentation files just in time. Use this target in
combination with target 'dev-doc-sync' to copy changed files to
Forrest webApp
-->
<target name="dev-doc-forrest" depends=""
description="dev-target: Run Forrest as webApp">
<echo message="Start Forrest as webApp (default is http://localhost:8888/)
use target 'dev-doc-sync' to sync changes in forrest .xml files" />
<!-- start forrest in "site" mode -->
<antcall target="run-forrest">
<param name="forrest-mode" value="run"/>
</antcall>
</target>
<!-- ================================================================== -->
<!-- Build the API JavaDocs -->
<!-- ================================================================== -->
<target name="javadoc" depends="prepare" description="Builds the API javadocs.">
<mkdir dir="${build.javadoc}"/>
<javadoc sourcepath="${build.src}:${build.srctools}"
classpathref="compilation-classpath"
destdir="${build.javadoc}"
doctitle="${icon}${br}${name} ${version} API documentation"
windowtitle="${name} ${version} API documentation"
bottom="${copyright}${br}Version: ${version}, ${versiondate}"
public="true"
author="true"
version="true"
packagenames="${apipackagenames}"
stylesheetfile="${javadoc.stylesheet}"
>
<!-- Rather than specifying ${build.srctest} in the sourcepath, we
have to use an enclosed fileset because the unit tests have the
same packagenames as the tested features, but we don't want them
in the javadoc -->
<fileset dir="${src.test}" defaultexcludes="yes">
<include name="org/apache/ojb/junit/**" />
<include name="org/apache/ojb/performance/**" />
</fileset>
</javadoc>
<copy todir="${build.javadoc}">
<fileset dir="${build.src}" includes="**/*.gif"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Build the docs and doc archives -->
<!-- ================================================================== -->
<target name="docs" depends="doc"
description="Builds the complete documentation archive.">
<zip zipfile="${dist}/${archive}-doc.zip"
basedir="."
includes="doc/**"/>
<tar tarfile="${dist}/${archive}-doc.tar"
basedir="."
includes="doc/**"/>
<gzip src="${dist}/${archive}-doc.tar"
zipfile="${dist}/${archive}-doc.tgz"/>
<delete file="${dist}/${archive}-doc.tar"/>
</target>
<!-- ================================================================== -->
<!-- Build the website -->
<!-- ================================================================== -->
<target name="website" depends="doc" description="Builds the ojb-website archive.">
<tar tarfile="${dist}/${archive}-website.tar"
basedir="${doc}"
includes="**"/>
<gzip src="${dist}/${archive}-website.tar"
zipfile="${dist}/${archive}-website.tgz"/>
<delete file="${dist}/${archive}-website.tar"/>
</target>
<!-- ================================================================== -->
<!-- Build the contributions archive -->
<!-- ================================================================== -->
<target name="contrib" description="Builds the contributions archive">
<tar tarfile="${dist}/${archive}-contrib.tar"
basedir="contrib"
includes="**"/>
<gzip src="${dist}/${archive}-contrib.tar"
zipfile="${dist}/${archive}-contrib.tgz"/>
<delete file="${dist}/${archive}-contrib.tar"/>
</target>
<!-- ================================================================== -->
<!-- Build the source distribution -->
<!-- ================================================================== -->
<target name="source" depends="prepare"
description="Builds the ojb source distribution in the dist directory.">
<delete file="${dist}/${archive}-src.tgz"/>
<delete file="${dist}/${archive}-src.zip"/>
<delete dir="${build.dir}/${archive}"/>
<mkdir dir="${build.dir}/${archive}"/>
<mkdir dir="${build.dir}/${archive}/bin"/>
<copy todir="${build.dir}/${archive}/bin">
<fileset dir="${bin}"/>
</copy>
<mkdir dir="${build.dir}/${archive}/src"/>
<copy todir="${build.dir}/${archive}/src">
<fileset dir="${source}"/>
</copy>