-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
771 lines (630 loc) · 27.6 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
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="JPivot" default="build" basedir=".">
<!--
======================================================================
This script depends on a repository of jars and a checkout/build of WCF
to run the build and tests.
There is a separate module in JPivot CVS for WCF. It needs to be checked out
and built via the "dist" target in order for this script to be successful.
Set the "wcf.dist" property to the dist directory within the WCF structure.
There is a separate module in JPivot CVS, jpivot_repository, that contains
the right jars and structure.
There are a set of targets named portlet-* in this script to build and deploy
the JBoss JPivot portlet. See src/jboss-portlet for more details.
For tests to run: requires in $ANT_HOME/lib
junit.jar
bcel-5.1 from jakarta.apache.org
http://ant-contrib.sourceforge.net/
======================================================================
-->
<!-- ===================== Property Definitions =========================== -->
<property file="build.properties"/>
<!-- property file="${user.home}/build.properties"/ -->
<!-- do not run the xml/a tests -->
<property name="tests.xmla.skip" value="true"/>
<property name="build.home" value="${basedir}/build"/>
<property name="dist.home" value="${basedir}/dist"/>
<property name="src.home" value="${basedir}/src"/>
<property name="resources.home" value="${basedir}/resources"/>
<property name="viewcvs" value="http://jpivot.cvs.sourceforge.net/jpivot"/>
<property name="repository.home" value="${basedir}/../jpivot_repository"/>
<!-- override these in your build.properties -->
<property name="catalina.home" value="${repository.home}/jakarta-tomcat-4.1.31"/>
<property name="xalan.home" value="${repository.home}/xalan-j_2_7_0"/>
<!-- the following are included in lib/ directory (no need to override) -->
<property name="mondrian.version" value="3.1.5.13307"/>
<property name="mondrian.home" value="${repository.home}/mondrian-${mondrian.version}"/>
<property name="eigenbase.home" value="${repository.home}/eigenbase"/>
<property name="jstl.home" value="${repository.home}/jakarta-taglibs-standard-1.0.6"/>
<property name="digester.home" value="${repository.home}/commons-digester-1.5"/>
<property name="collections.home" value="${repository.home}/commons-collections-3.1"/>
<property name="beanutils.home" value="${repository.home}/commons-beanutils-1.7.0"/>
<property name="logging.home" value="${repository.home}/commons-logging-1.0.4"/>
<property name="pool.home" value="${repository.home}/commons-pool-1.2"/>
<property name="dbcp.home" value="${repository.home}/commons-dbcp-1.2.1"/>
<property name="math.home" value="${repository.home}/commons-math-1.0"/>
<property name="vfs.home" value="${repository.home}/commons-vfs-1.0"/>
<property name="regexp.home" value="${repository.home}/jakarta-regexp-1.2"/>
<property name="junit.home" value="${repository.home}/junit-3.8.1"/>
<property name="log4j.home" value="${repository.home}/jakarta-log4j-1.2.8"/>
<property name="jfreechart.home" value="${repository.home}/jfreechart-1.0.0"/>
<property name="jsf.home" value="${repository.home}/jsf-1_1"/>
<property name="fop.home" value="${repository.home}/fop-0.20.5"/>
<property name="jai.home" value="${repository.home}/jai-1_1_2"/>
<property name="jwsdp.home" value="${repository.home}/jwsdp-1.1"/>
<property name="dom4j.home" value="${repository.home}/dom4j-1.4"/>
<property name="groovy.home" value="${repository.home}/groovy"/>
<property name="derby.home" value="${repository.home}/derby"/>
<property name="wcf.dist" value="${basedir}/../wcf/dist"/>
<property name="jboss.deploy" value="${jboss.home}/server/default/deploy"/>
<property name="jboss-portal.deploy" value="${jboss.deploy}/jboss-portal.sar"/>
<!-- ==================== File and Directory Names ======================== -->
<property name="jpivot.version" value="1.8.0"/>
<!-- ==================== Compilation Control Options ==================== -->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<property name="compile.source" value="1.4"/>
<property name="compile.target" value="1.4"/>
<!-- ==================== Classpath Settings =========================== -->
<path id="compile.classpath">
<!-- Include all JAR files that will be included in /WEB-INF/lib -->
<fileset dir="${build.home}/web/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<!-- Include all elements that Tomcat exposes to applications -->
<pathelement location="${catalina.home}/common/classes"/>
<fileset dir="${catalina.home}/common/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/common/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- classpath for junit tests -->
<path id="junit.classpath">
<path refid="compile.classpath"/>
<pathelement location="${build.home}/web/WEB-INF/classes"/>
<pathelement location="${build.home}/junit/classes"/>
<fileset dir="${jdbc.jardir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- classpath for portal build -->
<path id="portlet.classpath">
<path refid="compile.classpath"/>
<pathelement location="${build.home}/web/WEB-INF/classes"/>
<fileset dir="${jboss-portal.deploy}/lib">
<include name="portal-common-lib.jar"/>
<include name="portal-core-lib.jar"/>
<include name="portlet-api-lib.jar"/>
<include name="portal-common-lib.jar"/>
<include name="portal-portlet-lib.jar"/>
<include name="portal-bridge-lib.jar"/>
<include name="portal-server-lib.jar"/>
<include name="portals-bridges-common-0.2.jar"/>
</fileset>
</path>
<!-- ==================== Prepare Target ================================== -->
<!--
===============================================================
wcf is a separate build now.
This copies stuff from WCF Project into JPivot build directory
===============================================================
-->
<target name="initialize.wcf">
<delete dir="${src.home}/java/com/tonbeller/wcf"/>
<delete dir="${src.home}/java/com/tonbeller/tbutils"/>
<delete dir="${src.home}/test/com/tonbeller/tbutils"/>
<delete dir="${src.home}/webapp/wcf"/>
<delete dir="${src.home}/webapp/WEB-INF/wcf"/>
<copy todir="${build.home}/web">
<fileset dir="${wcf.dist}/web"/>
</copy>
</target>
<!--
===============================================================
copies all necessary files
===============================================================
-->
<target name="prepare" description="copies all necessary files">
<mkdir dir="${build.home}/src"/>
<antcall target="initialize.wcf"/>
<!-- Create build directories as needed -->
<mkdir dir="${build.home}/web/WEB-INF/classes"/>
<mkdir dir="${build.home}/web/WEB-INF/classes/foodmart"/>
<copy todir="${build.home}/web/WEB-INF/classes/foodmart">
<fileset dir="${resources.home}/derby-db/foodmart">
<include name="**/**"/>
</fileset>
</copy>
<mkdir dir="${build.home}/web/WEB-INF/lib"/>
<!-- copy binaries -->
<copy todir="${build.home}/web">
<fileset dir="${basedir}/src/webapp" />
</copy>
<!-- Copy external dependencies -->
<mkdir dir="${build.home}/web/WEB-INF/lib"/>
<copy todir="${build.home}/web/WEB-INF/lib" flatten="true">
<fileset dir="${groovy.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${beanutils.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${collections.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${dbcp.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${math.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${vfs.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${digester.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${logging.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${pool.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${derby.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${mondrian.home}">
<include name="eigenbase-properties.jar"/>
<include name="eigenbase-resgen.jar"/>
<include name="eigenbase-xom.jar"/>
<include name="commons-vfs.jar"/>
<include name="FoodMart.xml"/>
<include name="aggregates.dtd"/>
<include name="datasourcesconfig.dtd"/>
<include name="FoodMart.xml"/>
<include name="javacup.jar"/>
<include name="mondrian.dtd"/>
<include name="mondrian.jar"/>
<!--include name="retroweaver-rt-1.2.4.jar"/-->
</fileset>
<fileset dir="${junit.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${jfreechart.home}">
<include name="lib/jfreechart-*.jar"/>
<include name="lib/jcommon-*.jar"/>
</fileset>
<fileset dir="${jstl.home}">
<include name="lib/jstl.jar"/>
<include name="lib/standard.jar"/>
<include name="lib/jaxen-full.jar"/>
<include name="lib/saxpath.jar"/>
</fileset>
<fileset dir="${jsf.home}">
<include name="lib/jsf-api.jar"/>
<!-- include name="lib/jsf-impl.jar"/ -->
</fileset>
<fileset dir="${fop.home}">
<include name="build/fop.jar"/>
<include name="lib/avalon-framework-cvs-20020806.jar"/>
<include name="lib/batik.jar"/>
</fileset>
<fileset dir="${jai.home}">
<include name="lib/jai_core.jar"/>
<include name="lib/jai_codec.jar"/>
</fileset>
<fileset dir="${regexp.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${log4j.home}">
<include name="dist/lib/log4j-*.jar"/>
</fileset>
<fileset dir="${jwsdp.home}">
<include name="saaj-1.1.1/lib/saaj-ri.jar"/>
<include name="saaj-1.1.1/lib/saaj-api.jar"/>
<include name="jwsdp-shared/lib/mail.jar"/>
<include name="jwsdp-shared/lib/activation.jar"/>
</fileset>
<!-- saaj needs dom4j, but the dom4j in the saaj dir is too old and not compatible with jaxen -->
<fileset dir="${dom4j.home}">
<include name="dom4j.jar"/>
</fileset>
<fileset dir="${repository.home}">
<include name="commons-fileupload-1.0/*.jar"/>
</fileset>
</copy>
<copy todir="${build.home}/web/WEB-INF/queries" file="${mondrian.home}/FoodMart.xml"/>
<!-- create taglibs -->
<antcall target="taglibs"/>
<!-- for debugging -->
<copy todir="${build.home}/src">
<fileset dir="${mondrian.home}">
<include name="*-src.zip"/>
</fileset>
</copy>
</target>
<target name="portlet-prepare" description="Set up for JBoss portlet build">
<!-- Create build directories as needed -->
<mkdir dir="${build.home}/jboss-portlet/web/WEB-INF/classes"/>
<mkdir dir="${build.home}/jboss-portlet/web/WEB-INF/lib"/>
<!-- copy binaries -->
<copy todir="${build.home}/jboss-portlet/web">
<fileset dir="${src.home}/webapp">
<exclude name="**/*.jsp"/>
<exclude name="WEB-INF/web.xml"/>
<exclude name="**/*.properties"/>
</fileset>
</copy>
<!-- copy text files -->
<copy todir="${build.home}/jboss-portlet/web">
<fileset dir="${src.home}/jboss-portlet/webapp"/>
<fileset dir="${build.home}/web">
<include name="**/*.tld"/>
</fileset>
<filterset>
<filter token="VERSION" value="${jpivot.version}"/>
</filterset>
</copy>
</target>
<!-- ==================== All Target ====================================== -->
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<!-- ==================== Clean Target ==================================== -->
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
<delete dir="${basedir}/src/webapp/WEB-INF/classes"/>
</target>
<!-- ==================== Compile Target ================================== -->
<target name="compile" depends="prepare" description="Compile Java sources">
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}/web/WEB-INF/classes"/>
<mkdir dir="${build.home}/web/WEB-INF/lib"/>
<javac destdir="${build.home}/web/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}">
<src path="${src.home}/java"/>
<classpath refid="compile.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/web/WEB-INF/classes">
<fileset dir="${src.home}/java">
<exclude name="**/*.java"/>
<exclude name="**/package.html"/>
<exclude name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<target name="portlet-compile" depends="compile,portlet-prepare" description="Compile portlet Java sources">
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}/jboss-portlet"/>
<mkdir dir="${build.home}/jboss-portlet/web/WEB-INF/lib"/>
<javac destdir="${build.home}/jboss-portlet/web/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
source="${compile.source}"
target="${compile.target}">
<src path="${src.home}/jboss-portlet/java"/>
<classpath refid="portlet.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/jboss-portlet/web/WEB-INF/classes">
<fileset dir="${src.home}/jboss-portlet/java">
<exclude name="**/*.java"/>
<exclude name="**/package.html"/>
<exclude name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<!-- ==================== Archives Target ===================================== -->
<target name="archives" description="create distribution">
<!-- create jpivot.jar -->
<jar jarfile="${build.home}/jpivot.jar">
<exclude name="**/WEB-INF/classes/foodmart/**"/>
<!-- fileset dir="${build.home}/web/WEB-INF/classes"/ -->
</jar>
<!-- Create application WAR file -->
<mkdir dir="${dist.home}"/>
<jar jarfile="${build.home}/jpivot.war">
<fileset dir="${build.home}/web">
<include name="**/*"/>
</fileset>
</jar>
<zip destfile="${build.home}/jpivot.war" update="true">
<zipfileset dir="${build.home}" prefix="WEB-INF/lib">
<include name="jpivot.jar"/>
</zipfileset>
</zip>
</target>
<!-- ==================== Dist Target ===================================== -->
<target name="build" depends="clean,compile,archives" description="build w/o tests" />
<target name="dist" depends="clean,compile,tests,javadoc,projdocs,archives" description="build everything">
<!-- Create distribution -->
<zip destfile="${dist.home}/jpivot-${jpivot.version}.zip" update="false" duplicate="fail">
<zipfileset dir="${build.home}" prefix="jpivot-${jpivot.version}" >
<include name="jpivot.war"/>
<include name="docs/**"/>
</zipfileset>
<zipfileset dir="${src.home}" defaultexcludes="true" prefix="jpivot-${jpivot.version}/src"/>
<zipfileset dir="${build.home}/src" defaultexcludes="true" prefix="jpivot-${jpivot.version}/src"/>
<zipfileset dir="${basedir}" prefix="jpivot-${jpivot.version}">
<include name="build.xml"/>
<include name="*.example"/>
<include name=".project"/>
<include name=".classpath"/>
<include name="LICENSE.txt"/>
</zipfileset>
</zip>
</target>
<!-- ==================== Portlet Packaging and Deployment Targets ===================================== -->
<target name="portlet-archive" description="create portlet distribution" depends="portlet-compile,archives">
<!-- Create application portlet WAR file -->
<jar jarfile="${build.home}/jpivot-portlet-${jpivot.version}.war">
<fileset dir="${build.home}/web">
<!-- <include name="**/WEB-INF/lib/**"/> -->
<exclude name="**/WEB-INF/classes/**"/>
<exclude name="**/WEB-INF/lib/log4j*.jar"/>
</fileset>
<fileset dir="${build.home}/jboss-portlet/web">
</fileset>
</jar>
<zip destfile="${build.home}/jpivot-portlet-${jpivot.version}.war" update="true">
<zipfileset dir="${build.home}" prefix="WEB-INF/lib">
<include name="jpivot.jar"/>
</zipfileset>
</zip>
<!-- Create JPivot portlet theme WAR file -->
<jar jarfile="${build.home}/jpivot-portlet-${jpivot.version}-theme.war">
<fileset dir="${src.home}/jboss-portlet/theme"/>
</jar>
</target>
<target name="war-deploy" description="Deploy the Application" depends="archives">
<copy todir="${jboss.deploy}">
<fileset dir="${build.home}">
<include name="jpivot.war"/>
</fileset>
</copy>
</target>
<target name="portlet-deploy" description="Deploy the portlet" depends="portlet-archive">
<mkdir dir="${jboss.deploy}/jpivot-portlet-${jpivot.version}.war"/>
<copy todir="${jboss.deploy}">
<fileset dir="${build.home}">
<include name="jpivot-portlet-theme.war"/>
</fileset>
</copy>
<unzip src="${build.home}/jpivot-portlet-${jpivot.version}.war" dest="${jboss.deploy}/jpivot-portlet-${jpivot.version}.war"/>
</target>
<!-- ==================== Portlet Distribution packaging ========================= -->
<target name="portlet-dist" description="Package the portlet for distribution" depends="portlet-archive">
<zip destfile="${dist.home}/jpivot-portlet-${jpivot.version}.zip" update="false" duplicate="fail">
<zipfileset dir="${build.home}" prefix="jpivot-portlet-${jpivot.version}" >
<include name="jpivot-portlet-${jpivot.version}.war"/>
<include name="jpivot-portlet-${jpivot.version}-theme.war"/>
<include name="docs/**"/>
</zipfileset>
<zipfileset dir="${src.home}" defaultexcludes="true" prefix="jpivot-${jpivot.version}/src"/>
<zipfileset dir="${build.home}/src" defaultexcludes="true" prefix="jpivot-${jpivot.version}/src"/>
<zipfileset dir="${basedir}" prefix="jpivot-portlet-${jpivot.version}">
<include name="build.xml"/>
<include name=".project"/>
<include name=".classpath"/>
<include name="*.example"/>
</zipfileset>
<zipfileset dir="${src.home}/jboss-portlet" prefix="jpivot-portlet-${jpivot.version}">
<include name="*.txt"/>
</zipfileset>
</zip>
</target>
<!-- ==================== Portlet Demo packaging:TBD ========================= -->
<target name="portlet-demo-dist" description="Package the portlet for the demonstration distribution" depends="portlet-archive">
</target>
<!-- ==================== ProjDocs Target ================================== -->
<target name="projdocs" description="Create project documentation and website">
<mkdir dir="${build.home}/docs"/>
<mkdir dir="${build.home}/docs/downloads"/>
<copy todir="${build.home}/docs">
<fileset dir="${src.home}/docs">
<include name="*.xml"/>
<include name="*.xsl"/>
</fileset>
<filterset>
<filter token="VERSION" value="${jpivot.version}" />
</filterset>
</copy>
<copy todir="${build.home}/docs">
<fileset dir="${src.home}/docs">
<exclude name="*.xml"/>
<exclude name="*.xsl"/>
</fileset>
</copy>
<java jar="${xalan.home}/bin/xalan.jar" fork="true">
<jvmarg value="-Duser.language=en"/>
<jvmarg value="-Duser.region=US"/>
<arg value="-in"/>
<arg value="${build.home}/docs/content.xml"/>
<arg value="-xsl"/>
<arg value="${build.home}/docs/layout.xsl"/>
<arg value="-out"/>
<arg value="${build.home}/docs/dummy.html"/>
</java>
</target>
<target name="changelog" description="creates CVS Changelog">
<mkdir dir="${build.home}/docs"/>
<cvschangelog dir="${src.home}" destfile="${build.home}/docs/changelog.xml" daysinpast="730" />
<style in="${build.home}/docs/changelog.xml"
out="${build.home}/docs/changelog.html"
style="${ant.home}/etc/changelog.xsl">
<param name="title" expression="JPivot ChangeLog"/>
<param name="module" expression="/jpivot/src"/>
<param name="cvsweb" expression="${viewcvs}"/>
</style>
</target>
<!-- ==================== Javadoc Target ================================== -->
<target name="javadoc" depends="compile" description="Create Javadoc API documentation">
<mkdir dir="${build.home}/docs/api"/>
<javadoc destdir="${build.home}/docs/api" packagenames="com.tonbeller.*">
<classpath refid="compile.classpath"/>
<sourcepath path="${src.home}/java"/>
</javadoc>
</target>
<!-- ==================== JUnit Tests =================================== -->
<target name="tests" description="JUnit Tests" depends="compile,runtests,checktests"/>
<target name="runtests" description="JUnit Tests" depends="testcompile,testmondrian,testxmla,reports"/>
<target name="testcompile" description="Compile for JUnit Tests">
<mkdir dir="${build.home}/docs/junit"/>
<mkdir dir="${build.home}/junit/logs"/>
<mkdir dir="${build.home}/junit/classes"/>
<!-- compile test classes -->
<javac destdir="${build.home}/junit/classes">
<src path="${src.home}/test"/>
<classpath refid="junit.classpath"/>
</javac>
<copy todir="${build.home}/junit/classes">
<fileset dir="${src.home}/test">
<exclude name="**/*.java"/>
<exclude name="**/package.html"/>
<exclude name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<target name="testmondrian" description="Mondrian JUnit Tests">
<!-- run unit tests (Mondrian)-->
<junit printsummary="yes" fork="yes" failureProperty="junit.failed">
<jvmarg value="-Djdbc.driver=${jdbc.driver}"/>
<jvmarg value="-Djdbc.url=${jdbc.url}"/>
<jvmarg value="-Djdbc.user=${jdbc.user}"/>
<jvmarg value="-Djdbc.password=${jdbc.password}"/>
<jvmarg value="-Dtest.dir=${basedir}/tests"/>
<jvmarg value="-Dcatalog.uri=file:///${build.home}/web/WEB-INF/queries/FoodMart.xml"/>
<!-- must be set in TOMCAT too -->
<jvmarg value="-Dcom.tonbeller.environment=test"/>
<classpath refid="junit.classpath"/>
<formatter type="xml"/>
<batchtest todir="${build.home}/junit/logs">
<fileset dir="${src.home}/test">
<include name="**/*Test.java" />
<exclude name="com/tonbeller/jpivot/xmla/*"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="testxmla" description="XMLA JUnit Tests" unless="tests.xmla.skip">
<!-- run unit tests (XMLA)-->
<junit printsummary="yes" fork="yes" failureProperty="junit.failed">
<jvmarg value="-Dxmla.uri=${xmla.uri}"/>
<jvmarg value="-Dxmla.catalog=${xmla.catalog}"/>
<classpath refid="junit.classpath"/>
<formatter type="xml"/>
<batchtest todir="${build.home}/junit/logs">
<fileset dir="${src.home}/test">
<include name="com/tonbeller/jpivot/xmla/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="reports" description="JUnit Test Reports">
<!-- create reports -->
<junitreport todir="${build.home}/docs/junit">
<fileset dir="${build.home}/junit/logs">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.home}/docs/junit"/>
</junitreport>
</target>
<target name="checktests" description="Abort build if JUnit Test failed" if="junit.failed">
<fail message="JUnit Test(s) failed"/>
</target>
<!-- ==================== Taglibs =================================== -->
<target name="taglibs" description="Taglibs">
<mkdir dir="${build.home}/web"/>
<mkdir dir="${build.home}/docs/tags"/>
<!-- create tld files -->
<style basedir="${src.home}/webapp"
destdir="${build.home}/web"
style="${src.home}/tags/tags2tld.xsl"
extension=".tld">
<include name="**/*-tags.xml" />
</style>
<antcall target="taglibdoc">
<param name="taglib.dir" value="jpivot"/>
</antcall>
</target>
<target name="taglibdoc">
<style basedir="${src.home}/webapp/WEB-INF/${taglib.dir}"
destdir="${build.home}/docs/tags"
style="${src.home}/tags/tags2html.xsl"
extension="-en.html">
<include name="**/*-tags.xml" />
<param name="lang" expression="en"/>
</style>
<style basedir="${src.home}/webapp/WEB-INF/${taglib.dir}"
destdir="${build.home}/docs/tags"
style="${src.home}/tags/tags2html.xsl"
extension="-de.html">
<include name="**/*-tags.xml" />
<param name="lang" expression="de"/>
</style>
</target>
<!-- ==================== Catalina Targets =================================== -->
<property name="test.server" value="localhost:8080"/>
<property name="app.path" value="/jpivot"/>
<property name="manager.url" value="http://${test.server}/manager"/>
<property name="manager.username" value="manager"/>
<property name="manager.password" value="manager"/>
<target name="list"
description="List installed applications on servlet container">
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath>
<pathelement location="${catalina.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<list url="${manager.url}"
username="${manager.username}"
password="${manager.password}"/>
</target>
<target name="install" depends="compile"
description="Install application to servlet container">
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
<classpath>
<pathelement location="${catalina.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<install url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="file://${build.home}/web"/>
</target>
<target name="reload" depends="compile"
description="Reload application on servlet container">
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath>
<pathelement location="${catalina.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="remove"
description="Remove application on servlet container">
<taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask">
<classpath>
<pathelement location="${catalina.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<remove url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
</project>