-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
524 lines (456 loc) · 19.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
<!-- Build SnAP. It is also used by Hudson SnAP project. JUnit test is available for this build. -->
<project basedir="." default="build_all_SnAP" name="BUILD_SnAP">
<description>
Build SnAP.
Also used by Hudson SnAP project.
JUnit test is available for this build.
$Id: build_SNAPP.xml $
</description>
<!-- set global properties for this build -->
<property name="SNAPPdir" location="../SNAPP/" />
<property name="src" location="${SNAPPdir}/src" />
<property name="build" location="${SNAPPdir}/build" />
<property name="lib" location="${SNAPPdir}/lib" />
<property name="dist" location="${SNAPPdir}/dist" />
<property name="beast2path" location="../beast2" />
<property name="beast2build" location="${beast2path}/build" />
<property name="libBeast2" location="${beast2path}/lib" />
<property name="srcBeast2" location="${beast2path}/src" />
<property name="beast2classpath" location="${beast2path}/build" />
<property name="beastappclasspath" location="../BeastFX/build" />
<property name="BEASTLabsclasspath" location="../BEASTLabs/build" />
<property name="main_class_SnAP" value="snap.app.mcmc.SNAPPMCMC" />
<property name="main_class_TSA" value="snap.app.analysis.TreeSetAnalyser" />
<property name="report" value="${build}/junitreport"/>
<path id="classpath">
<fileset dir="${lib}" includes="**/*.jar"/>
<fileset dir="${libBeast2}" includes="antlr-runtime-4.7.jar"/>
<fileset dir="${libBeast2}" includes="jam.jar"/>
<pathelement path="${beast2classpath}"/>
<pathelement path="${beastappclasspath}"/>
<pathelement path="${BEASTLabsclasspath}"/>
</path>
<!-- start -->
<target name="init">
<echo message="${ant.project.name}: ${ant.file}" />
<available file="${SNAPPdir}/version.xml" property="versionAvailable"/>
<fail unless="versionAvailable">
** Required file version.xml does not exist. **
</fail>
<!-- Read package name and version from xml file -->
<xmlproperty file="${SNAPPdir}/version.xml" prefix="fromVersionFile" />
<property name="SNAPPversion" value="${fromVersionFile.package(version)}" />
</target>
<target name="clean">
<delete dir="${build}" />
</target>
<!-- clean previous build, and then compile Java source code, and Juint test -->
<target name="build_all_SnAP" depends="clean,compile-all,dist_all_SnAP"
description="Clean and Build all run-time stuff">
</target>
<!-- clean previous build, compile Java source code, and Junit test, and make the snap.jar -->
<target name="test" depends="clean,compile-all,junit,dist_all_SnAP"
description="Clean and Build all run-time stuff">
</target>
<!-- No JUnit Test, clean previous build, compile Java source code, and make the snap.jar -->
<target name="build_jar_all_SnAP_NoJUnitTest" depends="clean,compile-all,dist_all_SnAP"
description="Clean and Build all run-time stuff">
</target>
<!-- compile Java source code -->
<target name="compile-all" depends="init">
<mkdir dir="${build}" />
<!-- Compile the java code from ${src} into ${build} /bin -->
<javac srcdir="${src}" destdir="${build}" classpathref="classpath"
fork="true" includeantruntime='false'
memoryinitialsize="256m"
memorymaximumsize="256m">
<include name="snap/**/**" />
<!-- compile JUnit test classes -->
<include name="test/snap/**" />
<exclude name="snap/SNAPPHeatedMCMC.java"/>
<exclude name="snap/likelihood/SnAPForestLikelihood.java"/>
<exclude name="snap/app/analysis/SNAPPSkylineAnalyser.java"/>
</javac>
<copy todir="${build}">
<fileset dir="${src}" includes="**/*.properties"/>
<fileset dir="${src}" includes="**/*.png"/>
</copy>
<echo message="Successfully compiled." />
</target>
<!-- make the snap.jar and beauti.jar -->
<target name="dist_all_SnAP" depends="compile-all" description="create SnAP jar">
<!-- Create the distribution directory -->
<mkdir dir="${dist}" />
<!-- Put everything in ${build} into the snap.jar file -->
<jar jarfile="${dist}/snap.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main_class_SnAP}" />
</manifest>
<zipgroupfileset dir="${lib}" includes="mtj.jar" />
<!--zipgroupfileset dir="${lib}" includes="beast.jar" /-->
<fileset dir="${beast2build}">
<include name="**/*.class"/>
</fileset>
<zipgroupfileset dir="${libBeast2}" includes="jam.jar"/>
<zipgroupfileset dir="${libBeast2}" includes="antlr-runtime-4.7.jar"/>
<fileset dir="${build}">
<include name="snap/**/*.class" />
<include name="snap/**/*.png" />
<include name="**/*.properties" />
</fileset>
</jar>
<!-- Put everything + beastii in ${build} into the snapii.jar file -->
<!--
<jar jarfile="${dist}/snapii.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main_class_SnAP}" />
</manifest>
<zipgroupfileset dir="${lib}" includes="mtj.jar" />
<zipgroupfileset dir="${lib}" includes="beast.jar" />
<fileset dir="${build}">
<include name="snap/**/*.class" />
<include name="snap/**/*.png" />
<include name="beast/**/*.class" />
<include name="**/*.properties" />
</fileset>
<fileset dir="../beastii/build/">
<include name="beast/**/*.class" />
</fileset>
</jar>
-->
<jar jarfile="${dist}/snap.addon.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main_class_SnAP}" />
</manifest>
<fileset dir="${build}">
<include name="snap/**/*.class" />
<include name="snap/**/*.png" />
<include name="**/*.properties" />
</fileset>
</jar>
<jar jarfile="${dist}/snap.src.jar">
<fileset dir="${src}">
<include name="snap/**/*.java" />
<include name="**/*.properties" />
<include name="snap/**/*.png" />
<include name="snap/**/*.xsl" />
</fileset>
</jar>
</target>
<!-- run snap.jar -->
<target name="run_SnAP">
<java jar="${dist}/snap.jar" fork="true" />
</target>
<!-- JUnit test -->
<target name="junit">
<mkdir dir="${report}" />
<junit printsummary="yes">
<classpath>
<path refid="classpath" />
<path location="${build}" />
</classpath>
<formatter type="xml" />
<batchtest fork="yes" todir="${report}">
<fileset dir="${src}">
<include name="test/**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<echo message="JUnit test finished." />
</target>
<target name="junitreport">
<junitreport todir="${report}">
<fileset dir="${report}" includes="*.xml"/>
<report format="frames" todir="${report}"/>
</junitreport>
<echo message="JUnit test report finished." />
</target>
<target name="doc">
<exec executable="pdflatex" dir="${basedir}/doc">
<arg value="SNAPP.tex" />
</exec>
<exec executable="pdflatex" dir="${basedir}/doc">
<arg value="SNAPP.tex" />
</exec>
<copy file="doc/SNAPP.pdf" tofile="release/common/doc/SNAPP.pdf" />
</target>
<!-- Release -->
<property name="release_dir" value="release" />
<property name="copyright" value="SNAPP development team 2011-2022" />
<property name="SNAPP_name" value="SNAPP" />
<property name="BEAUti_name" value="BEAUti" />
<property name="TSA_name" value="TreeSetAnalyser" />
<property name="common_dir" value="${release_dir}/common" />
<property name="Mac_dir" value="${release_dir}/Mac" />
<property name="Linux_dir" value="${release_dir}/Linux" />
<property name="Windows_dir" value="${release_dir}/Windows" />
<property name="tools_dir" value="${common_dir}/tools" />
<property name="Mac_package_dir" value="${Mac_dir}/${SNAPP_name}" />
<property name="Linux_package_dir" value="${Linux_dir}/${SNAPP_name}" />
<property name="Add_on_dir" value="${release_dir}/add-on" />
<property name="Windows_package_dir" value="${Windows_dir}/${SNAPP_name}" />
<!-- Need to either install Launch4j under {BEAST workspace}/${release}
or install it in the default directory and change the location of launch4j.dir -->
<target name="windows"
depends="build_jar_all_SnAP_NoJUnitTest,doc"
description="release Windows version of SNAPP, BEAUTI, DensiTree, TreeSetAnalyser">
<delete dir="${Windows_package_dir}" />
<!-- Create the release directory -->
<mkdir dir="${Windows_package_dir}" />
<property name="launch4j.dir" location="${Windows_dir}/launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar :${launch4j.dir}/lib/xstream.jar" />
<copy todir="${Windows_package_dir}/doc">
<fileset dir="${common_dir}/doc" />
</copy>
<copy todir="${Windows_package_dir}/examples/">
<fileset dir="examples/">
<include name="*.xml" />
<include name="nexus/**" />
<exclude name="benchmark/**" />
</fileset>
</copy>
<copy file="${dist}/snap.jar" todir="${Windows_package_dir}/lib" />
<copy file="${dist}/snap.src.jar" todir="${Windows_package_dir}/lib" />
<copy file="${common_dir}/VERSION HISTORY.txt" todir="${Windows_package_dir}" />
<copy file="${common_dir}/README.txt" todir="${Windows_package_dir}" />
<!-- BEAUTi v?.?.?.exe -->
<launch4j configFile="${Windows_dir}/BEAUti_launch4j.xml"
jar="${dist}/snap.jar"
outfile="${Windows_package_dir}/${BEAUti_name}.exe"
fileVersion="${version_number}.0"
txtFileVersion="${version}"
productVersion="${version_number}.0"
txtProductVersion="${version}" />
<!-- SNAPP v?.?.?.exe -->
<launch4j configFile="${Windows_dir}/SNAPP_launch4j.xml"
jar="${dist}/snap.jar"
outfile="${Windows_package_dir}/${SNAPP_name}.exe"
fileVersion="${version_number}.0"
txtFileVersion="${version}"
productVersion="${version_number}.0"
txtProductVersion="${version}" />
<launch4j configFile="${Windows_dir}/TSA_launch4j.xml"
jar="${dist}/snap.jar"
outfile="${Windows_package_dir}/${TSA_name}.exe"
fileVersion="${version_number}.0"
txtFileVersion="${version}"
productVersion="${version_number}.0"
txtProductVersion="${version}" />
<launch4j configFile="${tools_dir}/DensiTree_launch4j.xml"
jar="${tools_dir}/DensiTree.jar"
outfile="${Windows_package_dir}/DensiTree.exe"
fileVersion="2.1.7.0"
txtFileVersion="2.1.7.0"
productVersion="2.1.7.0"
txtProductVersion="2.1.7.0" />
<copy todir="${Windows_package_dir}/fxtemplates/">
<fileset dir="fxtemplates/" />
</copy>
<zip destfile="${Windows_dir}/${SNAPP_name} v${version}.zip">
<zipfileset dir="${Windows_package_dir}" prefix="${SNAPP_name}" />
</zip>
<echo message="Windows version release is finished." />
</target>
<target name="linux"
depends="build_jar_all_SnAP_NoJUnitTest,doc"
description="release Linux/Unix version of SNAPP, BEAUTI, TreeSetAnalyser, DensiTree">
<delete dir="${Linux_package_dir}" />
<!-- Create the release directory -->
<mkdir dir="${Linux_package_dir}" />
<copy todir="${Linux_package_dir}/bin">
<fileset dir="${Linux_dir}/bin" />
</copy>
<chmod dir="${Linux_package_dir}/bin" perm="755" includes="**/**" />
<copy todir="${Linux_package_dir}/doc">
<fileset dir="${common_dir}/doc" />
</copy>
<copy todir="${Linux_package_dir}/examples/">
<fileset dir="examples/">
<include name="*.xml" />
<include name="nexus/**" />
<exclude name="benchmark/**" />
</fileset>
</copy>
<copy file="${common_dir}/icons/snapp.png" todir="${Linux_package_dir}/images" />
<copy file="${common_dir}/icons/beauti.png" todir="${Linux_package_dir}/images" />
<copy file="${dist}/snap.jar" todir="${Linux_package_dir}/lib" />
<copy file="${dist}/snap.src.jar" todir="${Linux_package_dir}/lib" />
<copy file="${tools_dir}/DensiTree.jar" todir="${Linux_package_dir}/lib" />
<copy file="${tools_dir}/DensiTree.png" todir="${Linux_package_dir}/images" />
<copy todir="${Linux_package_dir}/fxtemplates/">
<fileset dir="fxtemplates/" />
</copy>
<copy file="${common_dir}/VERSION HISTORY.txt" todir="${Linux_package_dir}" />
<copy file="${common_dir}/README.txt" todir="${Linux_package_dir}" />
<!-- Only works under Unix or NonStop Kernel (Tandem) -->
<!-- <chmod dir="${Linux_package_dir}/bin" perm="755" includes="**/**"/-->
<!-- [ANT Bug 550] the tar task change the mode of the executables files, have to tar manaully -->
<echo message="Have to tar manaully, because [ANT Bug 550] the tar task change the mode of the executables files." />
<echo message="Linux/Unix version release is finished." />
</target>
<property name="jarbundler_dir" value="/Applications/eclipse/plugins/org.apache.ant_1.8.2.v20110505-1300/lib" />
<target name="mac"
depends="build_jar_all_SnAP_NoJUnitTest"
description="release Mac version of SNAPP, BEAUTI, TreeSetAnalyser, DensiTree">
<delete dir="${Mac_package_dir}" />
<!-- Create the release directory -->
<mkdir dir="${Mac_package_dir}" />
<copy todir="${Mac_package_dir}/bin">
<fileset dir="${Linux_dir}/bin" />
</copy>
<chmod dir="${Mac_package_dir}/bin" perm="755" includes="**/**" />
<copy todir="${Mac_package_dir}/doc">
<fileset dir="${common_dir}/doc" />
</copy>
<copy todir="${Mac_package_dir}/examples/">
<fileset dir="examples/">
<include name="*.xml" />
<include name="nexus/**" />
<exclude name="benchmark/**" />
</fileset>
</copy>
<!-- <copy todir="${Mac_package_dir}/native">
<fileset dir="${common_dir}/native" />
</copy>
<copy file="${dist}/beauti.jar" todir="${Mac_package_dir}/lib" /> -->
<copy file="${dist}/snap.jar" todir="${Mac_package_dir}/lib" />
<copy file="${dist}/snap.src.jar" todir="${Mac_package_dir}/lib" />
<copy file="${common_dir}/VERSION HISTORY.txt" todir="${Mac_package_dir}" />
<copy file="${common_dir}/README.txt" todir="${Mac_package_dir}" />
<taskdef name="jarbundler"
classname="net.sourceforge.jarbundler.JarBundler"
classpath="${jarbundler_dir}/jarbundler-2.2.0.jar" />
<!-- create a jar bundle for the mac -->
<jarbundler dir="${Mac_package_dir}"
name="${SNAPP_name}"
mainclass="${main_class_SnAP}"
icon="${common_dir}/icons/snapp.icns"
jvmversion="1.6+"
vmoptions="-Xmx1024M"
arguments="-window -working -options"
version="${version}"
infostring="${SNAPP_name}, ${copyright}"
bundleid="${main_class_SnAP}">
<jarfileset dir="${Mac_package_dir}/lib">
<include name="**/snap.jar" />
<!-- <include name="**/beast-beagle.jar" /> -->
</jarfileset>
<!-- <jarfileset dir="${Mac_package_dir}/lib">
<include name="libNucleotideLikelihoodCore.jnilib" />
</jarfileset> -->
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="java.library.path" value="$JAVAROOT:/usr/local/lib" />
</jarbundler>
<jarbundler dir="${Mac_package_dir}"
name="${TSA_name}"
mainclass="${main_class_TSA}"
icon="${common_dir}/icons/tsa.icns"
jvmversion="1.6+"
vmoptions="-Xmx1024M"
arguments="-window -working -options"
version="${version}"
infostring="${TSA_name}, ${copyright}"
bundleid="${main_class_TSA}">
<jarfileset dir="${Mac_package_dir}/lib">
<include name="**/snap.jar" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="java.library.path" value="$JAVAROOT:/usr/local/lib" />
</jarbundler>
<jarbundler dir="${Mac_package_dir}"
name="${BEAUti_name}"
mainclass="beast.app.beauti.Beauti"
icon="${common_dir}/icons/beauti.icns"
jvmversion="1.6+"
vmoptions="-Xmx1024M -Xdock:name="BEAUti 2""
arguments="-template fxtemplates/SNAPP.xml"
version="${version}"
infostring="${BEAUti_name}, ${copyright}"
bundleid="beast.app.beauti.Beauti">
<jarfileset dir="${Mac_package_dir}/lib">
<include name="**/snap.jar" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="java.library.path" value="$JAVAROOT" />
</jarbundler>
<!-- ant copy will not redirect the source, so that have to re-bundler it -->
<jarbundler dir="${Mac_package_dir}"
name="DensiTree"
mainclass="viz.DensiTree"
icon="${tools_dir}/DensiTree.icns"
jvmversion="1.6+"
vmoptions="-Xmx1024M"
arguments=""
version="2.1.3"
infostring="DensiTree, http://compevol.auckland.ac.nz/software/DensiTree/"
bundleid="viz.DensiTree">
<jarfileset dir="${tools_dir}">
<include name="**/DensiTree.jar" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="java.library.path" value="$JAVAROOT/lib" />
</jarbundler>
<copy todir="${Mac_package_dir}/fxtemplates/">
<fileset dir="fxtemplates/" />
</copy>
<echo message="Building disk image." />
<!-- create disk image -->
<exec executable="/usr/bin/hdiutil">
<arg value="create" />
<arg value="-ov" />
<arg value="-srcfolder" />
<arg value="${Mac_package_dir}" />
<arg value="-volname" />
<arg value="${SNAPP_name}" />
<arg value="-imagekey" />
<arg value="zlib-level=6" />
<arg value="${Mac_dir}/${SNAPP_name} v${version}.dmg" />
</exec>
<echo message="Mac version release is finished." />
</target>
<!--
-->
<target name="addon"
depends="build_jar_all_SnAP_NoJUnitTest"
description="release BEAST 2 add-on version of SNAPP">
<delete dir="${Add_on_dir}" />
<!-- Create the release directory -->
<mkdir dir="${Add_on_dir}" />
<mkdir dir="${Add_on_dir}/lib" />
<mkdir dir="${Add_on_dir}/fxtemplates" />
<mkdir dir="${Add_on_dir}/examples" />
<mkdir dir="${Add_on_dir}/examples/nexus" />
<mkdir dir="${Add_on_dir}/doc" />
<copy todir="${Add_on_dir}">
<fileset file="version.xml"/>
</copy>
<copy todir="${Add_on_dir}/lib">
<fileset dir="${dist}" includes="snap.addon.jar" />
</copy>
<copy todir="${Add_on_dir}">
<fileset dir="${dist}" includes="snap.src.jar" />
</copy>
<copy todir="${Add_on_dir}/fxtemplates">
<fileset file="fxtemplates/SNAPP.xml" />
</copy>
<copy file="doc/SNAPP.pdf" tofile="${Add_on_dir}/doc/SNAPP.pdf" />
<copy todir="${Add_on_dir}/examples" >
<fileset dir="examples" includes="*.xml" />
<fileset dir="examples" includes="*.json" />
</copy>
<copy todir="${Add_on_dir}/examples/nexus" >
<fileset dir="examples/nexus" includes="*.nex" />
</copy>
<jar jarfile="${dist}/SNAPP.addon.v${SNAPPversion}.zip">
<fileset dir="${Add_on_dir}">
<include name="**/*" />
</fileset>
</jar>
<echo message="Add-on v${SNAPPversion} release is finished." />
</target>
</project>