-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
394 lines (319 loc) · 15.8 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
<!-- Build gammaspike. It is also used by Hudson gammaspike project. JUnit test is available for this build. -->
<project basedir="." default="build_jar_all_gammaspike" name="BUILD_gammaspike">
<description>
Build gammaspike.
JUnit test is available for this build.
$Id: build_gammaspike.xml $
</description>
<!-- set global properties for this build -->
<property name="gammaspikedir" value="../GammaSpikeModel/" />
<property name="srcgammaspike" location="src" />
<property name="docgammaspike" location="doc" />
<property name="buildgammaspike" location="build" />
<property name="libgammaspike" location="lib" />
<property name="release_dir" value="release" />
<property name="distgammaspike" location="${buildgammaspike}/dist" />
<property name="beast2path" location="../beast2"/>
<property name="libBeast2" location="${beast2path}/lib" />
<property name="srcBeast2" location="${beast2path}/src" />
<property name="beast2classpath" location="${beast2path}/build" />
<property name="Add_on_dir" value="${release_dir}/add-on" />
<import file="${beast2path}/build.xml" />
<property name="main_class_CladeAge" value="beast.app.ca.gammaspikePanel" />
<property name="report" value="${buildgammaspike}/junitreport"/>
<path id="classpath">
<pathelement path="${buildgammaspike}"/>
<fileset dir="${libBeast2}" includes="junit/junit-platform-console-standalone-1.8.2.jar"/>
<fileset dir="${libBeast2}" includes="jam.jar"/>
<fileset dir="${libBeast2}" includes="commons-math3-3.6.1.jar"/>
<pathelement path="${beast2classpath}"/>
<fileset dir="${beast2path}/lib" includes="jam.jar"/>
<fileset dir="${beast2path}/lib" includes="beagle.jar"/>
<fileset dir="${beast2path}/lib" includes="fest.jar"/>
<fileset dir="${beast2path}/lib" includes="colt.jar"/>
<pathelement path="../BeastFX/build"/>
<pathelement path="../sampled-ancestors/build"/>
</path>
<!-- start -->
<target name="initgammaspike">
<echo message="${ant.project.name}: ${ant.file}" />
<available file="${gammaspikedir}/version.xml" property="versionAvailable"/>
<fail unless="versionAvailable">
** Required file version.xml does not exist. **
</fail>
<xmlproperty file="${gammaspikedir}/version.xml" prefix="fromVersionFile" />
<property name="projName" value="${fromVersionFile.package(name)}" />
<property name="gammaspikeversion" value="${fromVersionFile.package(version)}" />
</target>
<target name="cleangammaspike">
<delete dir="${buildgammaspike}" />
</target>
<!-- clean previous build, and then compile Java source code, and Juint test -->
<target name="build_all_gammaspike" depends="cleangammaspike,compile-allgammaspike,junitgammaspike"
description="Clean and Build all run-time stuff">
</target>
<!-- clean previous build, compile Java source code, and Junit test, and make the beast.jar and beauti.jar -->
<target name="build_jar_all_gammaspike" depends="cleangammaspike,compile-allgammaspike,junitgammaspike,dist_all_gammaspike"
description="Clean and Build all run-time stuff">
</target>
<!-- No JUnit Test, clean previous build, compile Java source code, and make the gammaspike.jar and beauti.jar -->
<target name="build_jar_all_gammaspike_NoJUnitTest" depends="cleangammaspike,compile-allgammaspike,dist_all_gammaspike"
description="Clean and Build all run-time stuff">
</target>
<!-- compile Java source code -->
<target name="compile-allgammaspike" depends="initgammaspike,compile-all">
<!-- Capture the path as a delimited property using the refid attribute -->
<property name="myclasspath" refid="classpath"/>
<!-- Emit the property to the ant console -->
<echo message="Classpath = ${myclasspath}"/>
<mkdir dir="${buildgammaspike}" />
<!-- Compile the java code from ${srcgammaspike} into ${buildgammaspike} /bin -->
<javac srcdir="${srcgammaspike}" destdir="${buildgammaspike}" classpathref="classpath"
fork="true"
memoryinitialsize="256m"
memorymaximumsize="256m"
source="1.8"
target="1.8">
<include name="**/**" />
<!-- compile JUnit test classes -->
<include name="test/beast/**" />
</javac>
<copy todir="${buildgammaspike}">
<fileset dir="${srcgammaspike}" includes="**/*.png" />
</copy>
<echo message="Successfully compiled." />
</target>
<!-- make the beast.jar and beauti.jar -->
<target name="dist_all_gammaspike" depends="compile-allgammaspike" description="create gammaspike jar">
<!-- Create the distribution directory -->
<mkdir dir="${distgammaspike}" />
<!-- Put everything in ${buildgammaspike} into the beast.jar file -->
<jar jarfile="${distgammaspike}/gammaspike.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main_class_CladeAge}" />
</manifest>
<fileset dir="${buildgammaspike}">
<include name="**/*.class" />
<include name="**/*.png" />
</fileset>
<fileset dir="${beast2classpath}">
<include name="**/*.class" />
<include name="**/*.properties" />
<include name="**/*.png" />
</fileset>
<zipgroupfileset dir="${libBeast2}" includes="jam.jar" />
<zipgroupfileset dir="${libBeast2}" includes="beagle.jar" />
<zipgroupfileset dir="${libBeast2}" includes="colt.jar" />
<zipgroupfileset dir="${libBeast2}" includes="commons-math3-3.1.1.jar" />
<zipgroupfileset dir="${libBeast2}" includes="antlr-runtime-4.7.jar" />
</jar>
<jar jarfile="${distgammaspike}/gammaspike.src.jar">
<fileset dir="${srcgammaspike}">
<include name="**/*.java" />
<include name="**/*.png" />
<include name="**/*.xsl" />
</fileset>
</jar>
<jar jarfile="${distgammaspike}/gammaspike.package.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
</manifest>
<fileset dir="${buildgammaspike}">
<include name="**/*.png" />
<include name="**/*.class" />
<include name="**/*.class" />
<include name="**/*.properties" />
</fileset>
</jar>
</target>
<!-- run beast.jar -->
<target name="run_gammaspike">
<java jar="${distgammaspike}/gammaspike.jar" fork="true" />
</target>
<!-- JUnit test -->
<target name="junitgammaspike">
<mkdir dir="${report}" />
<junit printsummary="yes"> <!--showoutput='yes'-->
<classpath>
<path refid="classpath" />
<path location="${buildgammaspike}" />
</classpath>
<formatter type="xml" />
<batchtest fork="yes" todir="${report}">
<fileset dir="${srcgammaspike}">
<include name="test/**/*Test.java"/>
</fileset>
<fileset dir="${srcBeast2}">
<include name="test/beast/integration/**/*Test.java"/>
<exclude name="test/beast/integration/**/ResumeTest.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="package"
depends="build_jar_all_gammaspike_NoJUnitTest"
description="release BEAST 2 add-on version of gammaspike">
<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}/doc" />
<mkdir dir="${Add_on_dir}/fxtemplates" />
<mkdir dir="${Add_on_dir}/examples" />
<copy todir="${Add_on_dir}">
<fileset file="version.xml"/>
</copy>
<copy todir="${Add_on_dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${Add_on_dir}/fxtemplates">
<fileset dir="fxtemplates" />
</copy>
<!--
<copy todir="${Add_on_dir}/doc">
<fileset dir="doc" includes="gammaspike.pdf"/>
</copy>
-->
<copy todir="${Add_on_dir}/lib">
<fileset dir="${distgammaspike}" includes="gammaspike.package.jar" />
</copy>
<copy todir="${Add_on_dir}">
<fileset dir="${distgammaspike}" includes="gammaspike.src.jar" />
</copy>
<jar jarfile="${distgammaspike}/gammaspike.package.v${gammaspikeversion}.zip">
<fileset dir="${Add_on_dir}">
<include name="**/*" />
</fileset>
</jar>
<echo message="Add-on version v${gammaspikeversion} release is finished." />
</target>
<!-- Release -->
<property name="version" value="0.0.3" />
<property name="version_number" value="${gammaspikeversion}" />
<property name="release_dirgammaspike" value="release" />
<property name="copyright" value="CladeAge development team 2013" />
<property name="CladeAge_name" value="CladeAge" />
<property name="common_dirgammaspike" value="${release_dirgammaspike}/common" />
<property name="Mac_dirgammaspike" value="${release_dirgammaspike}/Mac" />
<property name="Linux_dirgammaspike" value="${release_dirgammaspike}/Linux" />
<property name="Windows_dirgammaspike" value="${release_dirgammaspike}/Windows" />
<property name="Mac_package_dirgammaspike" value="${Mac_dirgammaspike}/${CladeAge_name}" />
<property name="Linux_package_dirgammaspike" value="${Linux_dirgammaspike}/${CladeAge_name}" />
<property name="Windows_package_dirgammaspike" value="${Windows_dirgammaspike}/${CladeAge_name}" />
<!-- Need to either install Launch4j under {CladeAge workspace}/${release}
or install it in the default directory and change the location of launch4j.dir -->
<target name="windows"
depends="build_jar_all_gammaspike_NoJUnitTest"
description="release Windows version of CladeAge">
<delete dir="${Windows_package_dirgammaspike}" />
<!-- Create the release directory -->
<mkdir dir="${Windows_package_dirgammaspike}" />
<property name="launch4j.dir" location="../../launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar :${launch4j.dir}/lib/xstream.jar" />
<copy file="${distgammaspike}/gammaspike.src.jar" todir="${Windows_package_dirgammaspike}/lib" />
<copy file="${common_dirgammaspike}/VERSION HISTORY.txt" todir="${Windows_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/README.txt" todir="${Windows_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/LICENSE.txt" todir="${Windows_package_dirgammaspike}" />
<!-- CladeAge v?.?.?.exe -->
<launch4j configFile="${Windows_dirgammaspike}/CladeAge_launch4j.xml"
jar="${distgammaspike}/gammaspike.jar"
outfile="${Windows_package_dirgammaspike}/${CladeAge_name}.exe"
fileVersion="${version_number}.0"
txtFileVersion="${gammaspikeversion}"
productVersion="${version_number}.0"
txtProductVersion="${gammaspikeversion}" />
<zip destfile="${Windows_dirgammaspike}/${CladeAge_name} v${gammaspikeversion}.zip">
<zipfileset dir="${Windows_package_dirgammaspike}" prefix="${CladeAge_name}" />
</zip>
<echo message="Windows version release is finished." />
</target>
<target name="linux"
depends="build_jar_all_gammaspike_NoJUnitTest"
description="release Linux/Unix version of CladeAge">
<delete dir="${Linux_package_dirgammaspike}" />
<!-- Create the release directory -->
<mkdir dir="${Linux_package_dirgammaspike}" />
<copy todir="${Linux_package_dirgammaspike}/bin">
<fileset dir="${Linux_dirgammaspike}/bin" />
</copy>
<chmod dir="${Linux_package_dirgammaspike}/bin" perm="755" includes="**/**" />
<copy file="${distgammaspike}/gammaspike.jar" todir="${Linux_package_dirgammaspike}/lib" />
<copy file="${distgammaspike}/gammaspike.src.jar" todir="${Linux_package_dirgammaspike}/lib" />
<copy file="${common_dirgammaspike}/icons/gammaspike.png" todir="${Linux_package_dirgammaspike}/images" />
<copy file="${common_dirgammaspike}/VERSION HISTORY.txt" todir="${Linux_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/README.txt" todir="${Linux_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/LICENSE.txt" todir="${Linux_package_dirgammaspike}" />
<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.3.v201301120609/lib" />
<target name="mac"
depends="build_jar_all_gammaspike_NoJUnitTest"
description="release Mac version of CladeAge">
<delete dir="${Mac_package_dirgammaspike}" />
<delete file="${Mac_dirgammaspike}/pack.temp.dmg"/>
<delete file="${Mac_dirgammaspike}/CladeAge v${gammaspikeversion}.dmg"/>
<!-- Create the release directory -->
<mkdir dir="${Mac_package_dirgammaspike}" />
<copy todir="${Mac_package_dirgammaspike}/bin">
<fileset dir="${Linux_dirgammaspike}/bin" />
</copy>
<chmod dir="${Mac_package_dirgammaspike}/bin" perm="755" includes="**/**" />
<copy file="${distgammaspike}/gammaspike.jar" todir="${Mac_package_dirgammaspike}/lib" />
<copy file="${distgammaspike}/gammaspike.src.jar" todir="${Mac_package_dirgammaspike}/lib" />
<copy file="${common_dirgammaspike}/VERSION HISTORY.txt" todir="${Mac_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/README.txt" todir="${Mac_package_dirgammaspike}" />
<copy file="${common_dirgammaspike}/LICENSE.txt" todir="${Mac_package_dirgammaspike}" />
<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_dirgammaspike}"
name="${CladeAge_name}"
mainclass="${main_class_CladeAge}"
icon="${common_dirgammaspike}/icons/gammaspike.icns"
jvmversion="1.8+"
vmoptions="-Xmx1024M"
arguments="-window -working -options"
version="${gammaspikeversion}"
infostring="${CladeAge_name}, ${copyright}"
bundleid="${main_class_CladeAge}">
<jarfileset dir="${Mac_package_dirgammaspike}/lib">
<include name="**/gammaspike.jar" />
</jarfileset>
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
<javaproperty name="java.library.path" value="$JAVAROOT:/usr/local/lib" />
</jarbundler>
<echo message="Building disk image." />
<exec executable='release/Mac/createdmg.sh'/>
<echo message="Mac version release is finished." />
</target>
<condition property="isWindows"><os family="windows" /></condition>
<condition property="isLinux"><and><os family="unix"/><not><os family="mac"/></not></and></condition>
<condition property="isMac"><os family="mac" /></condition>
<target name="installLinux" depends="package" if="isLinux">
<mkdir dir="${user.home}/.beast/2.7/${projName}"/>
<unzip src="${distgammaspike}/gammaspike.package.v${gammaspikeversion}.zip" dest="${user.home}/.beast/2.7/${projName}"/>
</target>
<target name="installMac" depends="package" if="isMac">
<mkdir dir="${user.home}/.beast/2.7/${projName}"/>
<unzip src="${distgammaspike}/gammaspike.package.v${gammaspikeversion}.zip" dest="${user.home}/Library/Application Support/BEAST/2.7/${projName}"/>
</target>
<target name="installWindows" depends="package" if="isWindows">
<mkdir dir="${user.home}/BEAST/2.7/${projName}"/>
<unzip src="${distgammaspike}/gammaspike.package.v${gammaspikeversion}.zip" dest="${user.home}/BEAST/2.7/${projName}"/>
</target>
<target name="install" depends="installWindows,installMac,installLinux">
</target>
</project>