-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
423 lines (354 loc) · 18.4 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<project name="eurocarb-glycoworkbench" default="build">
<!--
! this import defines the following:
!
! 1) 'project.*' properties
! 2) 'project.classpath' path, containing all external and eurocarb-compiled jars.
! 3) 'build-XXX' tasks, where 'XXX' is the name of a sub-project
!
-->
<import file="../../build.common.xml" />
<!-- ========= PROPERTIES ======== -->
<property name="java.source.dir" value="${basedir}/src" />
<property name="java.build.dir" value="${basedir}/build" />
<property name="java.extlib.dir" value="${project.java.extlib.dir}" />
<property name="doc.dir" value="${basedir}/doc" />
<property name="apidoc.dir" value="${doc.dir}/api" />
<property name="java.dist.dir" value="${project.java.lib.dir}" />
<property name="applet.dist.dir" value="${project.binary.dir}" />
<property name="gwb.dist" value="${basedir}/dist-zip/" />
<property name="gwb.dist.zip.dir" value="${gwb.dist}/gwb" />
<property name="gwb.artwork" value="${basedir}/artwork" />
<property name="gwb.icon" value="${gwb.artwork}/GlycoWorkbench.ico" />
<!-- ==NSIS== Windows/Unix examples -->
<!--<property name="nsis.location" value="C:\Program Files (x86)\NSIS\makensis.exe" />-->
<property name="nsis.location" value="/home/gwb/runtime/nsis-2.46/makensis.exe" />
<!-- ==WinRun4J== -->
<property name="static_import.dir" value="${basedir}/static_import" />
<property name="winrun4j.dir" value="${static_import.dir}/winrun4j/" />
<property name="winrun4j.exe.32" value="${winrun4j.dir}/bin/WinRun4J.exe" />
<property name="winrun4j.exe.64" value="${winrun4j.dir}/bin/WinRun4J64.exe" />
<property name="winrun4j.url" value="http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/w/project/wi/winrun4j/winrun4j/0.4.3/winrun4J-0.4.3.zip" />
<!-- ==PACKAGE LOCATIONS== -->
<property name="gwb.packages.dir" value="${basedir}/packages" />
<property name="gwb.packages.win.dir" value="${basedir}/packages/windows" />
<property name="gwb.packages.lin.dir" value="${basedir}/packages/linux" />
<property name="gwb.packages.mac.dir" value="${basedir}/packages/macosx" />
<!-- ==Windows packages== -->
<property name="gwb.win.zip.x86" value="${gwb.packages.win.dir}/GlycoWorkbenchWin_x86.zip" />
<property name="gwb.win.zip.x86_64" value="${gwb.packages.win.dir}/GlycoWorkbenchWin_x86-64.zip" />
<property name="gwb.win.setup.x86" value="${gwb.packages.win.dir}/GlycoWorkbenchWin_x86.exe" />
<property name="gwb.win.setup.x86_64" value="${gwb.packages.win.dir}/GlycoWorkbenchWin_x86-64.exe" />
<!-- ==Linux packages== -->
<property name="gwb.lin.zip.x86" value="${gwb.packages.lin.dir}/GlycoWorkbenchLin_x86.zip" />
<property name="gwb.lin.zip.x86-64" value="${gwb.packages.lin.dir}/GlycoWorkbenchLin_x86-64.zip" />
<!-- ==Mac packages== -->
<property name="gwb.mac.wrapper.dir" value="${basedir}/mac_wrappers" />
<property name="gwb.mac.wrapper.32" value="${gwb.mac.wrapper.dir}/GlycoWorkbenchMac_32.jar" />
<property name="gwb.mac.wrapper.64" value="${gwb.mac.wrapper.dir}/GlycoWorkbenchMac_64.jar" />
<property name="gwb.mac.carbon.32" value="${gwb.packages.mac.dir}/GlycoWorkbenchMac_Carbon_32.zip" />
<property name="gwb.mac.cocoa.32" value="${gwb.packages.mac.dir}/GlycoWorkbenchMac_Cocoa_32.zip" />
<property name="gwb.mac.cocoa.x86-64" value="${gwb.packages.mac.dir}/GlycoWorkbenchMac_Cocoa_x86-64.zip" />
<!-- ========WinRun4J======== -->
<property name="gwb.exe.dir" value="${basedir}/executables" />
<property name="gwb.win.x86.exe" value="${gwb.exe.dir}/GlycoWorkbench_x86.exe" />
<property name="gwb.win.x86-64.exe" value="${gwb.exe.dir}/GlycoWorkbench_x86-64.exe" />
<property name="gwb.winrun4j.ini" value="${gwb.exe.dir}/GlycoWorkbench_x86.ini" />
<!-- ========TARGETS======== -->
<!-- ==TARGET: build== -->
<target name="build" depends="build-resourcesdb, build-molframework, build-glycanbuilder, build-glycopeakfinder" description="Buld GlycoWorkbench and all dependencies">
<echo>Building Resources-DB, Molecular Framework, GlycanBuilder and GlycoPeakFinder</echo>
<mkdir dir="${java.build.dir}" />
<javac srcdir="${java.source.dir}" destdir="${java.build.dir}" debug="on" deprecation="on">
<classpath refid="project.classpath" />
</javac>
</target>
<!-- ==TARGET: clean== -->
<target name="clean" depends="">
<echo>Cleaning ${ant.project.name}</echo>
<delete includeemptydirs="true">
<fileset dir="${java.build.dir}" includes="**/*" />
</delete>
</target>
<!-- ==TARGET: copy-resources== -->
<target name="copy-resources" depends="">
<copy todir="${java.build.dir}">
<fileset dir="${java.source.dir}">
<exclude name="**/*.java" />
<exclude name="manifest.mf" />
</fileset>
</copy>
</target>
<!-- ==TARGET: dist== -->
<target name="dist" depends="build,copy-resources">
<manifestclasspath jarfile="${java.dist.dir}/${project.glycoworkbench.jar}" property="manifest.class.path">
<classpath refid="project.glycoworkbench.classpath" />
</manifestclasspath>
<jar destfile="${java.dist.dir}/${project.glycoworkbench.jar}">
<fileset dir="${java.build.dir}" excludes="**/*.bak" />
<manifest>
<attribute name="Main-Class" value="org.eurocarbdb.application.glycoworkbench.GlycoWorkbenchSafeWrapper" />
<attribute name="Class-Path" value="${manifest.class.path}" />
</manifest>
</jar>
</target>
<!-- ==clean-dist-zip== -->
<target name="clean-dist-zip" depends="">
<delete dir="${gwb.dist.zip.dir}" />
<mkdir dir="${gwb.dist.zip.dir}" />
</target>
<!-- ==dist-applet== (where is this used)-->
<target name="dist-applet" depends="build,copy-resources">
<jar destfile="${applet.dist.dir}/${project.glycoworkbench.applet.jar}">
<manifest>
<attribute name="Main-Class" value="org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet" />
</manifest>
<fileset dir="${java.build.dir}" includes="conf/**" excludes="**/*.xml" />
<fileset dir="${java.build.dir}" includes="cursors/**" />
<fileset dir="${java.build.dir}" includes="icons/**" />
<fileset dir="${java.build.dir}" includes="**/*.class" />
<zipfileset src="${java.extlib.dir}/swing-layout-1.0.jar" />
<zipfileset src="${java.extlib.dir}/jfreechart-1.0.9.jar" />
<zipfileset src="${java.extlib.dir}/jcommon-1.0.12.jar" />
<zipfileset src="${java.extlib.dir}/log4j-1.2.12.jar" />
</jar>
</target>
<!-- ==fetch-winrun4j== -->
<target name="fetch-winrun4j">
<if>
<available file="${winrun4j.exe.32}" />
<then>
<echo>Found WinRun4j, remove ${winrun4j.exe.32} to force it to be fetched again</echo>
</then>
<else>
<mkdir dir="${project.dir}/temp"/>
<get dest="${project.temp.dir}/winrun4j.zip" src="${winrun4j.url}" />
<delete dir="${static_import.dir}" />
<mkdir dir="${static_import.dir}" />
<unzip src="${project.temp.dir}/winrun4j.zip" dest="${static_import.dir}" />
<delete dir="${project.dir}/temp"/>
</else>
</if>
</target>
<!-- ==build-win-exe-winrun4j==
Simply copies the WinRun4J and updates the embedded icon
TODO: Add a wine script, if possible to run on Unix
-->
<target name="build-win-exe-winrun4j" depends="fetch-winrun4j">
<mkdir dir="${gwb.exe.dir}" />
<delete file="${gwb.win.x86.exe}" />
<delete file="${gwb.win.x86-64.exe}" />
<copy file="${winrun4j.exe.32}" tofile="${gwb.win.x86.exe}" />
<copy file="${winrun4j.exe.64}" tofile="${gwb.win.x86-64.exe}" />
<exec executable="cmd">
<arg value="/C .\winrun4j\update_icon.bat" />
</exec>
</target>
<!-- ==dist-common== -->
<target name="dist-common" depends="build,copy-resources">
<mkdir dir="${gwb.dist.zip.dir}/lib" />
<copy file="${java.dist.dir}/${project.glycanbuilder.jar}" tofile="${gwb.dist.zip.dir}/lib/${project.glycanbuilder.jar}" />
<copy file="${java.dist.dir}/${project.molframework.jar}" tofile="${gwb.dist.zip.dir}/lib/${project.molframework.jar}" />
<copy file="${java.dist.dir}/${project.resourcesdb.jar}" tofile="${gwb.dist.zip.dir}/lib/${project.resourcesdb.jar}" />
<copy file="${java.dist.dir}/${project.glycopeakfinder.jar}" tofile="${gwb.dist.zip.dir}/lib/${project.glycopeakfinder.jar}" />
<copy file="${project.flamingo.jar}" todir="${gwb.dist.zip.dir}/lib" />
<copy file="${project.flamingo-tst.jar}" todir="${gwb.dist.zip.dir}/lib" />
<copy file="${basedir}/LICENSE.txt" tofile="${gwb.dist.zip.dir}/LICENSE.txt" />
<copy file="${basedir}/README.txt" tofile="${gwb.dist.zip.dir}/README.txt" />
<copy todir="${gwb.dist.zip.dir}/lib">
<fileset dir="${java.extlib.dir}" includes="ant-launcher* swing-layout*,batik*,avalon-framework*,commons-codec*,commons-io*,commons-logging*,fop*,Help*,javahelp*,jaxen*,jcommon*,jdesktop*,jdom*,jfreechart*,jrap-jdk15*,jsr107cache*,log4j*,plugin*,ProteomeCommons*,xercesImpl*,xml-apis-ext*,xmlgraphics-common*" />
</copy>
<copy todir="${gwb.dist.zip.dir}/lib">
<fileset dir="${java.extlib.dir}/prefetched" includes="DJNativeSwing.jar,DJNativeSwing-SWT.jar,looks-2.3.1.jar,substance*,trident.jar" />
</copy>
<copy todir="${gwb.dist.zip.dir}/lib">
<fileset dir="${java.extlib.dir}/prefetched/" includes="jets* BareBones* commons-codec-* commons-httpclient-* commons-logging-* java-xmlbuilder-1* jna.jar wggds.jar" />
</copy>
<copy todir="${gwb.dist.zip.dir}/examples">
<fileset dir="${basedir}/examples" />
</copy>
<copy todir="${gwb.dist.zip.dir}">
<fileset dir="${basedir}/" id="www">
<include name="www/**" />
</fileset>
</copy>
<copy todir="${gwb.dist.zip.dir}/gwb/icons">
<fileset dir="${basedir}/resources/gwb/icons" id="icons">
<include name="**" />
</fileset>
</copy>
<copy file="${gwb.artwork}/glycoworkbench.png" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.png" />
<copy file="${gwb.artwork}/GlycoWorkbench.gif" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.gif" />
</target>
<!-- ==dist-all== -->
<target name="dist-all" depends="clean-packages,dist-win,dist-mac,dist-lin" description="Build packages for Mac OSX, Linux and Windows">
</target>
<!-- ==clean-packages== -->
<target name="clean-packages">
<delete dir="${gwb.packages.dir}" />
<mkdir dir="${gwb.packages.win.dir}" />
<mkdir dir="${gwb.packages.mac.dir}" />
<mkdir dir="${gwb.packages.lin.dir}" />
</target>
<!-- ==dist-win==
Summary: Build complete zip archive for deployment on windows family systems.
Description:
a)Eurocarb libs are first updated if the local source code has been changed.
b)Generic components are then assembled.
c)Launch4j is downloaded if it can't be found.
d)A windows executable is created.
e)Windows specific resources are added to the generic components.
d)All resources are zipped up.
-->
<target name="dist-win" depends="clean-packages,clean-dist-zip,dist-runnable" description="Build Windows packages">
<!-- common -->
<copy overwrite="true" file="${basedir}/WIN_README.txt" tofile="${gwb.dist.zip.dir}/README.txt" />
<copy file="${gwb.artwork}/glycoworkbench.bmp" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.bmp" />
<copy file="${gwb.artwork}/GlycoWorkbench.ico" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.ico" />
<copy file="${gwb.artwork}/gwb_icon.bmp" tofile="${gwb.dist.zip.dir}/gwb_icon.bmp" />
<copy overwrite="true" file="${gwb.winrun4j.ini}" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.ini" />
<!-- x86 -->
<copy overwrite="true" file="${gwb.win.x86.exe}" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.exe" />
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/win-swt_x86.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<zip destfile="${gwb.win.zip.x86}" basedir="${gwb.dist}" />
<antcall target="dist-win-installer">
</antcall>
<copy overwrite="true" file="${basedir}/Setup.exe" tofile="${gwb.win.setup.x86}" />
<!-- x86-64 -->
<copy overwrite="true" file="${gwb.win.x86-64.exe}" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.exe" />
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/win-swt_x86-64.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<zip destfile="${gwb.win.zip.x86_64}" basedir="${gwb.dist}" />
<antcall target="dist-win-installer">
</antcall>
<copy overwrite="true" file="${basedir}/Setup.exe" tofile="${gwb.win.setup.x86_64}" />
</target>
<!-- ==dist-win-installer== -->
<target name="dist-win-installer">
<echo>Compiling NSIS installer for Windows</echo>
<echo>NSIS script created with http://hmne.sourceforge.net/</echo>
<exec dir="${basedir}" executable="${nsis.location}" osFamily="windows">
<arg value="${basedir}/winInstaller.nsi" />
</exec>
<exec dir="${basedir}" executable="wine" osFamily="unix">
<arg value="${nsis.location}" />
<arg value="winInstaller.nsi" />
</exec>
</target>
<!-- ==dist-lin== -->
<target name="dist-lin" depends="clean-packages,clean-dist-zip,dist-runnable" description="Build Linux distribution packages">
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/lin-swt_x86.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<zip destfile="${gwb.lin.zip.x86}" basedir="${gwb.dist}" />
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/lin-swt_x86-64.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<zip destfile="${gwb.lin.zip.x86-64}" basedir="${gwb.dist}" />
</target>
<!-- ==dist-mac== -->
<target name="dist-mac" depends="clean-packages,clean-dist-zip,dist-runnable,dist-mac-wrappers" description="Build Mac OSX packages">
<!-- 32bit builds -->
<copy overwrite="true" file="${gwb.mac.wrapper.32}" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.jar" />
<!-- carbon-32-->
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/mac-carbon-swt_32.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<copy overwrite="true" file="${gwb.exe.dir}/mac_32.sh" tofile="${gwb.dist.zip.dir}/start.sh" />
<zip destfile="${gwb.mac.carbon.32}" basedir="${gwb.dist}" />
<!-- cocoa-32 -->
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/mac-cocoa-swt_32.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<copy overwrite="true" file="${gwb.exe.dir}/mac_32.sh" tofile="${gwb.dist.zip.dir}/start.sh" />
<zip destfile="${gwb.mac.cocoa.32}" basedir="${gwb.dist}" />
<!-- cocoa-x86-64 -->
<copy overwrite="true" file="${gwb.mac.wrapper.64}" tofile="${gwb.dist.zip.dir}/GlycoWorkbench.jar" />
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/mac-cocoa-swt_x86-64.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<copy overwrite="true" file="${gwb.exe.dir}/mac_64.sh" tofile="${gwb.dist.zip.dir}/start.sh" />
<zip destfile="${gwb.mac.cocoa.x86-64}" basedir="${gwb.dist}" />
</target>
<target name="dist-mac-wrappers" depends="build">
<mkdir dir="${gwb.mac.wrapper.dir}" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="compile.classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="lib/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${gwb.mac.wrapper.32}" basedir="${java.build.dir}">
<manifest>
<attribute name="Class-Path" value="${manifest.classpath} ${project.glycoworkbench.jar}" />
<attribute name="Main-Class" value="org.eurocarbdb.application.glycoworkbench.launchers.MacWrapper32" />
</manifest>
</jar>
<jar destfile="${gwb.mac.wrapper.64}" basedir="${java.build.dir}">
<manifest>
<attribute name="Class-Path" value="${manifest.classpath} ${project.glycoworkbench.jar}" />
<attribute name="Main-Class" value="org.eurocarbdb.application.glycoworkbench.launchers.MacWrapper64" />
</manifest>
</jar>
</target>
<!-- ==dist-runnable== -->
<target name="dist-runnable" depends="dist-common">
<path id="compile.classpath">
<fileset dir="${gwb.dist.zip.dir}/lib/" includes="*.jar" />
</path>
<copy overwrite="true" file="${project.java.extlib.dir}/prefetched/win-swt_x86.jar" tofile="${gwb.dist.zip.dir}/lib/swt.jar" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="compile.classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="lib/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${gwb.dist.zip.dir}/${project.glycoworkbench.jar}" basedir="${java.build.dir}">
<manifest>
<attribute name="Class-Path" value="${manifest.classpath} ${project.glycoworkbench.jar}" />
<attribute name="Main-Class" value="org.eurocarbdb.application.glycoworkbench.GlycoWorkbenchSafeWrapper" />
<attribute name="SplashScreen-Image" value="GlycoWorkbench.png" />
</manifest>
<fileset dir="${gwb.dist.zip.dir}" includes="GlycoWorkbench.png" />
</jar>
</target>
<!-- ==TARGET: build-apidocs== -->
<target name="build-apidocs" depends="build" description="Creates javadoc from sources in src/ and the core API">
<echo>Building GlycanBuilder API documentation</echo>
<delete dir="${apidoc.dir}" />
<mkdir dir="${apidoc.dir}" />
<javadoc destdir="${apidoc.dir}" Author="true" Use="true" Version="true" linksource="true" stylesheetfile="${project.coreapi.dir}/doc/eurocarb_apidoc.css" windowtitle="GlycoWorkbench API" doctitle="GlycoWorkbench API">
<classpath>
<path refid="project.classpath" />
</classpath>
<sourcepath>
<pathelement path="${java.source.dir}" />
</sourcepath>
<!-- link to java stdlib API -->
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
<!-- link to hibernate API -->
<link href="https://www.hibernate.org/hib_docs/v3/api/" />
<!-- link to webwork API -->
<link href="http://www.opensymphony.com/webwork/api/" />
<!-- link to commons logging -->
<link href="http://commons.apache.org/logging/apidocs/" />
<!-- link to google collections -->
<link href="http://google-collections.googlecode.com/svn/trunk/javadoc/" />
<!-- link to ANTLR API, grammar/parser generator -->
<link href="http://www.antlr2.org/javadoc/" />
<!-- link to TestNG API, unit testing framework -->
<link href="http://testng.org/javadocs/" />
<!-- link to eurocarb core API -->
<link href="../../../../core-api/doc/api/" />
<!-- other eurocarb projects -->
<link href="../../../ResourcesDB/doc/api/" />
<link href="../../../GlycanBuilder/doc/api/" />
<link href="../../../MolecularFramework/doc/api/" />
</javadoc>
<echo>See ${apidoc.dir} for generated javadoc</echo>
<exec executable="open" os="Mac OS X">
<arg value="${apidoc.dir}/index.html" />
</exec>
</target>
<!-- ==run== (deprecated, without a good reason for it's existence-->
<target name="run" depends="build,copy-resources">
<java classname="org.eurocarbdb.application.glycoworkbench.GlycoWorkbenchSafeWrapper" fork="yes">
<classpath refid="project.classpath" />
</java>
</target>
</project>