-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
executable file
·607 lines (493 loc) · 20.7 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
<?xml version="1.0"?>
<project name="Specify 6 Build File" xmlns:if="ant:if" xmlns:unless="ant:unless" basedir=".">
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<!-- Set up properties containing important project directories -->
<property name="source.root" value="src" />
<property name="build.root" value="build" />
<property name="installer.dir" value="InstallerFiles" />
<property name="lib.dir" value="libs" />
<property name="hibernatelib.dir" value="hibernate_libs" />
<property name="externallib.dir" value="external_libs" />
<property name="ireport.dir" value="iReportLibs" />
<property name="system.dep.libs.dir" value="system_dep_libs" />
<property name="hibernate.properties" value="hibernate.properties" />
<property name="hibernate.cfg" value="hibernate.cfg.xml" />
<property file="src/resources_en.properties" prefix="specify."/>
<fail unless="specify.SPECIFY_VERSION">Specify version not set.</fail>
<property name="packages.dir" value="packages" />
<property name="install4j.dir" value="${user.home}/install4j8.0.11" />
<property name="packaging.dir" value="packaging"/>
<!-- Needed for building help search index -->
<property name ="javahelp-home" value="/home/specify/jh2.0" />
<property name ="javahelp-home-mac" value="/Applications/jh2.0" />
<!-- Needed for Packing on the Mac -->
<property name="packaging" value="packaging" />
<property name="app.name" value="Specify" />
<property name="jar.name" value="specify" />
<property name="dist-mac" value="mac-dist" />
<!-- Needed for Packing on the Windows -->
<property name="dist-win" value="win-dist" />
<!-- Needed for Packing on the Linux -->
<property name="dist-linux" value="linux-dist" />
<!-- Set up the class path for compilation and execution -->
<path id="project.class.path">
<!-- Include jars in the project library directory -->
<fileset dir="${hibernatelib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<!-- Include our own classes, of course -->
<pathelement location="specify.jar"/>
</path>
<path id="compile.classpath">
<fileset dir="${hibernatelib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${externallib.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${ireport.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="wwlibs">
<include name="**/*.jar" />
</fileset>
<fileset dir="embedded_libs">
<include name="**/*.jar" />
</fileset>
</path>
<path id="compile.classpath.mac">
<path refid="compile.classpath"/>
<pathelement location="${system.dep.libs.dir}/AppleJavaExtensions-1.6.jar"/>
</path>
<path id="compile.classpath.nonmac">
<path refid="compile.classpath"/>
<pathelement location="${system.dep.libs.dir}/non-mac-application-adapter.jar"/>
</path>
<target name="compile-mac">
<mkdir dir="${build.root}/classes-mac"/>
<javac srcdir="${source.root}" destdir="${build.root}/classes-mac" classpathref="compile.classpath.mac" debug="on">
<compilerarg value="-XDignore.symbol.file"/>
</javac>
</target>
<target name="compile-nonmac">
<mkdir dir="${build.root}/classes-nonmac"/>
<javac srcdir="${source.root}" destdir="${build.root}/classes-nonmac" classpathref="compile.classpath.nonmac" debug="on">
<compilerarg value="-XDignore.symbol.file"/>
</javac>
</target>
<target name="make-jar-mac" depends="compile-mac, buildinfo">
<make-jar platform="mac" />
</target>
<target name="make-jar-nonmac" depends="compile-nonmac, buildinfo">
<make-jar platform="nonmac" />
</target>
<macrodef name="make-jar">
<attribute name="platform"/>
<sequential>
<mkdir dir="${build.root}/jar-src"/>
<copy todir="${build.root}/jar-src">
<fileset dir="${build.root}/classes-@{platform}">
<include name="**/*.class" />
<include name="**/*.xml" />
<include name="**/*.betwixt" />
<include name="**/images/**/*.*" />
</fileset>
<fileset dir="${source.root}">
<include name="**/*.xml" />
<include name="**/*.betwixt" />
<include name="edu/ku/brc/specify/images/**/*.*" />
</fileset>
<file file="${build.root}/bld.properties"/>
</copy>
<native2ascii src="${source.root}" dest="${build.root}/jar-src" includes="**/*.properties"/>
<jar destfile="${build.root}/${jar.name}-@{platform}.jar">
<fileset dir="${build.root}/jar-src">
<include name="**/*.class" />
<include name="**/*.properties" />
<include name="**/*.xml" />
<include name="**/*.betwixt" />
<include name="**/images/**/*.*" />
</fileset>
</jar>
<delete dir="${build.root}/jar-src"/>
</sequential>
</macrodef>
<target name="buildinfo">
<tstamp>
<format property="builtat" pattern="MM/dd/yyyy hh:mm aa" timezone="America/Chicago"/>
</tstamp>
<exec executable="git" outputproperty="git.describe">
<arg value="describe" />
<arg value="--tags" />
</exec>
<propertyfile file="${build.root}/bld.properties"
comment="This file is automatically generated - DO NOT EDIT">
<entry key="buildtime" value="${builtat}"/>
<entry key="build" value="${git.describe}"/>
<entry key="builder" value="${user.name}"/>
<entry key="version" value="${specify.SPECIFY_VERSION}"/>
<entry key="system" value="${os.name} ${os.arch} ${os.version}"/>
</propertyfile>
</target>
<target name="installer-common" depends="generate-datamodel">
<delete dir="${installer.dir}"/>
<mkdir dir="${installer.dir}" />
<mkdir dir="${installer.dir}/demo_files"/>
<mkdir dir="${installer.dir}/plugins" />
<!-- Copy config dir -->
<copy todir="${installer.dir}/config">
<fileset dir="config">
<exclude name="**/*.svn" />
</fileset>
</copy>
<copy todir="${installer.dir}/hibernate_libs">
<fileset dir="hibernate_libs">
<exclude name="**/*.svn" />
</fileset>
</copy>
<copy todir="${installer.dir}/iReportLibs">
<fileset dir="iReportLibs">
<exclude name="**/*.svn" />
</fileset>
</copy>
<copy todir="${installer.dir}/libs">
<fileset dir="libs">
<exclude name="**/*.svn" />
<exclude name="**/derby.jar" />
</fileset>
</copy>
<copy todir="${installer.dir}/wwlibs">
<fileset dir="wwlibs">
<exclude name="**/*.svn" />
</fileset>
</copy>
<copy todir="${installer.dir}/embedded_libs">
<fileset dir="embedded_libs">
<exclude name="**/*.svn" />
</fileset>
</copy>
<!-- Copy Help -->
<copy todir="${installer.dir}/help">
<fileset dir="help">
<include name="**/*" />
<exclude name="**/.svn" />
<exclude name="**/*.psd" />
</fileset>
</copy>
<copy file="packaging/readme.html" todir="${installer.dir}" />
<copy file="packaging/license_agreement.html" todir="${installer.dir}" />
<copy file="./packaging/SpecifyBigSplashBordered.png" todir="${installer.dir}" />
<move file="${installer.dir}/SpecifyBigSplashBordered.png" tofile="${installer.dir}/SpecifyBigSplash.png"/>
<copy file="./demo_files/topbrc4.jpg" todir="${installer.dir}/demo_files" />
<copy file="./demo_files/topbrc195x68.png" todir="${installer.dir}/demo_files" />
<copy file="./demo_files/chronostrat_tree.xls" todir="${installer.dir}/demo_files" />
<copy file="./demo_files/my.cnf" todir="${installer.dir}/demo_files" />
</target>
<target name="package-all" depends="clean-packages, package-mac, package-nonmac">
<antcall target="generate-updates-xml" />
</target>
<target name="clean-packages">
<delete dir="${packages.dir}" />
</target>
<target name="package-mac" depends="installer-common, make-jar-mac">
<delete file="${installer.dir}/non-mac-application-adapter.jar" />
<copy overwrite="true" file="${build.root}/${jar.name}-mac.jar" tofile="${installer.dir}/${jar.name}.jar" />
<exec executable="${install4j.dir}/bin/install4jc">
<!-- <arg value="-\-quiet"/> -->
<arg value="--faster"/>
<arg value="--win-keystore-password=${win-keystore-password}" />
<arg value="--mac-keystore-password=${mac-keystore-password}"/>
<arg value="--disable-signing" unless:true="${code.signing}" />
<arg value="-D" />
<arg value="macPkcs12File=${mac.pkcs12},windowsPkcs12File=${win.pkcs12}" />
<arg value="--release=${specify.SPECIFY_VERSION}" />
<arg value="--destination=${packages.dir}" />
<arg value="--build-ids=24" />
<arg value="${packaging.dir}/5-mac-full-ext.install4j" />
</exec>
<move file="${packages.dir}/updates.xml" tofile="${packages.dir}/updates.xml.macfull"/>
</target>
<target name="package-nonmac" depends="installer-common, make-jar-nonmac">
<copy file="${system.dep.libs.dir}/non-mac-application-adapter.jar" todir="${installer.dir}" />
<copy overwrite="true" file="${build.root}/${jar.name}-nonmac.jar" tofile="${installer.dir}/${jar.name}.jar" />
<exec executable="${install4j.dir}/bin/install4jc">
<!-- <arg value="-\-quiet"/> -->
<arg value="--faster"/>
<arg value="--win-keystore-password=${win-keystore-password}" />
<arg value="--mac-keystore-password=${mac-keystore-password}"/>
<arg value="--disable-signing" unless:true="${code.signing}" />
<arg value="-D" />
<arg value="macPkcs12File=${mac.pkcs12},windowsPkcs12File=${win.pkcs12}" />
<arg value="--release=${specify.SPECIFY_VERSION}" />
<arg value="--destination=${packages.dir}" />
<arg value="--build-ids=1965,1873" />
<arg value="${packaging.dir}/5-winlin-full-ext-64.install4j" />
</exec>
<move file="${packages.dir}/updates.xml" tofile="${packages.dir}/updates.xml.winlinfull64"/>
<move todir="${packages.dir}">
<fileset dir="${packages.dir}"/>
<mapper type="regexp" from="^(.*)(?:-x64|-x32)(.*)$" to="\1\2" />
</move>
</target>
<target name="generate-updates-xml">
<local name="macos-package-file"/>
<local name="windows64-package-file"/>
<local name="unix64-package-file"/>
<exec executable="find" outputproperty="macos-package-file" dir="${packages.dir}">
<arg line="-name '*macos*' -and -not -name '*update*' -printf %f" />
</exec>
<exec executable="find" outputproperty="windows64-package-file" dir="${packages.dir}">
<arg line="-name '*windows*64*' -and -not -name '*update*' -printf %f" />
</exec>
<exec executable="find" outputproperty="unix64-package-file" dir="${packages.dir}">
<arg line="-name '*unix*64*' -and -not -name '*update*' -printf %f" />
</exec>
<exec executable="./packaging/generate_updates_xml.sh">
<arg value="${packages.dir}"/>
<arg value="${specify.SPECIFY_VERSION}"/>
<arg value="24"/>
<arg value="${macos-package-file}"/>
<arg value="1873"/>
<arg value="${windows64-package-file}"/>
<arg value="1965"/>
<arg value="${unix64-package-file}"/>
</exec>
<move file="tmp.xml" tofile="${packages.dir}/updates.xml"/>
</target>
<target name="run-specify-nonmac" depends="make-jar-nonmac, generate-datamodel">
<java classname="edu.ku.brc.specify.Specify" fork="true" failonerror="true">
<classpath>
<path refid="compile.classpath.nonmac"/>
<pathelement location="${build.root}/${jar.name}-nonmac.jar"/>
</classpath>
</java>
</target>
<target name="run-wizard-nonmac" depends="make-jar-nonmac, generate-datamodel">
<java classname="edu.ku.brc.specify.config.init.SpecifyDBSetupWizardFrame" fork="true" failonerror="true">
<classpath>
<path refid="compile.classpath.nonmac"/>
<pathelement location="${build.root}/${jar.name}-nonmac.jar"/>
</classpath>
</java>
</target>
<target name="run-specify-mac" depends="make-jar-mac, generate-datamodel">
<java classname="edu.ku.brc.specify.Specify" fork="true" failonerror="true">
<classpath>
<path refid="compile.classpath.mac"/>
<pathelement location="${build.root}/${jar.name}-mac.jar"/>
</classpath>
</java>
</target>
<target name="generate-datamodel" depends="make-jar-nonmac">
<java classname="edu.ku.brc.specify.tools.datamodelgenerator.DatamodelGenerator" fork="true" failonerror="true">
<classpath>
<path refid="compile.classpath.nonmac"/>
<pathelement location="${build.root}/${jar.name}-nonmac.jar"/>
</classpath>
</java>
</target>
<!-- *************************************************************
Schema Export (Doesn't work at the moment)
************************************************************* -->
<target name="schemaexport" description="Generates the database schema with hbm2ddl to a file" depends="">
<taskdef name="schemaexport" classname="org.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath refid="project.class.path" />
</taskdef>
<!-- Use the Hibernate configuration from source directory. -->
<schemaexport
config="src/hibernate.cfg.xml"
quiet="yes"
text="no"
drop="no"
delimiter=";"
output="${build.dir}/schema-export.sql"/>
</target>
<!-- *************************************************************
Build Help Index
************************************************************* -->
<target name="build-help-index">
<java classname="edu.ku.brc.util.HelpIndexer" fork="true">
<classpath refid="project.class.path" />
<arg value="${appdir}/help/SpecifyHelp.jhm"/>
<arg value="${appdir}/help/SpecifyHelp"/>
<arg value="${appdir}/help/SpecifyHelpIndex.xml"/>
</java>
</target>
<!-- *************************************************************
Build Help FullText Index
************************************************************* -->
<target name="delete-config-files">
<delete file="${appdir}/help/${dist-linux}SearchConfig.txt"/>
<delete file="${appdir}/help/${dist-mac}SearchConfig.txt"/>
<delete file="${appdir}/help/${dist-win}SearchConfig.txt"/>
</target>
<target name="build-help-fulltext-linux">
<java jar="${javahelp-home}/javahelp/bin/jhindexer.jar" fork="true" dir="${appdir}/help/">
<!-- if definitions for dist-linux,dist-mac, or dist-win change then
contents of xxxSearchConfig.txt files will need to be changed accordingly -->
<arg value="-c" />
<arg value="${dist-linux}SearchConfig.txt"/>
<arg value="-db" />
<arg value="SpecifyHelpSearchIndex"/>
<arg value="SpecifyHelp"/>
</java>
<antcall target="delete-config-files"/>
</target>
<target name="build-help-fulltext-mac">
<java jar="${javahelp-home-mac}/javahelp/bin/jhindexer.jar" fork="true">
<!-- if definitions for dist-linux,dist-mac, or dist-win change then
contents of xxxSearchConfig.txt files will need to be changed accordingly -->
<arg value="-c" />
<arg value="${installer.dir}/help/${dist-mac}SearchConfig.txt"/>
<arg value="-db" />
<arg value="${installer.dir}/help/SpecifyHelpSearchIndex"/>
<arg value="${installer.dir}/help/SpecifyHelp"/>
</java>
<antcall target="delete-config-files"/>
</target>
<target name="build-help-fulltext-win">
<java jar="${javahelp-home}/javahelp/bin/jhindexer.jar" fork="true" dir="${appdir}/help/">
<!-- if definitions for dist-linux,dist-mac, or dist-win change then
contents of xxxSearchConfig.txt files will need to be changed accordingly -->
<arg value="-c" />
<arg value="${installer.dir}SearchConfig.txt"/>
<arg value="-db" />
<arg value="SpecifyHelpSearchIndex"/>
<arg value="SpecifyHelp"/>
</java>
<antcall target="delete-config-files"/>
</target>
<!-- *************************************************************
Common files between Windows and Linux
************************************************************* -->
<target name="basic-non-mac-dist">
<mkdir dir="${appdir}/classes" />
<!--<copy file="${source.root}/log4j.properties" todir="${appdir}/classes/." />-->
<!-- Copy config dir -->
<copy todir="${appdir}/config">
<fileset dir="config">
<exclude name="**/.svn" />
<exclude name="**/.csv" />
</fileset>
</copy>
<!-- Copy demo_files dir -->
<copy todir="${appdir}/demo_files">
<fileset dir="demo_files">
<exclude name="**/.svn" />
<exclude name="**/.csv" />
<exclude name="**/.jrxml" />
<include name="**/topbrc195x68.png" />
<include name="**/Stratigraphy.csv" />
</fileset>
</copy>
<!-- Copy the main app jar -->
<copy file="${jar.name}.jar" todir="${appdir}/libs" />
<copy todir="${appdir}/libs">
<fileset dir="libs">
<include name="*.jar" />
<exclude name="**/json-lib.jar" />
<exclude name="**/ezmorph.jar" />
</fileset>
<fileset dir="${hibernatelib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${ireport.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${system.dep.libs.dir}">
<include name="*.jar" />
</fileset>
</copy>
<!-- Copy Help -->
<copy todir="${appdir}/help">
<fileset dir="help">
<exclude name="**/.svn" />
</fileset>
</copy>
</target>
<!-- *************************************************************
Windows Distribution
************************************************************* -->
<target name="dist-win-update" description="Updates the Specify.jat, images, help etc.">
<property name="appdir" value="${dist-win}/Specify" />
<property name="derby.data.path" value="${dist-win}/DerbyDatabases" />
<antcall target="clean-jar"/>
<antcall target="dist-jar"/>
<antcall target="basic-non-mac-dist"/>
<!-- Copy Alt Help Image Files -->
<property name="alt.help.img.dir" value="AltHelpImages/Windows"/>
<antcall target="copy-alt-help-images"/>
</target>
<target name="dist-win" description="Builds for Windows">
<property name="appdir" value="${dist-win}/Specify" />
<property name="derby.data.path" value="${dist-win}/DerbyDatabases" />
<antcall target="clean-jar"/>
<antcall target="dist-win-clean"/>
<antcall target="dist-jar"/>
<mkdir dir="${dist-win}" />
<mkdir dir="${appdir}/libs" />
<mkdir dir="${dist-win}/examples" />
<antcall target="basic-non-mac-dist"/>
<antcall target="build-help-index"/>
<antcall target="build-help-fulltext-win"/>
<!-- Copy Alt Help Image Files -->
<property name="alt.help.img.dir" value="AltHelpImages/Windows"/>
<antcall target="copy-alt-help-images"/>
<!-- Demo Files -->
<copy file="demo_files/workbench/FishCollectingTrip.csv" todir="${dist-win}/examples" />
<copy file="demo_files/workbench/JohsonCountyTrip.csv" todir="${dist-win}/examples" />
<copy file="demo_files/workbench/SaipanTrip.xls" todir="${dist-win}/examples" />
<copy file="demo_files/Reports/ImportExample.jrxml" todir="${dist-win}/examples" />
<!-- This is NOT for the release -->
<!-- Copy demo_files dir -->
<copy todir="${appdir}/demo_files">
<fileset dir="demo_files">
<exclude name="**/.svn" />
<exclude name="**/.csv" />
<exclude name="**/.jrxml" />
<include name="**/*.jpg" />
</fileset>
</copy>
</target>
<target name="dist-win-jar">
<property name="appdir" value="${dist-win}/Specify" />
<property name="derby.data.path" value="${dist-win}/DerbyDatabases" />
<antcall target="clean-jar"/>
<antcall target="dist-jar"/>
<copy file="${jar.name}.jar" todir="${appdir}/libs" />
</target>
<!--*************************************************************
Copy Alternate Help Images
************************************************************* -->
<target name="copy-alt-help-images">
<!-- <property name="appdir" value="${dist-mac}/${app.name}.app" />
<property name="alt.help.img.dir" value="AltHelpImages/Windows"/>
<copy todir="${appdir}/Contents/Resources/Java/help/SpecifyHelp/images" flatten="true" overwrite="true"> -->
<copy todir="${appdir}/help/SpecifyHelp/images" flatten="true" overwrite="true">
<fileset dir="${alt.help.img.dir}">
<exclude name="**/.svn" />
<include name="**/*.png" />
</fileset>
</copy>
</target>
<!--*************************************************************
Clean Distributions
************************************************************* -->
<target name="dist-mac-clean">
<delete dir="${dist-mac}"/>
</target>
<target name="dist-win-clean">
<delete dir="${dist-win}"/>
</target>
<target name="dist-linux-clean">
<delete dir="${dist-linux}"/>
</target>
</project>