-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
1085 lines (962 loc) · 37.5 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
<project name="matchmaker" default="dist" basedir=".">
<!-- $Id$ -->
<!-- get the version number from source code MatchMakerUtils -->
<property file="build.properties"/>
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="build_tmp" value="build_tmp"/>
<property name="build.tests" value="${build}"/>
<property name="lib" value="lib"/>
<property name="buildlib" value="buildlib"/>
<property name="generated" value="generated"/>
<property name="resources" value="src"/>
<property name="src.apt" value="src/apt/java"/>
<!-- 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"/>
<property name="dist.base" value="dist"/>
<!-- Windows installer tool: izpack (needs both a jar and its own
directory to run properly) -->
<property name="izpack.dir" value="ext-tools/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"/>
<!-- findbugs code checking tool -->
<property name="findbugs.home" value="ext-tools/findbugs"/>
<property name="findbugs-ant.jar" value="${findbugs.home}/lib/findbugs-ant.jar"/>
<!-- 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/launch4j/launch4j-macosx" >
<isset property="isMac"/>
</condition>
<condition property="launch4j.dir" value="ext-tools/launch4j/launch4j-linux" >
<isset property="isUnix"/>
</condition>
<condition property="launch4j.dir" value="ext-tools/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" />
<!--
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">
<not>
<isset property="only.copy.sqlpower.library"/>
</not>
</condition>
<!--
Set the format of the findbugs report to html by default
-->
<condition property="findbugs.report.format" value="html">
<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="html">
<not>
<isset property="pmd.report.format"/>
</not>
</condition>
<!-- A path that will include all jars in the lib and buildlib folders -->
<path id="compile.classpath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<fileset dir="${buildlib}">
<include name="*.jar"/>
</fileset>
<path refid="runtime.classpath"/>
</path>
<path id="runtime.classpath"
description="All the runtime dependencies of the MatchMaker 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="test.classpath">
<pathelement location="${build}"/>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<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}"/>
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<!-- Compiles the MatchMaker src and places the .class files into build and creates
the generated classes needed for the persistence layer-->
<target name="compile" depends="clean, build.sqlpower.library, copy.sqlpower.library, copyfiles">
<mkdir dir="${build}"/>
<mkdir dir="${build_tmp}"/>
<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="icons/**/*"/>
<include name="ca/sqlpower/matchmaker/swingui/munge/munge_component.properties"/>
</fileset>
</copy>
</target>
<!-- Compiles the MatchMaker and places the .class files into build-->
<target name="javadoc" depends="getAppVersion,compile">
<mkdir dir="${dist.base}/doc/api"/>
<javadoc sourcepath="${src}" destdir="${dist.base}/doc/api"
packagenames="ca.sqlpower.*"
maxmemory="100m"
windowtitle="ca.sqlpower.matchmaker.* Power*MatchMaker"
Version="true" Author="true" Use="true"
classpathref="test.classpath"
>
<packageset dir="${src}" defaultexcludes="yes">
<include name="ca/sqlpower/**" />
<exclude name="regress/**"/>
</packageset>
<bottom><![CDATA[<i>Copyright © 2003-2008 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 MatchMaker API along with UML diagrams generated using UMLGraph"
depends="getAppVersion, compile">
<mkdir dir="${dist.base}/doc/api"/>
<javadoc sourcepath="${src}" destdir="${dist.base}/doc/api"
packagenames="ca.sqlpower.*"
maxmemory="100m"
windowtitle="ca.sqlpower.matchmaker.* Power*MatchMaker"
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-2008 SQL Power Group Inc. <a href="http://www.sqlpower.ca/">www.sqlpower.ca</a>]]></bottom>
</javadoc>
<apply executable="dot" dest="${dist.base}/doc" parallel="false">
<arg value="-Tpng"/>
<arg value="-o"/>
<targetfile/>
<srcfile/>
<fileset dir="${dist.base}/doc" includes="*.dot"/>
<mapper type="glob" from="*.dot" to="*.png"/>
</apply>
</target>
<target name="copyfiles" depends="matchmaker.version.properties">
<mkdir dir="${build}/icons"/>
<copy todir="${build}/icons">
<fileset dir="src/icons/">
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.icns"/>
</fileset>
</copy>
<copy todir="${build}/ca/sqlpower/matchmaker/dao/hibernate">
<fileset dir="src/ca/sqlpower/matchmaker/dao/hibernate">
<include name="*.xml"/>
<include name="*.sql"/>
<include name="*.architect"/>
</fileset>
</copy>
<copy todir="${build}/ca/sqlpower/matchmaker/address">
<fileset dir="src/ca/sqlpower/matchmaker/address">
<include name="*.property"/>
</fileset>
</copy>
<copy file="${dist.base}/matchmaker.version.properties" todir="${build}/ca/sqlpower/matchmaker"/>
<!-- copies the template log4j config file into the build dir -->
<copy tofile="${build}/log4j.properties"
file="src/log4j.properties.example"/>
<copy tofile="${build}/ca/sqlpower/matchmaker/swingui/munge/munge_components.properties"
file="src/ca/sqlpower/matchmaker/swingui/munge/munge_components.properties"/>
</target>
<!-- Compiles the regression test suite -->
<target name="compile-tests" depends="compile">
<mkdir dir="${build.tests}"/>
<javac srcdir="regress" destdir="${build.tests}"
classpathref="test.classpath"
debug="true"/>
</target>
<!-- Creates distributables for all supported OSes -->
<target name="dist" depends="junit, pmd, pmd-cpd, findbugs, userguide, javadoc, osx_tgz,osx_dmg,windows_exe_installer_launch4j,generic_install,source_only_tgz">
<echo>Don't forget to turn off all the debugging in log4j.properties!</echo>
<mkdir dir="${dist.base}/doc"/>
<copy todir="${dist.base}/doc" overwrite="true">
<fileset dir="${staging.dir}/doc">
<include name="*.txt"/>
</fileset>
</copy>
<copy todir="${dist.base}" overwrite="true">
<fileset dir="${staging.dir}/doc">
<include name="*-${app.version}.pdf"/>
</fileset>
</copy>
<echo>Did you forget to turn off all the debugging in log4j.properties?!</echo>
</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/DQguruUserGuide.xml"
out="${java.io.tmpdir}/DQguruUserGuide-nowidth.xml"
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="checkBuildPath, 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}/DQguruUserGuide-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/src/icons"/>
<copy todir="${build}/help/src/icons" overwrite="true">
<fileset dir="src/icons">
<include name="*.gif"/>
<include name="*.png"/>
</fileset>
</copy>
<!-- Jar the whole mess up and add to working classpath -->
<jar file="${build}/dqguruhelp.jar" basedir="${build}/help" update="false">
</jar>
</target>
<!-- Build the HTML -->
<target name="html" depends="checkBuildPath, xslt-stripwidths" description="Create user guide in HTML">
<mkdir dir="${build}/doc/html" />
<xslt
style="doc/tools/xslt/html/docbook.xsl"
in="${java.io.tmpdir}/DQguruUserGuide-nowidth.xml"
out="${build}/doc/html/DQguruUserGuide.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/matchmaker/doc/doc/images" />
<copy todir="${build}/doc/html/doc/images" overwrite="true">
<fileset dir="doc/images">
<include name="*.png"/>
</fileset>
</copy>
</target>
<!-- Convert User Manual from XML to FO -->
<!-- USED to depend on init in architect, not sure if it is needed -->
<target name="fo" depends="getAppVersion" description="Create user guide in XML Formatting Objects">
<mkdir dir="${build}/doc/" />
<xslt
style="doc/tools/xslt/fo/docbook.xsl"
in="doc/DQguruUserGuide.xml"
out="${build}/doc/DQguruUserGuide-${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>
<!-- Runs the test suite -->
<target name="junit" depends="getAppVersion, compile-tests">
<mkdir dir="${reports}"/>
<property name="reports.junit" value="${reports}/junit"/>
<mkdir dir="${reports.junit}"/>
<!-- Output all System.out and System.err messages -->
<junit printsummary="on" maxmemory="512m">
<sysproperty key="ca.sqlpower.matchmaker.test.dir" value="${build.tests}"/>
<classpath>
<path refid="test.classpath"/>
<path path="${build.tests}"/>
</classpath>
<test name="ca.sqlpower.matchmaker.MatchMakerAllTests" 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>
</target>
<target name="build.stage">
<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="dqguruhelp.jar" />
</copy>
</target>
<target name="build.manifest" depends="build.stage">
<manifestclasspath property="dqguru.jar.classpath" jarfile="${staging.dir}/dqguru.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.matchmaker.swingui.MatchMakerSwingSession"/>
<attribute name="Class-Path" value="${dqguru.jar.classpath}" />
</manifest>
</target>
<target name="stage" depends="getAppVersion, compile, userguide, build.manifest">
<jar destfile="${staging.dir}/dqguru.jar" update="no"
basedir="${build}"
includes="ca/** org/** icons/** log4j.properties default_database_types.ini"
manifest="${build}/manifest">
<fileset dir="${src}" includes="ca/sqlpower/matchmaker/swingui/munge/munge_components.properties"/>
</jar>
<manifest file="${build}/dqguruenginerunner_manifest">
<attribute name="Main-Class" value="ca.sqlpower.matchmaker.DQguruEngineRunner"/>
<attribute name="Class-Path" value="dqguru.jar" />
</manifest>
<jar destfile="${staging.dir}/dqguru-engine-runner.jar" manifest="${build}/dqguruenginerunner_manifest"/>
<launch4j>
<config dontwrapjar="true"
headertype="gui"
jarpath="dqguru.jar"
outfile="${staging.dir}/dqguru.exe"
errtitle="Java Runtime Required"
priority="normal"
downloadurl="http://java.com/download"
supporturl="http://www.sqlpower.ca/forum"
customprocname="false"
stayalive="false"
icon="src/icons/dqguru.ico">
<jre minVersion="1.6.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"
customprocname="false"
stayalive="false"
icon="installer/uninstall.ico">
<singleInstance
mutexName="SQL Power DQguru Uninstaller"
windowTitle="SQL Power DQguru Uninstaller"
/>
<jre minVersion="1.6.0"/>
</config>
</launch4j>
<copy todir="${staging.dir}/lib">
<fileset dir="lib" includes="*.jar"/>
<!--fileset dir="${build}" includes="architecthelp.jar" /-->
</copy>
<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}" file="LEGAL"/>
</target>
<target name="getAppVersion">
<mkdir dir="${build}"/>
<!-- get the version number from source code ArchitectUtils -->
<delete file="${build}/ca/sqlpower/matchmaker/antbuild/MatchMakerVersionTask.class"/>
<javac srcdir="${src}" destdir="${build}" classpathref="compile.classpath" includes="ca/sqlpower/matchmaker/antbuild/MatchMakerVersionTask.java" debug="true"/>
<taskdef name="genVersion"
classname="ca.sqlpower.matchmaker.antbuild.MatchMakerVersionTask"
classpath="${build}"/>
<genVersion/>
<tstamp>
<format property="date" pattern="yyyyMMddHHmmss"/>
</tstamp>
<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="reports" value="${dist.base}/reports"/>
<condition property="downloadLinkBase" value="http://nightlybuild.sqlpower.ca/matchmaker/nightly/${app.version}">
<isset property="nightly"/>
</condition>
<condition property="docLinkBase" value="${downloadLinkBase}">
<isset property="nightly"/>
</condition>
<condition property="downloadLinkBase"
value="http://power-matchmaker.googlecode.com/files">
<not><isset property="downloadLinkBase"/></not>
</condition>
<condition property="docLinkBase"
value="http://download.sqlpower.ca/dqguru/${app.version}">
<not><isset property="docLinkBase"/></not>
</condition>
<echo message="Building DQguru version: ${app.version}"/>
</target>
<target name="windows_jar_installer" depends="stage">
<izpack output="${dist.base}/SQL-Power-DQguru-Setup-Windows-${app.version}.jar"
installerType="standard"
basedir="${installer.dir}"
izPackDir="${izpack.dir}/">
<config><![CDATA[
<installation version="1.0">
<!-- comment -->
<info>
<appname>SQL Power DQguru</appname>
<appversion>@{app.version}</appversion>
<url>http://www.sqlpower.ca/</url>
<javaversion>1.6</javaversion>
</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/icons/dqguru_huge.png"/>
<res src="DQguruShortcut.xml" id="shortcutSpec.xml"/>
<res id="LicencePanel.licence" src="../LICENSE" />
</resources>
<listeners>
<listener installer="SummaryLoggerInstallerListener"/>
<listener installer="RegistryInstallerListener"
uninstaller="RegistryUninstallerListener">
<os family="windows"/>
</listener>
</listeners>
<panels>
<panel classname="HelloPanel"/>
<panel classname="LicencePanel"/>
<panel classname="TargetPanel"/>
<panel classname="InstallPanel"/>
<panel classname="ShortcutPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
<packs>
<pack name="Core" required="yes">
<description>DQguru Core Files</description>
<fileset dir="../staging/" targetdir="$INSTALL_PATH">
<include name="dqguru.jar"/>
<include name="dqguru.exe"/>
<include name="dqguru-engine-runner.jar"/>
</fileset>
<fileset dir="../staging/lib" targetdir="$INSTALL_PATH/lib">
<include name="*.jar"/>
</fileset>
<!-- the directory jdbc is referenced in the manifest as well as
various targets. -->
<fileset dir="../staging/jdbc" targetdir="$INSTALL_PATH/jdbc">
<include name="*.jar"/>
<include name="*.ini"/>
</fileset>
<fileset dir="../staging/" targetdir="$INSTALL_PATH">
<include name="LICENSE"/>
</fileset>
<fileset dir="../staging/" targetdir="$INSTALL_PATH">
<include name="LEGAL"/>
</fileset>
<fileset dir="." targetdir="$INSTALL_PATH">
<include name="*.reg"/>
</fileset>
<fileset dir="../src/icons" targetdir="$INSTALL_PATH">
<include name="*.ico"/>
</fileset>
<fileset dir="." targetdir="$INSTALL_PATH">
<include name="*.ico"/>
</fileset>
<fileset dir="../staging/" targetdir="$INSTALL_PATH/uninstaller">
<include name="uninstaller.exe"/>
</fileset>
</pack>
</packs>
<native type="izpack" name="ShellLink.dll"/>
<native type="izpack" name="ShellLink_x64.dll"/>
<native type="3rdparty" name="COIOSHelper.dll" stage="both">
<os family="windows"/>
</native>
</installation>
]]>
</config>
</izpack>
</target>
<property name="izpack2exe.dir" value="${izpack.dir}/utils/izpack2exe"/>
<target name="windows_exe_installer_launch4j" depends="windows_jar_installer">
<launch4j>
<config dontwrapjar="false"
headertype="gui"
jar="${dist.base}/SQL-Power-DQguru-Setup-Windows-${app.version}.jar"
outfile="${dist.base}/SQL-Power-DQguru-Setup-Windows-${app.version}.exe"
errtitle="Java Runtime Required"
priority="normal"
downloadurl="http://java.com/download"
supporturl="http://www.sqlpower.ca/forum"
customprocname="false"
stayalive="false"
icon="installer/installerIcon-dq.ico">
<singleInstance
mutexName="DQguru Installer"
windowTitle="DQguru Installer"
/>
<jre minVersion="1.6.0"/>
</config>
</launch4j>
</target>
<target name="generic_install" depends="stage">
<tar destfile="${dist.base}/SQL-Power-DQguru-generic-${app.version}.tar.gz"
compression="gzip">
<tarfileset
prefix="dqguru-${app.version}"
dir="${staging.dir}"
includes="LICENSE, LEGAL, lib/*.jar, dqguru.jar, dqguru-engine-runner.jar, jdbc/*.ini, jdbc/*.jar" />
<tarfileset
prefix="dqguru-${app.version}"
dir="doc"
includes="README.generic" />
</tar>
</target>
<!-- OS X .app bundling tool: jarbundler -->
<taskdef name="jarbundler"
classpath="osx_packaging_utils/jarbundler.jar:osx_packaging_utils/xercesImpl.jar:osx_packaging_utils/xml-apis.jar"
classname="net.sourceforge.jarbundler.JarBundler"/>
<target name="osx_dist" depends="stage">
<!-- The pre-compiled osx adapter class (it only compiles on OS X) -->
<copy file="osx_packaging_utils/osx_adapter.jar" todir="${staging.dir}/lib"/>
<!-- jarbundler is from sourceforge, defined near top of file -->
<jarbundler dir="${staging.dir}"
name="SQL Power DQguru"
version="${app.version}"
bundleid="ca.sqlpower.matchmaker"
mainclass="ca.sqlpower.matchmaker.swingui.MatchMakerSwingSession"
icon="src/icons/dqguru.icns"
jvmversion="1.6+"
shortname="SQL Power DQguru"
stubfile="osx_packaging_utils/DQguruStub"
vmoptions="-Xmx600m">
<jarfileset dir="${staging.dir}" includes="lib/*.jar"/>
<jarfileset dir="${staging.dir}" includes="dqguru.jar"/>
<jarfileset dir="${staging.dir}" includes="dqguru-engine-runner.jar"/>
<!-- Add any jdbc drivers as resources the directory jdbc is referenced
in the manifest as well as various targets. -->
<javafileset dir="${staging.dir}" includes="jdbc/*.jar jdbc/*.ini"/>
<extraclasspathfilelist dir="KICKME" files="jdbc"/>
</jarbundler>
<!-- XXX this is stupid. we should modify the jarbundler task to allow literal strings in the classpath -->
<replace file="${staging.dir}/SQL Power DQguru.app/Contents/Info.plist"
token="${basedir}/KICKME"
value="$JAVAROOT" />
</target>
<!-- Creates a tarball containing only the Java source files -->
<target name="source_only_tgz" depends="getAppVersion"
description="Builds a source only tarball of the Architect">
<mkdir dir="${dist.base}"/>
<tar destfile="${dist.base}/SQL-Power-DQguru-src-only-${app.version}.tar.gz"
compression="gzip" longfile="gnu">
<tarfileset dir="."
prefix="matchmaker-src-only-${app.version}"
includes="${src}/**/*.java,
${src}/**/*.png,
${src}/**/*.gif,
${src}/**/*.xml,
${src}/**/*.sql,
${src}/**/*.architect,
regress/**/*.java,
build.xml,
build.properties.example,
LICENSE,
README.sourceonly
"/>
</tar>
</target>
<!-- This is needed to prevent a problem with DocBook help file generation
in which the XSLT replaces the spaces in the path name with '%20', and
doesn't convert it back when saving the files. It looks like this is
related to the DocBook chunking functionality.
We don't know of any good way to fix this yet, so we have this
check for the time being.-->
<target name="checkBuildPath"
description="Ensure the build path contains no spaces.">
<echo message="Note: Your build path cannot contain any spaces at this point because of a problem with help file generation."/>
<echo message="Checking build path..."/>
<!-- Check if the build path is absolute. If so, set buildPath -->
<condition property="buildPath" value="${build}">
<or>
<!-- Check for Windows style absolute pathnames-->
<and>
<or>
<!-- pathname with backslash only -->
<matches string="${build}" pattern="^\\{1}.*"/>
<!-- pathname with drive letter -->
<matches string="${build}" pattern="^[a-zA-Z]{1}:\\.*"/>
</or>
<os family="windows"/>
</and>
<!-- Check for Unix style absolute pathnames -->
<and>
<matches string="${build}" pattern="^//{1}.*"/>
<not>
<os family="windows"/>
</not>
</and>
</or>
</condition>
<!-- Check if buildPath is set. If not, then it's a relative buildpath-->
<condition property="buildPath" value="${basedir}\${build}">
<and>
<not>
<isset property="buildPath"/>
</not>
<os family="windows"/>
</and>
</condition>
<!-- Check if buildPath is set. If not, then it's not a windows buildpath (i.e. doesn't use '\')-->
<condition property="buildPath" value="${basedir}/${build}">
<not>
<isset property="buildPath"/>
</not>
</condition>
<echo message="Your build path is ${buildPath}"/>
<!-- Now check the build path for spaces -->
<fail message="Your build path MUST NOT contain any spaces. See the file 'build.properties.example' to see how to set property 'build' to an absolute pathname that does not contain any spaces">
<condition>
<contains string="${buildPath}" substring=" "/>
</condition>
</fail>
</target>
<target name="osx_tgz" depends="osx_dist" if="isUnix">
<!-- NOTE: This generally won't work on Windows as it typically doesn't have 'tar' installed -->
<exec executable="tar" dir="${staging.dir}">
<arg value="-cpzf"/>
<arg value="../${dist.base}/SQL-Power-DQguru-OSX-${app.version}.tar.gz"/>
<arg value="LICENSE"/>
<arg value="SQL Power DQguru.app"/>
</exec>
<!-- <tar destfile="${dist.base}/DQguru-OSX-${app.version}.tar.gz"
compression="gzip">
<tarfileset dir="${staging.dir}" includes="DQguru.app/**"/>
</tar> -->
</target>
<target name="osx_dmg" depends="osx_dist" if="isMac">
<!-- hdiutil create -size 50m -fs HFS+ -volname "Power*Architect" RWArchitect.dmg
hdiutil attach RWArchitect.dmg
(copy architect.app over, position it, etc)
/Developer/Tools/SetFile -a V /Volumes/Power\*Architect/install_folder_background.png
hdiutil detach /Volumes/Power\*Architect/
rm Power_Architect-1.0.19.dmg
hdiutil convert -format UDCO -o Power_Architect-1.0.19.dmg RWArchitect.dmg
-->
<copy file="osx_packaging_utils/RWDQguru.dmg.sparseimage" tofile="${staging.dir}/RWDQguru.dmg.sparseimage" overwrite="true" />
<exec executable="hdiutil">
<arg value="detach" />
<arg value="/Volumes/SQL Power DQguru" />
</exec>
<exec executable="hdiutil">
<arg value="attach" />
<arg value="${staging.dir}/RWDQguru.dmg.sparseimage" />
</exec>
<delete dir="/Volumes/SQL Power DQguru/SQL Power DQguru.app/Contents/Resources/Java"/>
<copy todir="/Volumes/SQL Power DQguru/SQL Power DQguru.app/" overwrite="true" >
<fileset dir="${staging.dir}/SQL Power DQguru.app"></fileset>
</copy>
<exec executable="chmod">
<arg value="a+x"/>
<arg value="/Volumes/SQL Power DQguru/SQL Power DQguru.app/Contents/MacOS/DQguruStub"/>
</exec>
<exec executable="hdiutil">
<arg value="detach" />
<arg value="/Volumes/SQL Power DQguru" />
</exec>
<delete file="${dist.base}/SQL-Power-DQguru-OSX-${app.version}.dmg" />
<exec executable="hdiutil">
<arg value="convert"/>
<arg value="${staging.dir}/RWDQguru.dmg.sparseimage"/>
<arg value="-format"/>
<arg value="UDCO"/>
<arg value="-o"/>
<arg value="${dist.base}/SQL-Power-DQguru-OSX-${app.version}.dmg"/>
</exec>
<javac srcdir="osx_packaging_utils"
destdir="${build}"
includes="ca/sqlpower/antbuild/AddLicenseToDMGTask.java"
/>
<taskdef name="addLicenseToDMG"
classname="ca.sqlpower.antbuild.AddLicenseToDMGTask"
classpath="${build}"/>
<addLicenseToDMG
dmgFile="${dist.base}/SQL-Power-DQguru-OSX-${app.version}.dmg"
licenseFile="${staging.dir}/LICENSE"
resourceTemplateFile="osx_packaging_utils/sla_template.r"/>
</target>
<!--
This build target checks for the sqlpower-library project, which is
required by the MatchMaker to build.
-->
<target name="check.sqlpower.library.dir">
<echo message="Checking for sqlpower-library project..."/>
<fail message="Can't find sqlpower-library project! Set the property 'sqlpower.library.home' to point to the sqlpower-library project directory">
<condition>
<not>
<isset property="sqlpower.library.home"/>
</not>
</condition>
</fail>
</target>
<target name="build.sqlpower.library" depends="check.sqlpower.library.dir" if="buildSQLPowerLibrary">
<echo message="Attempting to build sqlpower-library project..."/>
<ant dir="${sqlpower.library.home}" target="clean" inheritall="false" />
<ant dir="${sqlpower.library.home}" target="jar" inheritall="false" />
</target>
<target name="copy.sqlpower.library" depends="check.sqlpower.library.dir">
<copy file="${sqlpower.library.home}/dist/sqlpower_library.jar" todir="${lib}"/>
<copy file="${sqlpower.library.home}/dist/sqlpower_library-tests.jar" todir="${buildlib}"/>
<copy file="${sqlpower.library.home}/dist/sqlpower_library-apt.jar" todir="${buildlib}"/>
</target>
<target name="clean">
<delete dir="${build}"/>