forked from pentaho/mondrian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1244 lines (1111 loc) · 45.3 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
<!--
== This software is subject to the terms of the Eclipse Public License v1.0
== Agreement, available at the following URL:
== http://www.eclipse.org/legal/epl-v10.html.
== You must accept the terms of that agreement to use this software.
==
== Copyright (C) 2001-2005 Julian Hyde
== Copyright (C) 2005-2012 Pentaho and others
== All Rights Reserved.
-->
<project name="mondrian" default="help" xmlns:ivy="antlib:org.apache.ivy.ant">
<property environment="env"/>
<property name="project.location" location="${basedir}"/>
<property name="lib.location" location="${project.location}/lib"/>
<property file="${project.location}/build.properties"/>
<property file="${project.location}/test.properties"/>
<property file="${project.location}/mondrian.properties"/>
<property name="project.build.debug" value="on"/>
<property name="testsrc.dir" value="${basedir}/testsrc/main" />
<!--
===================================================================
Set the properties related to paths
===================================================================
-->
<!--
Set src.dir to an absolute path when building with CruiseControl.
Otherwise, set it to a relative path.
-->
<condition property="src.dir" value="${basedir}/src">
<isset property="cruisecontrol" />
</condition>
<condition property="src.dir" value="src">
<not>
<isset property="cruisecontrol" />
</not>
</condition>
<property name="build.dir" value="build"/>
<property name="bin.dir" value="build"/>
<property name="testsrc.dir" value="testsrc"/>
<property name="testsrc.dir.relative" value="testsrc"/>
<property name="java.dir" value="${src.dir}/main"/>
<property name="javatest.dir" value="${testsrc.dir}"/>
<property name="lib.dir" value="lib"/>
<property name="wb.plugins.dir" value="workbench/plugins"/>
<property name="doc.dir" value="doc"/>
<property name="javadoc.dir" value="${doc.dir}/api"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="testclasses.dir" value="${build.dir}/testclasses"/>
<property name="dist.name" value="${name}-${project.revision}"/>
<property name="dist.base" value="distribution"/>
<property name="dist.dir" value="dist"/>
<property name="demo.dir" value="demo"/>
<property name="dist.src.file" value="${dist.dir}/${dist.name}-src.zip"/>
<property name="dist.bin.file" value="${dist.dir}/${dist.name}.zip"/>
<property name="dist.doc.file" value="${dist.dir}/doc.tar.gz"/>
<property name="jar.file" value="${lib.dir}/${name}.jar"/>
<property name="workbench.jar.file" value="${lib.dir}/workbench.jar"/>
<property name="workbench.dist.name" value="workbench-${project.revision}"/>
<property name="workbench.zip-dist.file" value="${workbench.dist.name}.zip"/>
<property name="workbench.main.class" value="mondrian.gui.Workbench"/>
<property name="resource.jar.file" value="${lib.dir}/eigenbase-resgen.jar"/>
<property name="xom.jar.file" value="${lib.dir}/eigenbase-xom.jar"/>
<property name="jdk.home" value="${env.JAVA_HOME}"/>
<tstamp>
<format property="copyright.year" pattern="yyyy"/>
</tstamp>
<!-- Override this to tell Subfloor how to run the junit & jacoco -->
<property name="junit.test.pattern" value="mondrian/test/Main.java"/>
<!-- Map some mondrian.* properties to junit.sysprop.*
so they get passed to the test fork (see subfloor) -->
<property name="junit.sysprop.mondrian.jdbcDrivers"
value="${mondrian.jdbcDrivers}"/>
<property name="junit.sysprop.mondrian.foodmart.jdbcURL"
value="${mondrian.foodmart.jdbcURL}"/>
<property name="junit.sysprop.mondrian.foodmart.jdbcUser"
value="${mondrian.foodmart.jdbcUser}"/>
<property name="junit.sysprop.mondrian.foodmart.jdbcPassword"
value="${mondrian.foodmart.jdbcPassword}"/>
<property name="junit.sysprop.mondrian.test.foodmart.catalogURL"
value="${mondrian.foodmart.catalogURL}"/>
<!-- tests require en_US locale -->
<property name="junit.sysprop.user.language" value="en"/>
<property name="junit.sysprop.user.region" value="US"/>
<property name="log4j.configuration" value="log4j.xml" />
<property name="generated.java.files" value="
${java.dir}/mondrian/olap/Parser.java,
${java.dir}/mondrian/olap/ParserSym.java,
${java.dir}/mondrian/parser/MdxParserImpl.java,
${java.dir}/mondrian/parser/MdxParserImplTokenManager.java,
${java.dir}/mondrian/parser/ParseException.java,
${java.dir}/mondrian/parser/SimpleCharStream.java,
${java.dir}/mondrian/parser/Token.java,
${java.dir}/mondrian/parser/TokenMgrError.java,
${java.dir}/mondrian/olap/MondrianDef.java,
${java.dir}/mondrian/olap/Mondrian3Def.java,
${java.dir}/mondrian/olap/MondrianProperties.java,
${java.dir}/mondrian/gui/MondrianGuiDef.java,
${java.dir}/mondrian/resource/MondrianResource*.java,
${java.dir}/mondrian/xmla/DataSourcesConfig*.java,
${java.dir}/mondrian/server/MondrianServerVersion.java
${etc.dir}/mondrian/web/jsp/**/*.java"/>
<property name="generated.lib.files" value="
${lib.dir}/mondrian.jar,
${lib.dir}/workbench.jar,
${lib.dir}/mondrian.xml,
${lib.dir}/*.dtd,
VERSION.txt,
${doc.dir}/properties.html,
mondrian.properties.template,
demo/FoodMartCreateData.sql"/>
<!--
===================================================================
Properties for running the FoodMart test. Override them by
editing test.properties, mondrian.properties, or plain System
properties*.
* only for mondrian.* properties from System are passed
===================================================================
-->
<!-- Comma-separated list of jdbc drivers. Override in test.properties. -->
<property name="mondrian.jdbcDrivers" value="sun.jdbc.odbc.JdbcOdbcDriver"/>
<!-- Connect string to the database. Override in test.properties. -->
<property name="mondrian.foodmart.jdbcURL" value="jdbc:odbc:MondrianFoodMart"/>
<!-- Classpath for JDBC drivers. Override in your test.properties. -->
<property name="driver.classpath" value=""/>
<!-- URL of the catalog definition. -->
<property name="mondrian.foodmart.catalogURL"
value="file:${project.location}/${demo.dir}/FoodMart.xml"/>
<!-- Test class name. -->
<property name="mondrian.test.Class" value=""/>
<!-- Test pattern. -->
<property name="mondrian.test.Name" value=""/>
<!-- Arguments to the java process spawned by the junit task. -->
<property name="junit.jvmargs" value="-ea -esa -Xmx1024m"/>
<property name="junit.maxmemory" value="1024M"/>
<!--
===================================================================
Now import subfloor. All properties must be overridden first
=================================================================== -->
<import file="subfloor.xml" />
<import file="subfloor-pkg.xml" />
<!-- Define some classpaths -->
<path id="classpath.custom" description="Adds WB dependencies">
<pathelement location="${wb.plugins.dir}/kettle-dbdialog.jar"/>
<pathelement location="${wb.plugins.dir}/kettle-core.jar"/>
<pathelement location="${wb.plugins.dir}/pentaho-xul-core.jar"/>
<pathelement location="${wb.plugins.dir}/pentaho-xul-swing.jar"/>
</path>
<path id="project.build.classpath" description="The classpath for resgen">
<pathelement location="${classes.dir}"/>
<path refid="classpath"/>
</path>
<path id="test.classpath.custom" description="Adds the db driver class to the test classpath">
<pathelement path="${driver.classpath}"/>
</path>
<target name="define-tasks" depends="prepare">
<taskdef name="javacup" classname="java_cup.JavaCUPTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="xomgen" classname="org.eigenbase.xom.XOMGenTask">
<classpath refid="classpath"/>
</taskdef>
<taskdef name="resgen" classname="org.eigenbase.resgen.ResourceGenTask">
<classpath refid="project.build.classpath"/>
</taskdef>
</target>
<target name="help">
<echo>
You must specify a specific project target when using the ANT build.
Targets are one of the following:
- help
This is the help.
- info
Shows configuration info.
- binzip
Compiles Mondrian and wraps everything in a neat little package,
including documentation.
- workbench-dist
Compiles PSW and wraps everything in a neat little package.
- jar
Creates a Mondrian jar.
- workbench
Creates Mondrian and workbench jars.
- clean
Deletes build output.
- clean-deep
Clean build output and generated sources.
- javadoc
Create the API documentation.
- test
Runs the tests. Requires FoodMart to be installed. (see below)
- jacoco
Runs the tests with jacoco to measure coverage. Requires FoodMart
to be installed. (see below)
-load-foodmart
Will load the test DB FoodMart using the JDBC parameters specified.
(see below)
To run the tests, you must have FoodMart available in a database.
You can pass the DB configuration through the command line arguments,
like so:
ant -Dmondrian.foodmart.jdbcURL="jdbc:mysql://localhost/foodmart" \
-Dmondrian.foodmart.jdbcUser=foodmart \
-Dmondrian.foodmart.jdbcPassword=foodmart \
-Dmondrian.jdbcDrivers=com.mysql.jdbc.Driver \
-Ddriver.classpath="/opt/mysql-connector-java-5.1.25-bin.jar"
test
Alternatively, these can be written to a file at the root of the project.
Create a file 'mondrian.properties' containing this:
mondrian.foodmart.jdbcURL=jdbc:mysql://localhost/foodmart
mondrian.foodmart.jdbcUser=foodmart
mondrian.foodmart.jdbcPassword=foodmart
mondrian.jdbcDrivers=com.mysql.jdbc.Driver
driver.classpath=/opt/mysql-connector-java-5.1.25-bin.jar
To load foodmart into your DB, you can call the 'load-foodmart' target
before 'test'.
The parameters can be adjusted to point to a different DB than MySQL.
</echo>
</target>
<target name="info">
<echo>==============================================================</echo>
<echo>| Mondrian configuration info |</echo>
<echo>==============================================================</echo>
<echo>project.location = ${project.location}</echo>
<echo>jdk.home = ${env.JAVA_HOME}</echo>
<echo>log4j.configuration = ${log4j.configuration}</echo>
<echo>mondrian.foodmart.catalogURL = ${mondrian.foodmart.catalogURL}</echo>
<echo>mondrian.foodmart.jdbcURL = ${mondrian.foodmart.jdbcURL}</echo>
<echo>mondrian.jdbcDrivers = ${mondrian.jdbcDrivers}</echo>
<echo>driver.classpath (additions) = ${driver.classpath}</echo>
<echo>==============================================================</echo>
</target>
<target name="clean" depends="subfloor.clean">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${lib.dir}" includes="*" excludes="mondrian.xsd,xml-apis.jar,postgresql-9.4.1208.jre7.jar"/>
<fileset dir="${classes.dir}" includes="**/*.class,**/*.properties"/>
<fileset dir="${testclasses.dir}" includes="**/*.class,**/*.properties"/>
<fileset dir="." includes="${generated.java.files},${generated.lib.files},VERSION.txt"/>
<fileset dir="demo/derby/foodmart"/>
<fileset dir="${javadoc.dir}" />
<fileset dir="${testsrc.dir}" includes="**/*.log.xml"/>
<fileset dir="${testsrc.dir}" includes="**/*JUnit.java"/>
<fileset dir="${wb.plugins.dir}" includes="*.jar"/>
</delete>
</target>
<target name="clean-deep">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${lib.dir}" includes="*.jar,*.war" excludes="xml-apis.jar"/>
<fileset dir="${classes.dir}"/>
<fileset dir="${testclasses.dir}"/>
<fileset dir="${dist.dir}"/>
</delete>
<antcall target="clean"/>
</target>
<target name="prepare" depends="install-ivy,resolve">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${testclasses.dir}"/>
<mkdir dir="${devlib.dir}"/>
<mkdir dir="${testlib.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${bin.dir}"/>
</target>
<target name="resolve" unless="skip.download" >
<!-- Use symbolic links, rather than copying, on unix. -->
<condition property="symlink" value="true">
<os family="unix"/>
</condition>
<echo message="symlink=${symlink}"/>
<!-- Mondrian dependencies. -->
<ivy:resolve file="ivy.xml"/>
<ivy:retrieve symlink="${symlink}" type="jar,war"
pattern="${lib.dir}/[module].[ext]"/>
<ivy:retrieve symlink="${symlink}" type="source,javadoc"
pattern="${lib.dir}/[module]-[type].[ext]"/>
</target>
<target name="resolve-for-workbench" depends="prepare" unless="skip.download">
<!-- Use symbolic links, rather than copying, on unix. -->
<condition property="symlink" value="true">
<os family="unix"/>
</condition>
<echo message="symlink=${symlink}"/>
<!-- Workbench dependencies to workbench/plugins -->
<ivy:resolve file="workbench/ivy.xml"/>
<ivy:retrieve symlink="${symlink}" type="jar"
pattern="${wb.plugins.dir}/[module].[ext]"/>
<ivy:retrieve symlink="${symlink}" type="source,javadoc"
pattern="${wb.plugins.dir}/[module]-[type].[ext]"/>
</target>
<target name="resolve-workbench-runtime-deps" depends="prepare"
unless="skip.download"
description="Resolves runtime dependencies not required for compilation.">
<ivy:resolve file="workbench/assembly_ivy.xml"/>
<ivy:retrieve symlink="${symlink}"
pattern="${wb.plugins.dir}/[module].[ext]"/>
<ivy:retrieve symlink="${symlink}" type="source,javadoc"
pattern="${wb.plugins.dir}/[module]-[type].[ext]"/>
</target>
<target name="cmdrunner" depends="jar">
<property name="crtmp.dir" location="${build.dir}/tmpcmdrunner"/>
<mkdir dir="${crtmp.dir}"/>
<unjar src="${lib.dir}/commons-dbcp.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/commons-collections.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/commons-logging.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/commons-pool.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/commons-vfs2.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/eigenbase-properties.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/eigenbase-resgen.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/eigenbase-xom.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/javacup.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/log4j.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/mondrian.jar" dest="${crtmp.dir}"/>
<unjar src="${lib.dir}/servlet-api.jar" dest="${crtmp.dir}"/>
<unjar dest="${crtmp.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="**/junit.zip"/>
</fileset>
</unjar>
<copy file="./testsrc/main/log4j.xml" todir="${crtmp.dir}"/>
<jar destfile="${lib.dir}/cmdrunner.jar" >
<fileset dir="${crtmp.dir}" >
<include name="**/*.xml"/>
<include name="**/*.class"/>
<include name="**/*.properties"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="mondrian.tui.CmdRunner"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
</jar>
<delete dir="${crtmp.dir}" quiet="true"/>
</target>
<target name="cmdrunner-run" depends="jar">
<java fork="yes" classpathref="test.classpath" classname="mondrian.tui.CmdRunner">
<sysproperty key="log4j.configuration" value="${log4j.configuration}"/>
<!-- <arg value="-d"/> -->
</java>
</target>
<target name="compile.pre" depends="
version,
prepare,
parser,
generate.resources,
generate.properties,
def,
subfloor.compile.pre"/>
<target name="compile" depends="init, compile.pre, compile.java, compile.post">
<!-- TODO This needs to be cleaned up. Mondrian entirely bypasses the
compile target of subfloor. It shouldn't need to, but that's for
another day. -->
</target>
<target name="generate.resources" depends="define-tasks">
<!-- Compile MondrianException first, so that resgen can use
reflection on it. -->
<javac
srcdir="${java.dir}"
destdir="${classes.dir}"
debug="${project.build.debug}"
classpathref="project.build.classpath"
includeantruntime="false"
source="${javac.source}"
target="${javac.target}">
<include name="mondrian/olap/MondrianException.java" />
<include name="mondrian/olap/ResultLimitExceededException.java" />
<include name="mondrian/olap/InvalidHierarchyException.java" />
<include name="mondrian/olap/ResourceLimitExceededException.java" />
<include name="mondrian/olap/NativeEvaluationUnsupportedException.java" />
<include name="mondrian/olap/QueryCanceledException.java" />
<include name="mondrian/olap/QueryTimeoutException.java" />
</javac>
<resgen
srcdir="${java.dir}"
resdir="${classes.dir}"
style="functor"
locales="en_US,de_DE,de,es_ES">
<include name="mondrian/resource/MondrianResource.xml"/>
</resgen>
</target>
<target name="generate.properties">
<!-- Generate MondrianProperties.java,
mondrian.properties.template, property.html. -->
<javac
srcdir="${java.dir}"
destdir="${classes.dir}"
debug="${project.build.debug}"
classpathref="project.build.classpath"
includeantruntime="false"
source="${javac.source}"
target="${javac.target}">
<include name="mondrian/util/PropertyUtil.java" />
</javac>
<java classpathref="project.build.classpath"
classname="mondrian.util.PropertyUtil"
fork="no"/>
</target>
<!--target name="apologise" unless="java.version.matches.requested">
<echo>Actual JVM Version (${java.runtime.version}) does not match
requested (${requested.java.version}); skipping compile for this JDK.
If you wish to build for this JDK, modify ${unix.script}.
</echo>
</target-->
<target name="compile.java">
<echo>Compiling on JVM Version: ${java.runtime.version}</echo>
<condition property="include.gui">
<isset property="include.workbench" />
</condition>
<echo>include.gui=${include.gui}</echo>
<javac
srcdir="${java.dir}"
destdir="${classes.dir}"
debug="${project.build.debug}"
classpathref="project.build.classpath"
source="${javac.source}"
target="${javac.target}"
includeantruntime="false">
<include name="mondrian/**/*.java"/>
<exclude name="mondrian/gui/**/*.java" unless="include.gui" />
</javac>
<copy file="src/main/mondrian/rolap/aggmatcher/DefaultRules.xml"
todir="${classes.dir}"/>
<copy file="VERSION.txt"
todir="${classes.dir}"/>
<copy file="src/main/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml"
todir="${classes.dir}"/>
<copy todir="${classes.dir}">
<fileset
dir="${java.dir}"
includes="
META-INF/**"/>
</copy>
</target>
<target name="parser" depends="define-tasks">
<!-- Old parser. -->
<javacup
srcdir="${java.dir}"
input="${java.dir}/mondrian/olap/Parser.cup"
expect="63"
interface="true"/>
<!-- New parser. -->
<javacc
target="${java.dir}/mondrian/parser/MdxParser.jj"
javacchome="${lib.dir}"/>
</target>
<target name="def" depends="define-tasks">
<xomgen
model="${java.dir}/mondrian/olap/Mondrian.xml"
destdir="${java.dir}"
classname="mondrian.olap.MondrianDef"
dtdname="mondrian.dtd"/>
<copy file="${java.dir}/mondrian/olap/mondrian.dtd"
todir="${lib.dir}"/>
<!-- Workbench needs a different model. See Mondrian_SW.xml for details. -->
<xomgen
model="${java.dir}/mondrian/olap/Mondrian_SW.xml"
destdir="${java.dir}"
classname="mondrian.gui.MondrianGuiDef"
dtdname="mondrian_SW.dtd"
/>
<xomgen
model="${java.dir}/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml"
destdir="${java.dir}"
classname="mondrian.rolap.aggmatcher.DefaultDef"
dtdname="aggregates.dtd"/>
<copy file="${java.dir}/mondrian/rolap/aggmatcher/aggregates.dtd"
todir="${lib.dir}"/>
<xomgen
model="${java.dir}/mondrian/xmla/DataSourcesConfig.xml"
destdir="${java.dir}"
classname="mondrian.xmla.DataSourcesConfig"
dtdname="datasourcesconfig.dtd"/>
<copy file="${java.dir}/mondrian/xmla/datasourcesconfig.dtd"
todir="${lib.dir}"/>
</target>
<!-- Before you run it, you will need to set the
"mondrian.jdbcDrivers", "mondrian.foodmart.jdbcURL", and
"mondrian.foodmart.catalogURL" properties. The easiest way to
do this is to edit the file "test.properties". -->
<target name="set.connectString">
<!-- Ensure that the JdbcUser parameter is only added to the connect string
if the mondrian.foodmart.jdbcUser property is set. Likewise
JdbcPassword. -->
<condition property="jdbcUser"
value=";JdbcUser='${mondrian.foodmart.jdbcUser}'">
<isset property="mondrian.foodmart.jdbcUser"/>
</condition>
<condition property="jdbcUser" value="">
<not>
<isset property="mondrian.foodmart.jdbcUser"/>
</not>
</condition>
<condition property="jdbcPassword"
value=";JdbcPassword='${mondrian.foodmart.jdbcPassword}'">
<isset property="mondrian.foodmart.jdbcPassword"/>
</condition>
<condition property="jdbcPassword" value="">
<not>
<isset property="mondrian.foodmart.jdbcPassword"/>
</not>
</condition>
<property name="mondrian.test.connectString"
value="Provider=mondrian;Jdbc='${mondrian.foodmart.jdbcURL}'${jdbcUser}${jdbcPassword};Catalog='${mondrian.foodmart.catalogURL}'"/>
<!-- Make sure it is added by subfloor when running tests -->
<property name="junit.sysprop.mondrian.test.connectString"
value="${mondrian.test.connectString}" />
</target>
<target name="test" depends="info,subfloor.test">
<!-- Add 'info' before 'test' -->
</target>
<target name="jacoco" depends="info,subfloor.jacoco">
<!-- Add 'info' before 'jacoco' -->
</target>
<target name="compile-tests" depends="subfloor.compile-tests,set.connectString">
</target>
<condition property="tests.skip" value="true">
<isset property="mondrian.tests.skip"/>
</condition>
<target name="test-list">
<property name="test.args" value="-l"/>
<antcall target="test-only"/>
</target>
<target name="junit-main" depends="" unless="tests.skip">
<echo>The target 'junit-main' was replaced by 'test'.
Please call this one instead.</echo>
<antcall target="test"/>
</target>
<target name="version">
<echo file="VERSION.txt">Title: ${name}
Version: ${project.revision}
VersionMajor: ${project.revision.major}
VersionMinor: ${project.revision.minor}
Vendor: ${vendor}
</echo>
<echo file="${java.dir}/mondrian/olap4j/MondrianOlap4jDriverVersion.java">/*
* Project version information. Generated - do not modify.
*/
package mondrian.olap4j;
/**
* Version information for the Mondrian olap4j driver. (Generated.)
*/
class MondrianOlap4jDriverVersion {
static final String NAME = "${driver.name}";
static final String VERSION = "${driver.version}";
static final int MAJOR_VERSION = ${driver.version.major};
static final int MINOR_VERSION = ${driver.version.minor};
}
// End MondrianOlap4jDriverVersion.java</echo>
<echo file="${java.dir}/mondrian/server/MondrianServerVersion.java">/*
* Project version information. Generated - do not modify.
*/
package mondrian.server;
/**
* Version information for Mondrian. (Generated by build)
*/
class MondrianServerVersion {
static final String VENDOR = "${vendor}";
static final String NAME = "${name}";
static final String VERSION = "${project.revision}";
static final int MAJOR_VERSION = ${project.revision.major};
static final int MINOR_VERSION = ${project.revision.minor};
static final String COPYRIGHT_YEAR = "${copyright.year}";
}
// End MondrianServerVersion.java</echo>
</target>
<target name="srczip" depends="version">
<mkdir dir="${dist.dir}" />
<delete file="${dist.src.file}"/>
<zip
zipfile="${dist.src.file}"
update="true">
<zipfileset
dir="."
prefix="${dist.name}"
includes="
${java.dir}/**/*.properties,
${java.dir}/META-INF/**,
${java.dir}/mondrian/resource/MondrianResource.xml,
${java.dir}/mondrian/olap/Mondrian.xml,
${java.dir}/mondrian/olap/Mondrian_SW.xml,
${java.dir}/mondrian/olap/MondrianProperties.xml,
${java.dir}/mondrian/rolap/aggmatcher/DefaultRules.xml,
${java.dir}/mondrian/rolap/aggmatcher/DefaultRulesSchema.xml,
${java.dir}/mondrian/xmla/DataSourcesConfig.xml,
${java.dir}/**/*.java,
${java.dir}/**/*.cup,
${java.dir}/**/*.jj,
${java.dir}/**/*.gif,
${java.dir}/**/*.png,
${java.dir}/**/*.html,
${lib.dir}/mondrian.xsd,
${testsrc.dir.relative}/queryFiles/**/*.xml,
${testsrc.dir.relative}/**/*.csv,
${testsrc.dir.relative}/**/*.error,
${testsrc.dir.relative}/**/*.java,
${testsrc.dir.relative}/**/*.xml,
${testsrc.dir.relative}/**/*.html,
${testsrc.dir.relative}/**/*.txt,
${testsrc.dir.relative}/**/*.sql,
${webapp.dir}/WEB-INF/*.xml,
${webapp.dir}/**/*.jsp,
${webapp.dir}/WEB-INF/*.xsl,
${webapp.dir}/WEB-INF/*.tld,
${doc.dir}/**/*.css,
${doc.dir}/**/*.gif,
${doc.dir}/**/*.png,
${doc.dir}/**/*.jpeg,
${doc.dir}/**/*.html,
bin/checkFile.awk,
bin/checkFile.sh,
bin/cmdrunner.sh,
bin/cmdrunner.cmd,
bin/run.sh,
misc/**/*.mf,
misc/Meta.xsl,
workbench/drivers/readme.txt,
workbench/plugins/readme.txt,
workbench/cpappend.bat,
workbench/ivy.xml,
workbench/log4j.xml,
workbench/mondrian.properties,
workbench/readme.txt,
workbench/workbench.bat,
workbench/workbench.sh,
workbench/workbench.command,
build.xml,
build.bat,
build.sh,
build.properties,
ivy.xml,
ivysettings.xml,
log4j.properties,
LICENSE.html,
README.txt,
subfloor.xml,
VERSION.txt,
${demo.dir}/FoodMart.xml"
excludes="
${javadoc.dir}/**,
**/_vti*/*,
**/*~,
**/junit-results/**,
${generated.java.files},
doc/deployDoc.sh" />
<zipfileset
dir="."
includes="mondrian.properties.template"
fullpath="${dist.name}/mondrian.properties" />
<zipfileset
dir="."
prefix="${dist.name}"
filemode="755"
includes="
buildOnJdk.bat,
buildOnJdk.sh" />
</zip>
</target>
<target name="load-foodmart"
depends="info,compile,compile-tests"
description="load the foodmart database from the data file using the Mondrian loader. Assumes empty database exists">
<available classname="${mondrian.jdbcDrivers}"
classpathref="test.classpath" property="driver.present.for.load-foodmart"/>
<echo message="Driver present: ${driver.present.for.load-foodmart}"/>
<!--
Load from demo/FoodMartCreateData.zip directly - no need to unzip
Otherwise override, like
<arg value="-inputFile=demo/myData.sql"/>
<arg value="-inputFile=demo/myData.zip"/> - will access this without unzipping
You can override the JDBC batch size by setting the same
property in your mondrian.properties. Current using the
default of 50 SQL statements per batch.
-->
<property name="mondrian.foodmart.loaderBatchSize" value="50" />
<property name="mondrian.foodmart.jdbcSchema" value="" />
<java classname="mondrian.test.loader.MondrianFoodMartLoader"
classpathref="test.classpath"
fork="yes">
<!--<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787" />-->
<arg value="-tables"/>
<arg value="-data"/>
<arg value="-indexes"/>
<arg value="-jdbcDrivers=${mondrian.jdbcDrivers}"/>
<arg value="-outputJdbcURL=${mondrian.foodmart.jdbcURL}"/>
<arg value="-outputJdbcUser=${mondrian.foodmart.jdbcUser}"/>
<arg value="-outputJdbcPassword=${mondrian.foodmart.jdbcPassword}"/>
<arg value="-outputJdbcSchema=${mondrian.foodmart.jdbcSchema}"/>
<arg value="-outputJdbcBatchSize=${mondrian.foodmart.loaderBatchSize}"/>
</java>
</target>
<target name="binzip"
depends="clean-deep,srczip,jar,javadoc,xml_schema">
<mkdir dir="${dist.dir}" />
<delete file="${dist.bin.file}"/>
<zip zipfile="${dist.bin.file}">
<zipfileset
dir="."
prefix="${dist.name}"
includes="
${doc.dir}/**/*.jpg,
${doc.dir}/**/*.html,
${doc.dir}/**/*.css,
${doc.dir}/**/*.png,
${doc.dir}/api/**/*.xml,
lib/*.dtd,
demo/FoodMart.xml,
demo/FoodMartCreateData.zip,
LICENSE.html,
README.txt,
VERSION.txt"
excludes="
**/*~,
**/_vti*/*,
**/*.psp,
${doc.dir}/api/src-html/**/*"/>
<zipfileset
dir="${dist.dir}"
prefix="${dist.name}"
includes="${dist.name}.jar"/>
<zipfileset
dir="${dist.dir}"
prefix="${dist.name}"
includes="${dist.name}-src.zip"/>
</zip>
</target>
<target name="doczip"
depends="javadoc-with-ydoc, xml_schema"
description="Builds a zipfile of the documentation, which can then be
deployed to sf.net. See also doc/deployDoc.sh.">
<mkdir dir="${dist.dir}" />
<tar
destfile="${dist.doc.file}"
compression="gzip">
<tarfileset
dir="."
includes="
doc/api/**/*,
doc/**/*.html,
doc/**/*.gif,
doc/**/*.jpg,
doc/**/*.png,
doc/**/*.css,
doc/**/*.xml"
excludes="
**/*~,
**/_vti*/*,
**/*.psp,
**/*.sh"/>
</tar>
</target>
<target name="jar" depends="version,compile">
<mkdir dir="${lib.dir}" />
<jar
destfile="${jar.file}"
update="true">
<zipfileset
dir="${classes.dir}"
includes="
**/*.class,
**/*.properties,
**/*.xml,
META-INF/**"
excludes="mondrian/gui/**/*.*"/>
<zipfileset
dir="${testclasses.dir}"
includes="
mondrian/test/loader/**/*.class,
mondrian/olap4j/MondrianInprocProxy*.class,
mondrian/test/AbstractMondrianOlap4jTester.class,
mondrian/test/MondrianOlap4jTester.class"/>
<zipfileset
dir="${javatest.dir}"
includes="
mondrian/test/loader/insert.sql"/>
<zipfileset
dir="."
includes="
LICENSE.html,
README.txt,
VERSION.txt"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<section name="mondrian/olap/">
<attribute name="Implementation-Title" value="${name}"/>
<attribute name="Implementation-Version" value="${project.revision}"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
</section>
<section name="mondrian/server/">
<attribute name="Implementation-Title" value="${name}"/>
<attribute name="Implementation-Version" value="${project.revision}"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
</section>
</manifest>
</jar>
<copy file="${jar.file}"
tofile="${dist.dir}/${ivy.artifact.id}-${project.revision}.jar"/>
</target>
<target name="xml_schema"
description="Generates xml_schema.html from Mondrian.xml">
<xslt in="src/main/mondrian/olap/Mondrian.xml"
out="doc/xml_schema.html"
style="misc/Meta.xsl"/>
</target>
<target name="javadoc-strict" description="
Generates javadoc as part of the nightly regress,
to make sure that all javadoc references are valid.
Javadoc is known to produce errors against JDK 1.4 and 1.5; it runs
clean against JDK 1.6.">
<antcall target="javadoc-internal">
<param name="additionalparam" value=""/>
<param name="access" value="private"/>
</antcall>
</target>
<target name="javadoc" description="Generates javadoc for release">
<antcall target="javadoc-internal">
<param name="additionalparam" value=""/>
<param name="access" value="package"/>
</antcall>
</target>
<target name="javadoc-internal">
<mkdir dir="${javadoc.dir}" />
<delete quiet="true" file="${javadoc.dir}/index.html"/>
<!-- remove stray package.html files under classes to avoid 'multiple
sources of package comments' errors -->
<delete includeEmptyDirs="false" quiet="true">
<fileset dir="${classes.dir}" includes="**/package.html"/>
<fileset dir="${testclasses.dir}" includes="**/package.html"/>
</delete>
<property name="ps" value="${path.separator}"/>
<javadoc
sourcepath="${java.dir}${ps}${javatest.dir}"
maxmemory="1024m"
classpathref="test.classpath"
destdir="${javadoc.dir}"
packagenames="mondrian.*"
overview="${java.dir}/overview.html"
footer="<a href="http://sourceforge.net/projects/mondrian"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=35302&type=15" width="150" height="40" border="0" alt='Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads'></a>"
author="true"
source="${javac.source}"
access="${access}"
Windowtitle="Mondrian OLAP Engine, version ${project.revision}"
additionalparam="${additionalparam}"
>
<tag name="pre" description="Pre-condition:"
scope="constructors,methods"/>
<tag name="post" description="Post-condition:"
scope="constructors,methods"/>
<tag name="testcase" description="Test-case:"
scope="constructors,methods,types"/>
<link href="http://java.sun.com/javase/7/docs/api/"/>
<link href="http://www.olap4j.org/api/"/>
<link href="http://junit.sourceforge.net/javadoc"/>
<link href="http://java.sun.com/products/servlet/2.2/javadoc/"/>
<link href="http://eigenbase.sourceforge.net/resgen/api/"/>
<link href="http://farrago.sourceforge.net/api/"/>
</javadoc>
<copy file="${java.dir}/mondrian/olap/Mondrian.xml"
todir="${javadoc.dir}/mondrian/olap"/>
</target>
<!-- Generate javadoc with embedded UML diagrams using the yDoc doclet from
yWorks.com. Set ydoc.home in build.properties, then replace
${ydoc.home}/resources/ydoc.license with a full license (free for open
source use). -->
<target name="javadoc-with-ydoc"
description="Generates javadoc for public site; verbose: includes
diagrams and hyperlinks to source code">
<mkdir dir="${javadoc.dir}" />
<delete quiet="true" file="${javadoc.dir}/index.html"/>
<!-- remove stray package.html files under classes to avoid 'multiple
sources of package comments' errors -->
<delete includeEmptyDirs="false" quiet="true">
<fileset dir="${classes.dir}" includes="**/package.html"/>
<fileset dir="${testclasses.dir}" includes="**/package.html"/>
</delete>
<property name="ps" value="${path.separator}"/>
<javadoc
sourcepath="${java.dir}"
maxmemory="1024m"
classpathref="test.classpath"
destdir="${javadoc.dir}"
packagenames="mondrian.*"
overview="${java.dir}/overview.html"
footer="<a href="http://sourceforge.net/projects/mondrian"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=35302&type=15" width="150" height="40" border="0" alt='Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads'></a>"
author="true"
source="${javac.source}"
access="package"
Windowtitle="Mondrian OLAP Engine, version ${project.revision}"
additionalparam="-linksource"
>
<tag name="pre" description="Pre-condition:"
scope="constructors,methods"/>
<tag name="post" description="Post-condition:"
scope="constructors,methods"/>
<tag name="testcase" description="Test-case:"