forked from SQLPower/power-architect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1564 lines (1389 loc) · 57.4 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"?>
<!--
Power*Architect Ant build file
-->
<project name="architect" default="dist" basedir=".">
<!-- $Id$ -->
<!-- Optional per-user customization -->
<property file="${user.home}/build.properties" />
<!-- Optional directory customization -->
<property file="build.properties" />
<!-- The directory where the Java source files are -->
<property name="src" value="src/main/java"/>
<!-- The directory where resources are located (images, sounds, etc) -->
<property name="resources" value="src/main/resources"/>
<!-- The directory with all the JAR files that are required
by the Architect at runtime -->
<property name="lib" value="lib"/>
<!-- The directory with all the JAR files that are required
by the Architect at compile time -->
<property name="buildlib" value="buildlib"/>
<!-- The directory with all the JDBC JAR files that are required
by the Architect at test time -->
<property name="jdbclib" value="jdbc_drivers"/>
<!-- The target build directory for compiled classes, docs,
resources, and more. The contents of this dir will eventually
get added to the architect.jar file. -->
<property name="build" value="build"/>
<!-- A target build directory to place a temporary build in to
allow us to generate new files based on the annotations in the
class files. -->
<property name="build_tmp" value="build_tmp"/>
<!-- The location where generated java files will be stored at.-->
<property name="generated" value="generated"/>
<property name="dist.base" value="dist"/>
<property name="dist.latest" value="${dist.base}/latest"/>
<!-- The target build directory for compiled test classes.
The contents of this directory will get excluded form the architect.jar. -->
<property name="build.tests" value="build_tests"/>
<!-- The target build directory for compiled example classes.
The contents of this directory will get excluded form the architect.jar. -->
<property name="build.examples" value="build_examples"/>
<!-- The java compiler to use. See Ant docs for details. -->
<property name="build.compiler" value="modern"/>
<!-- The staging directory is a temp dir that is used as a base for all
the OS-dependant distributions -->
<property name="staging.dir" value="staging" />
<!-- Windows installer tool: izpack (needs both a jar and its own
directory to run properly) -->
<property name="izpack.dir" value="ext-tools-home/izpack"/>
<taskdef name="izpack" classpath="${izpack.dir}/lib/standalone-compiler.jar"
classname="com.izforge.izpack.ant.IzPackTask"/>
<!-- Base directory for the izpack (Windows) installer output -->
<property name="installer.dir" value="installer"/>
<property name="only.copy.sqlpower.library" value="false"/>
<path id="runtime.classpath"
description="All the runtime dependencies of the Architect code">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${sqlpower.library.home}/lib/main">
<include name="*.jar"/>
</fileset>
<pathelement location="${generated}"/>
</path>
<path id="compile.classpath"
description="All the compile dependencies of the Architect">
<path refid="runtime.classpath"/>
<fileset dir="${buildlib}">
<include name="*.jar"/>
</fileset>
</path>
<path id="apt.classpath"
description="All the APT generation dependencies of the Architect">
<path refid="compile.classpath"/>
<pathelement location="${build}"/>
</path>
<path id="test.classpath"
description="All the test-time dependencies of the Architect code,
including the compiles Architect code itself">
<path refid="compile.classpath" />
<pathelement location="${build}"/>
<fileset dir="${jdbclib}">
<include name="*.jar"/>
</fileset>
</path>
<!-- When the build runs on a Mac, we can create the .dmg disk image
using the native hdiutil program. Otherwise, we just make a .tar.gz.
-->
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isNotMac">
<not>
<os family="mac"/>
</not>
</condition>
<!-- When the build runs on Windows, we can create the .exe executable
using the izpack2exe's exe tool. Otherwise, we would use python
along with the python izpack2exe python script.
-->
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isNotWindows">
<not>
<os family="windows"/>
</not>
</condition>
<!--
Actually, I wanted to test for if this is Linux so to know which
launch4j binaries to use, but unfortunately, there is no 'linux'
value, just unix. So if it's unix, then we will try to use the linux binary.
-->
<condition property="isUnix">
<os family="unix"/>
</condition>
<condition property="isNotUnix">
<not>
<os family="unix"/>
</not>
</condition>
<condition property="launch4j.dir" value="ext-tools-home/launch4j/launch4j-macosx" >
<isset property="isMac"/>
</condition>
<condition property="launch4j.dir" value="ext-tools-home/launch4j/launch4j-linux" >
<isset property="isUnix"/>
</condition>
<condition property="launch4j.dir" value="ext-tools-home/launch4j/launch4j-win32" >
<isset property="isWindows"/>
</condition>
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar
:${launch4j.dir}/lib/xstream.jar" />
<!-- OS X .app bundling tool: appbundler -->
<taskdef name="bundleapp"
classpath="osx_packaging_utils/appbundler-1.0ea.jar"
classname="com.oracle.appbundler.AppBundlerTask"/>
<!-- findbugs code checking tool -->
<property name="findbugs.home" value="ext-tools-home/findbugs"/>
<property name="findbugs-ant.jar" value="${findbugs.home}/lib/findbugs-ant.jar"/>
<!-- pmd code checking tool and its helper jar files -->
<property name="pmd.home" value="ext-tools-home/pmd"/>
<property name="pmd.jar" value="${pmd.home}/lib/pmd-4.2.jar"/>
<!-- clover test coverage tool -->
<property name="clover.home" value="ext-tools-home/clover"/>
<taskdef resource="cloverlib.xml" classpath="${clover.home}/clover.jar"/>
<!--
Sets if we want to actually run a build on the SQL Power Library.
It may be useful to set it to copy only if we already know that the
library has been built. For example, when running the builds on a
continuous integration engine like Hudson, where the library can be
built separately.
-->
<condition property="buildSQLPowerLibrary">
<isfalse value="${only.copy.sqlpower.library}"/>
</condition>
<!--
Set the format of the findbugs report to html by default
-->
<condition property="findbugs.report.format" value="xml">
<not>
<isset property="findbugs.report.format"/>
</not>
</condition>
<!--
Set the format of the pmd report to html by default
-->
<condition property="pmd.report.format" value="xml">
<not>
<isset property="pmd.report.format"/>
</not>
</condition>
<!--
Set the format of the clover report to html by default
-->
<condition property="clover.report.format" value="xml">
<not>
<isset property="clover.report.format"/>
</not>
</condition>
<target name="init" depends="checkAntVersion, copy.sqlpower.library"
description="Checks build prereqs, creates output dir, and determines product version"
>
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${build_tmp}"/>
<!-- get the version number from source code ArchitectUtils -->
<javac srcdir="${src}" destdir="${build}" classpathref="compile.classpath" includes="ca/sqlpower/architect/antbuild/ArchitectVersionTask.java" debug="true"/>
<taskdef name="genVersion"
classname="ca.sqlpower.architect.antbuild.ArchitectVersionTask"
classpath="${build}"/>
<genVersion/>
<tstamp>
<format property="date" pattern="yyyyMMddHHmmss"/>
</tstamp>
<!-- If the nightly build property is set, then version number uses the date as the suffix
Would be REALLY nice if Ant conditions support setting multiple properties, but doesn't as of 1.7.0 -->
<condition property="app.ver.suffix" value="-${date}">
<isset property="nightly"/>
</condition>
<!-- Else, if app_ver_suffix is empty, then don't use a suffix -->
<condition property="app.ver.suffix" value="">
<and>
<equals arg1="${app_ver_suffix}" arg2=""/>
<not><isset property="app.ver.suffix"/></not>
</and>
</condition>
<!-- otherwise, use the normal app_ver_suffix as the suffix -->
<condition property="app.ver.suffix" value="-${app_ver_suffix}">
<not><isset property="app.ver.suffix"/></not>
</condition>
<property name="app.version" value="${app_ver_major}.${app_ver_minor}.${app_ver_tiny}${app.ver.suffix}"/>
<property name="dist.dir" value="${dist.base}/architect-${app.version}"/>
<condition property="downloadLinkBase" value="http://nightlybuild.sqlpower.ca/architect/nightly/${app.version}">
<isset property="nightly"/>
</condition>
<condition property="docLinkBase" value="${downloadLinkBase}">
<isset property="nightly"/>
</condition>
<condition property="downloadLinkBase"
value="http://power-architect.googlecode.com/files">
<not><isset property="downloadLinkBase"/></not>
</condition>
<condition property="docLinkBase"
value="http://download.sqlpower.ca/architect/${app.version}">
<not><isset property="docLinkBase"/></not>
</condition>
<echo message="Building Architect version: ${app.version}"/>
<mkdir dir="${dist.dir}"/>
<!-- The directory where junit HTML reports are generated.
Other report files could eventually be placed here too. -->
<property name="reports" value="${dist.dir}/reports"/>
<mkdir dir="${reports}"/>
</target>
<target name="alltests" depends="junit,pmd,findbugs"
description="Runs all testing and checking targets"
/>
<!-- A target to configure the Clover environment. This
needs to be executed if any Clover features are to
be used.
To setup Clover:
1) Download "Clover for Ant" from Cenqua at
http://www.cenqua.com/download.jspa
2) Extract Clover to any directory you wish
(NOTE: There is a directory set aside for Clover:
ext-tools-home/clover)
3) Obtain a license file from Cenqua and
place it in the (CLOVER_HOME)/lib
directory with the clover.jar file
4) Add the clover.jar file to the classpath
for the ant build
To generate an HTML report, run the clover.report
target.
Reports are sent to the reports directory, but you can
choose your own directory by changing the 'outfile'
attribute of the 'current' tag in the clover.report
target.-->
<target name="with.clover" description="Activates Clover">
<clover-setup initString="mycoverage.db" source="1.6"
flushpolicy="threaded" flushinterval="500">
<!-- This fileset includes all source files that are not
tests because we do not want to see the coverage results
of files in the test suite. -->
<fileset dir="${src}" casesensitive="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</clover-setup>
</target>
<target name="clover.test.and.report" depends="with.clover, clover.junit, clover.report"
description="A simple target to initialize Clover, run the test suite
and generate an HTML report">
</target>
<!-- A target to run the junit tests with clover report
generation enabled -->
<target name="clover.junit" depends="with.clover,junit"
description="Run the tests with Clover report generation">
</target>
<!-- A target that generates a Clover report in html
format.
Note: The test suite must be run with clover
enabled BEFORE this is run. They CANNOT be run in the
same Ant session.
Also, the ouput directory is specified by the value of
the outfile attribute
-->
<target name="clover.report" depends="init, with.clover"
description="Generates coverage report based on previous
Clover-enabled test run (clover.junit)"
>
<mkdir dir="${reports}/clover"/>
<condition property="clover.report.outfile" value="${reports}/clover" else="${reports}/clover/clover.${clover.report.format}">
<equals arg1="${clover.report.format}" arg2="html"/>
</condition>
<clover-report>
<current outfile="${clover.report.outfile}">
<format type="${clover.report.format}"/>
<fileset dir="${src}" casesensitive="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</current>
</clover-report>
</target>
<target name="pmd" depends="init"
description="Runs the PMD code checking tool, saving results to a file."
>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"
classpath="${pmd.jar}"/>
<property name="pmd-results" value="${reports}/pmd-ant-results.${pmd.report.format}"/>
<pmd shortFilenames="true" targetjdk="1.7">
<ruleset>basic,imports</ruleset>
<formatter type="${pmd.report.format}" toFile="${pmd-results}"/>
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</pmd>
<echo message="PMD completed, output is in ${pmd-results}."/>
</target>
<target name="pmd-cpd" depends="init"
description="Runs the PMD Copy/Paste Detection tool, and saves results to a file">
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask"
classpath="${pmd.jar}"/>
<property name="cpd-results" value="${reports}/cpd-ant-results.xml"/>
<cpd encoding="UTF-8" minimumTokenCount="120" format="xml" outputfile="${cpd-results}">
<fileset dir="${src}">
<include name="**/*.java"/>
<exclude name="generated/**.java"/>
</fileset>
</cpd>
<xslt in="${cpd-results}" style="${pmd.home}/etc/xslt/cpdhtml.xslt" out="${reports}/cpd-ant-results.html" />
<echo message="CPD completed, output is in ${reports}/cpd-ant-results.html."/>
</target>
<target name="findbugs"
description="Runs the FindBugs tool, outputs results to a text file"
depends="compile">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs-ant.jar}"/>
<findbugs home="${findbugs.home}"
output="${findbugs.report.format}"
outputFile="${reports}/findbugs-ant-results.${findbugs.report.format}"
reportLevel="low"
jvmargs="-Xmx512m"> <!-- FindBugs can use up a lot of memory, so adjust the JVM memory here-->
<class location="${build}" />
<sourcePath path="${src}" />
<!-- Classes needed by our code but that we don't want tested -->
<auxClasspath path="${pmd.jar}" />
<systemProperty name="findbugs.maskedfields.locals" value='true'/>
</findbugs>
</target>
<!-- Runs the Business and Auto test suites. The Swing UI test suite is
not run because it fails randomly -->
<target name="junit" depends="compile-tests">
<property name="reports.junit" value="${reports}/junit"/>
<mkdir dir="${reports.junit}"/>
<!-- Output all System.out and System.err messages -->
<junit printsummary="on" showoutput="no">
<sysproperty key="ca.sqlpower.architect.test.dir" value="${build.tests}"/>
<sysproperty key="ca.sqlpower.headless" value="true"/>
<classpath>
<path refid="test.classpath"/>
<path path="${build.tests}"/>
</classpath>
<test name="ca.sqlpower.ArchitectBusinessTestSuite" todir="${reports.junit}"/>
<test name="ca.sqlpower.ArchitectSwingTestSuite" todir="${reports.junit}"/>
<test name="ca.sqlpower.ArchitectAutoTests" todir="${reports.junit}"/>
<test name="ca.sqlpower.architect.profile.ProfileTests" todir="${reports.junit}"/>
<formatter type="xml"/>
</junit>
<!-- Generate HTML report -->
<junitreport todir="${reports.junit}">
<fileset dir="${reports.junit}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${reports.junit}" />
</junitreport>
<copy todir="${dist.latest}/reports/junit">
<fileset dir="${reports.junit}"/>
</copy>
</target>
<!-- Compiles the application source files -->
<target name="compile" depends="init, copyfiles, build.sqlpower.library, copy.sqlpower.library">
<javac srcdir="${src}" destdir="${build}" classpathref="compile.classpath" debug="true"/>
<apt srcdir="${src}"
destdir="${build_tmp}"
classpathref="apt.classpath"
debug="true"
compile="true"
factory="ca.sqlpower.object.annotation.SPAnnotationProcessorFactory"
preprocessdir="${generated}">
</apt>
<delete dir="${build}"/>
<move todir="${build}">
<fileset dir="${build_tmp}"/>
</move>
<copy todir="${build}" flatten="false">
<fileset dir="${resources}">
<include name="**/*"/>
</fileset>
</copy>
</target>
<target name="compile-tests" depends="compile"
description="Compiles the regression test suite">
<mkdir dir="${build.tests}"/>
<javac srcdir="regress" destdir="${build.tests}"
classpathref="test.classpath"
debug="true"/>
</target>
<!-- This target is run as part of the CI build in order to validate the example code -->
<target name="compile-examples" depends="compile"
description="Compiles the example code that demonstrates use of the API">
<mkdir dir="${build.examples}"/>
<javac srcdir="example_code" destdir="${build.examples}"
classpathref="test.classpath"
debug="true"/>
</target>
<target name="copyfiles" depends="init, architect.version.properties"
description="Copies non-source files that need to be in the architect.jar">
<copy todir="${build}">
<fileset dir="${resources}/">
<include name="**"/>
<exclude name="**/*.java"/>
<exclude name="**/*.html"/>
<exclude name="**/*.class"/>
<exclude name="**/*.example"/>
<exclude name="**/Makefile"/>
</fileset>
</copy>
<copy file="${dist.dir}/architect.version.properties" todir="${build}/ca/sqlpower/architect"/>
<!-- copies the template log4j config file into the build dir -->
<copy overwrite="no" tofile="${build}/log4j.properties"
file="${resources}/log4j.properties.example"/>
</target>
<!-- This target is used to make an architect library jar to embed
in other applications. The DomainCategory.class is there to satisfy a dependency
in SnapshotCollection.class -->
<target name="library.jar" depends="compile">
<jar jarfile="dist/architect-core-${app.version}.jar" basedir="${build}"
includes="ca/sqlpower/architect/*.class,
ca/sqlpower/architect/enterprise/DomainCategory.class,
ca/sqlpower/architect/ddl/*.class,
ca/sqlpower/architect/diff/*.class,
ca/sqlpower/architect/profile/**/*.class,
ca/sqlpower/architect/*.properties">
</jar>
</target>
<!-- This target is used to make a dbtree library jar to embed
in other applications (the dbtree library depends on the architect library) -->
<target name="dbtree_library.jar" depends="library.jar">
<!-- TODO a manifest with author, version, and license info in it -->
<jar jarfile="${build}/architect_dbtree_lib.jar" basedir="${build}"
includes="ca/sqlpower/architect/swingui/dbtree/**,
icons/**">
</jar>
<copyfile
dest="${dist.base}/architect-dbtree-${app.version}.jar"
src="${build}/architect_dbtree_lib.jar"/>
</target>
<!-- DOCUMENTATION
There are THREE main documentation targets, all built from the
docbook XML file docs/PowerArchitectUsersGuide:
help - JavaHelp (jarred and shipped)
html - for quick viewing on our web site
PDF - because we can :-)
-->
<!-- NOTE: All XSLT steps currently require xalan on classpath since JDK1.5 is behind -->
<path id="docbookclasspath">
<fileset dir="doc/tools/xalan">
<include name="*.jar"/>
</fileset>
</path>
<target name="userguide" depends="help,pdf" description="Creates user guide in HTML and PDF">
</target>
<!-- Create an intermediate docbook document - for use both by help and html -
with no width attributes on the images (the Swing HTML browser chokes
when there is width but no height in an image tag)
-->
<target name="xslt-stripwidths">
<xslt
style="doc/tools/strip-width.xsl"
in="doc/PowerArchitectUserGuide.xml"
out="${java.io.tmpdir}/PowerArchitectUserGuide-nowidth.xml"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build MondrianModel -->
<target name="mondrianModel">
<delete file="${src}/ca/sqlpower/architect/olap/MondrianModel.java"></delete>
<xslt
style="${src}/ca/sqlpower/architect/olap/xml-to-java-classes.xsl"
in="${src}/ca/sqlpower/architect/olap/Mondrian.xml"
out="${src}/ca/sqlpower/architect/olap/MondrianModel.java"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build MondrianNewValueMaker -->
<target name="mondrianNewValueMaker">
<delete file="regress/ca/sqlpower/architect/util/MondrianNewValueMaker.java"></delete>
<xslt
style="${src}/ca/sqlpower/architect/olap/xml-to-new-value-maker.xsl"
in="${src}/ca/sqlpower/architect/olap/Mondrian.xml"
out="regress/ca/sqlpower/architect/util/MondrianNewValueMaker.java"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build Mondrian persistence tests -->
<target name="mondrianPersistenceTests">
<delete file="regress/ca/sqlpower/architect/olap/MondrianModelTest.java"></delete>
<xslt
style="${src}/ca/sqlpower/architect/olap/xml-to-persister-tests.xsl"
in="${src}/ca/sqlpower/architect/olap/Mondrian.xml"
out="regress/ca/sqlpower/architect/olap/MondrianModelTest.java"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build MondrianXMLReader -->
<target name="mondrianParser">
<delete file="${src}/ca/sqlpower/architect/olap/MondrianXMLReader.java"></delete>
<xslt
style="${src}/ca/sqlpower/architect/olap/xml-to-parser.xsl"
in="${src}/ca/sqlpower/architect/olap/Mondrian.xml"
out="${src}/ca/sqlpower/architect/olap/MondrianXMLReader.java"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build MondrianXMLWriter -->
<target name="mondrianFormatter">
<delete file="${src}/ca/sqlpower/architect/olap/MondrianXMLWriter.java"></delete>
<xslt
style="${src}/ca/sqlpower/architect/olap/xml-to-formatter.xsl"
in="${src}/ca/sqlpower/architect/olap/Mondrian.xml"
out="${src}/ca/sqlpower/architect/olap/MondrianXMLWriter.java"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Build the Help (JavaHelp, HTML-based format).
** Note that at this time you must NOT have spaces in your
** path (e.g., an Eclipse Workspace under "Documents and Settings"
** will fail out because it changes spaces in filenames to %20.
-->
<target name="help" depends="xslt-stripwidths" description="Create JavaHelp">
<mkdir dir="${build}/help"/>
<!-- This XSLT element is what's causing the problem with the
directories with spaces not working. It outputs the results
to a new directory with spaces replaced with '%20'-->
<xslt
style="doc/tools/xslt/javahelp/javahelp.xsl"
in="${java.io.tmpdir}/PowerArchitectUserGuide-nowidth.xml"
out="${build}/help/zzz"
classpathref="docbookclasspath">
</xslt>
<!-- Index it I: limited-terms index: created manually, just copy it,
*** overwriting empty one that DocBook Javahelp made.
-->
<copy file="doc/jhelpidx.xml" todir="${build}/help" overwrite="true"/>
<!-- Index it II: full text search -->
<!-- DO NOT USE as it seems to have a built-in assumption
*** that the help is all in one file.
<java classname="com.sun.java.help.search.Indexer"
classpath="lib/jhall.jar"
fork="true" failonerror="true">
<arg value="${build}/help"/>
</java>
<mkdir dir="${build}/help/JavaHelpSearch"/>
<move todir="${build}/help/JavaHelpSearch">
<fileset dir="JavaHelpSearch" includes="**"/>
</move>
-->
<!-- So, remove the search view from the JavaHelp config -->
<replace file="${build}/help/jhelpset.hs" value="">
<replacetoken><![CDATA[<view><name>Search</name><label>Search</label><type>javax.help.SearchView</type><data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data></view>]]></replacetoken>
</replace>
<!-- Add the Favorites/Bookmarks views into the JavaHelp Config -->
<replace file="${build}/help/jhelpset.hs"
token="jhelpidx.xml</data></view></helpset>"
value="jhelpidx.xml</data></view><view><name>favorites</name><label>Favorites</label><type>javax.help.FavoritesView</type></view></helpset>"/>
<!-- Copy the images and icons; the DocBook files have
these horrid "src/" and "doc/" paths prepended
so we have to preserve these here -->
<mkdir dir="${build}/help/doc/images"/>
<copy todir="${build}/help/doc/images" overwrite="true">
<fileset dir="doc/images">
<include name="*.png"/>
</fileset>
</copy>
<mkdir dir="${build}/help/${resources}/icons"/>
<copy todir="${build}/help/${resources}/icons" overwrite="true">
<fileset dir="${resources}/icons">
<include name="*.gif"/>
<include name="*.png"/>
</fileset>
</copy>
<!-- Jar the whole mess up and add to working classpath -->
<jar file="${build}/architecthelp.jar" basedir="${build}/help" update="false">
</jar>
</target>
<!-- Build the HTML -->
<target name="html" depends="xslt-stripwidths" description="Create user guide in HTML">
<mkdir dir="${build}/ca/sqlpower/architect/doc/" />
<xslt
style="doc/tools/xslt/html/docbook.xsl"
in="${java.io.tmpdir}/PowerArchitectUserGuide-nowidth.xml"
out="${build}/ca/sqlpower/architect/doc/PowerArchitectUserGuide.html"
classpathref="docbookclasspath">
</xslt>
<!-- Warning: This is an extremely evil hack to get the product out the door!
See bugzilla 1195 for details -->
<mkdir dir="${build}/ca/sqlpower/architect/doc/doc/images" />
<copy todir="${build}/ca/sqlpower/architect/doc/doc/images" overwrite="true">
<fileset dir="doc/images">
<include name="*.png"/>
</fileset>
</copy>
<mkdir dir="${build}/ca/sqlpower/architect/doc/${resources}/icons" />
<copy todir="${build}/ca/sqlpower/architect/doc/${resources}/icons" overwrite="true">
<fileset dir="${resources}/icons">
<include name="*.gif"/>
<include name="*.png"/>
</fileset>
</copy>
</target>
<!-- Convert User Manual from XML to FO -->
<target name="fo" depends="init" description="Create user guide in XML Formatting Objects">
<mkdir dir="${build}/doc/" />
<xslt
style="doc/tools/xslt/fo/docbook.xsl"
in="doc/PowerArchitectUserGuide.xml"
out="${build}/doc/PowerArchitectUserGuide-${app.version}.fo"
classpathref="docbookclasspath">
</xslt>
</target>
<!-- Finish it, from FO to PDF -->
<target name="pdf" depends="fo" description="Create user guide in PDF">
<path id="fop-classpath">
<fileset dir="doc/tools/xalan">
<include name="*.jar"/>
</fileset>
<fileset dir="doc/tools/fop">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="fop-classpath"/>
<fop format="application/pdf" messagelevel="verbose" relativebase="true" >
<fileset dir="${build}/doc/">
<include name="*.fo"/>
</fileset>
</fop>
</target>
<!-- Creates a WebStart distribution under the webstart/ directory -->
<target name="webstart_dist" depends="stage">
<mkdir dir="webstart/lib"/>
<jar destfile="webstart/lib/architect.jar" update="no"
basedir="${build}" includes="ca/** icons/** log4j.properties"
manifest="${build}/manifest">
</jar>
<copy todir="webstart/">
<fileset dir="lib" includes="*.jar"/>
</copy>
</target>
<target name ="jar" depends="compile, compile-tests, build.manifest" description="Builds the embedable JAR">
<jar jarfile="dist/architect.jar" basedir="${build}" manifest="${build}/manifest"/>
<jar jarfile="dist/architect-tests.jar" basedir="${build.tests}" manifest="${build}/manifest"/>
</target>
<target name="build.stage" depends="">
<mkdir dir="${dist.dir}" />
<mkdir dir="${staging.dir}"/>
<mkdir dir="${staging.dir}/lib"/>
<mkdir dir="${staging.dir}/jdbc"/>
<mkdir dir="${staging.dir}/doc"/>
<copy todir="${staging.dir}/lib">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${buildlib}">
<include name="sqlpower_library.jar"/>
</fileset>
<fileset dir="${sqlpower.library.home}/lib/main">
<include name="*.jar"/>
</fileset>
<fileset dir="${build}" includes="architecthelp.jar" />
</copy>
</target>
<target name="build.manifest" depends="build.stage">
<!-- This is an Ant 1.7 feature. To upgrade if using Eclipse 3.x,
1. Download the latest Ant from http://ant.apache.org/bindownload.cgi
2. Extract it somewhere
3. Under window, preferences select Ant runtime in the tree
4. Set the Ant home to be the folder that Ant was extracted to -->
<manifestclasspath property="architect.jar.classpath"
jarfile="${staging.dir}/architect.jar">
<classpath>
<pathelement path="${staging.dir}/jdbc"/>
<fileset dir="${staging.dir}/">
<include name="lib/*.jar"/>
</fileset>
</classpath>
</manifestclasspath>
<manifest file="${build}/manifest">
<attribute name="Main-Class" value="ca.sqlpower.architect.swingui.ArchitectFrame"/>
<attribute name="Class-Path" value="${architect.jar.classpath}" />
</manifest>
</target>
<target name="stage" depends="checkAntVersion,compile,build.manifest">
<jar destfile="${staging.dir}/architect.jar" update="no"
basedir="${build}"
includes="ca/** icons/** sounds/** xsltStylesheets/** log4j.properties default_database_types.ini"
manifest="${build}/manifest">
</jar>
<launch4j>
<config dontwrapjar="true"
headertype="gui"
jarpath="architect.jar"
outfile="${staging.dir}/architect.exe"
errtitle="Java Runtime Required"
priority="normal"
downloadurl="http://java.com/download"
supporturl="http://www.sqlpower.ca/forum"
stayalive="false"
icon="${resources}/icons/architect.ico">
<jre minVersion="1.7.0"
maxHeapSize="600"
/>
</config>
</launch4j>
<launch4j>
<config dontwrapjar="true"
headertype="gui"
jarpath="uninstaller.jar"
outfile="${staging.dir}/uninstaller.exe"
errtitle="Java Runtime Required"
priority="normal"
downloadurl="http://java.com/download"
supporturl="http://www.sqlpower.ca/forum"
stayalive="false"
icon="installer/uninstall.ico">
<singleInstance
mutexName="SQL Power Architect Uninstaller"
windowTitle="SQL Power Architect Uninstaller"
/>
<jre minVersion="1.7.0"/>
</config>
</launch4j>
<copy todir="${staging.dir}/jdbc">
<fileset dir="jdbc_drivers" includes="*.jar"/>
<fileset dir="${src}" includes="default_database_types.ini"/>
</copy>
<copy todir="${staging.dir}/doc" file="doc/ReleaseNotes.txt"/>
<copy todir="${staging.dir}" file="LICENSE"/>
<copy todir="${staging.dir}">
<fileset dir="${sqlpower.certificate}" includes="*.*"/>
</copy>
<!-- No point in signing until we have a certificate that's signed by a CA
<signjar alias="sqlpower" keystore="keystore" storepass="low_security" keypass="low_security">
<fileset dir="webstart/lib"/>
</signjar>
-->
</target>
<target name="run"
description="Runs the Architect application with the Swing UI"
depends="compile">
<java fork="true" classname="ca.sqlpower.architect.swingui.ArchitectFrame" classpathref="test.classpath">
<jvmarg value="-Dlog4j.configuration=log4j.properties"/>
</java>
</target>
<target description="Cleans all build files" name="clean">
<delete dir="${build}" failonerror="false" includeemptydirs="true"/>
<delete dir="${build.tests}" failonerror="false" includeemptydirs="true"/>
<delete dir="${build.examples}" failonerror="false" includeemptydirs="true"/>
<delete>
<fileset dir="buildlib">
<include name="sqlpower_library*.jar"/>
</fileset>
</delete>
<delete failonerror="false">
<fileset dir="${dist.dir}" includes="lib,SQL Power Architect.app,architect.jar"/>
</delete>
<delete dir="webstart/lib" failonerror="false"/>
<delete dir="${staging.dir}" failonerror="false"/>
<delete dir="${generated}/ca" failonerror="false"/>
<delete failonerror="false"><fileset dir="." includes="mycoverage.db*"/></delete>
</target>
<target name="dist-clean" depends="clean">
<delete dir="${dist.base}" />
</target>
<target name="javadoc"
description="Generate the Javadoc documentation for the Architect API in the dist directory"
depends="compile">
<mkdir dir="${dist.dir}/doc/api"/>
<echo message="NOTE: If the javadoc command is not accessible from your PATH variable, then this target WILL fail."/>
<javadoc sourcepath="${src}" destdir="${dist.dir}/doc/api"
packagenames="ca.sqlpower.*"
maxmemory="100m"
windowtitle="ca.sqlpower.architect.* SQL Power Architect"
Version="true" Author="true" Use="true"
Overview="html/overview.html"
classpathref="test.classpath"
access="private"
>
<packageset dir="${src}" defaultexcludes="yes">
<include name="ca/sqlpower/**" />
<exclude name="regress/**"/>
</packageset>
<bottom><![CDATA[<i>Copyright © 2003-2016 SQL Power Group Inc. <a href="http://www.sqlpower.ca/">www.sqlpower.ca</a>]]></bottom>
</javadoc>
</target>
<target name="javadoc.with.umlgraph"
description="Generate the Javadoc documentation for the Architect API along with UML diagrams generated using UMLGraph"
depends="compile">
<mkdir dir="${dist.dir}/doc/api"/>
<echo message="NOTE: If the javadoc command is not accessible from your PATH variable, then this target WILL fail."/>
<javadoc sourcepath="${src}" destdir="${dist.dir}/doc/api"
packagenames="ca.sqlpower.*"
maxmemory="100m"
windowtitle="ca.sqlpower.architect.* SQL Power Architect"
Version="true" Author="true" Use="true"
Overview="html/overview.html"
classpathref="test.classpath"
>
<doclet name="gr.spinellis.umlgraph.doclet.UmlGraphDoc"
path="buildlib/UmlGraph.jar">
<param name="-attributes" />
<param name="-operations" />
<param name="-qualify" />
<param name="-types" />
<param name="-visibility" />
</doclet>
<packageset dir="${src}" defaultexcludes="yes">
<include name="ca/sqlpower/**" />
<exclude name="regress/**"/>
</packageset>
<bottom><![CDATA[<i>Copyright © 2003-2016 SQL Power Group Inc. <a href="http://www.sqlpower.ca/">www.sqlpower.ca</a>]]></bottom>
</javadoc>
<apply executable="dot" dest="${dist.dir}/doc" parallel="false">
<arg value="-Tpng"/>
<arg value="-o"/>
<targetfile/>
<srcfile/>
<fileset dir="${dist.dir}/doc" includes="*.dot"/>
<mapper type="glob" from="*.dot" to="*.png"/>
</apply>
</target>
<target name="windows_installer" depends="stage">
<izpack output="${dist.dir}/SQL-Power-Architect-Setup-Windows-${app.version}.jar"
installerType="standard"
basedir="${installer.dir}"
izPackDir="${izpack.dir}/">
<config><![CDATA[
<installation version="1.0">
<!-- comment -->
<info>
<appname>SQL Power Architect</appname>
<appversion>@{app.version}</appversion>
<url>http://www.sqlpower.ca/</url>
<javaversion>1.7</javaversion>
<!-- Need to figure how to pass options to the izpack pack200 compression feature -->
<!-- <pack200/> -->
</info>
<guiprefs height="600" resizable="yes" width="800">
<laf name="metouia">
<os family="unix"/>
</laf>
</guiprefs>
<locale>
<langpack iso3="eng"/>
</locale>
<resources>
<res id="Installer.image" src="../src/main/resources/icons/architect.png"/>