-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
308 lines (276 loc) · 12.7 KB
/
Copy pathbuild.xml
File metadata and controls
308 lines (276 loc) · 12.7 KB
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
<?xml version="1.0"?>
<project name="PGKB PathVisio Plugin Builder" basedir=".">
<description>
Builds the pgkb-pathvisio-plugin OSGi bundle and the PGKB PathVisio distribution.
Fully self-contained - can be run standalone (`cd pgkb-pathvisio-plugin && ant dist`)
or via the root build.xml's thin delegating targets (<ant dir="pgkb-pathvisio-plugin" .../>).
</description>
<property environment="env" />
<property name="build.debug" value="true" />
<property name="build.debuglevel" value="source,lines,vars" />
<property name="build.optimize" value="off" />
<property name="build.deprecation" value="off" />
<tstamp>
<format property="build.timestamp.gmt" pattern="EEE, d MMM yyyy HH:mm:ss zzz" timezone="GMT" />
<format property="build.yearMonthDay" pattern="yyyy-MM-dd" />
<format property="build.year" pattern="yyyy" />
</tstamp>
<exec executable="cmd" outputproperty="build.release" resultproperty="build.release.exit" osfamily="windows">
<arg value="/c" />
<arg value="git describe --tags" />
</exec>
<exec executable="git" outputproperty="build.release" resultproperty="build.release.exit" osfamily="unix">
<arg line="describe --tags" />
</exec>
<fail message="'git describe --tags' failed (exit ${build.release.exit}) - build.release is unusable. Ensure this is a git checkout with at least one tag reachable.">
<condition>
<not>
<equals arg1="${build.release.exit}" arg2="0" />
</not>
</condition>
</fail>
<property name="dir.pvPlugin" value="${basedir}" />
<property name="dir.pvPlugin.lib" value="${dir.pvPlugin}/lib" />
<property name="dir.pvPlugin.src" value="${dir.pvPlugin}/src/main/java" />
<property name="dir.pvPlugin.res" value="${dir.pvPlugin}/src/main/resources" />
<property name="dir.pvPlugin.test.src" value="${dir.pvPlugin}/src/test/java" />
<property name="dir.pvPlugin.test.res" value="${dir.pvPlugin}/src/test/resources" />
<property name="dir.build.pv" value="${basedir}/build" />
<property name="dir.dist" value="${dir.build.pv}/dist" />
<property name="pgkb.pvPlugin.jar" value="pgkb-pv-plugin.jar" />
<property name="pv.classes" value="${dir.build.pv}/classes" />
<path id="pvPlugin.classpath">
<fileset dir="${dir.pvPlugin.lib}" includes="*.jar" />
</path>
<target name="config" description="Sets up the PathVisio build classes dir and timestamp">
<mkdir dir="${pv.classes}/org/pharmgkb/pathvisio/plugin" />
<echo message="${build.timestamp.gmt}" encoding="UTF-8"
file="${pv.classes}/org/pharmgkb/pathvisio/plugin/timestamp.txt" />
<echo message="${build.release}" encoding="UTF-8"
file="${pv.classes}/org/pharmgkb/pathvisio/plugin/version.txt" />
</target>
<target name="compile" depends="config" description="Compiles pgkb-pathvisio-plugin">
<mkdir dir="${pv.classes}" />
<echo message="Compiling pgkb-pathvisio-plugin" />
<javac srcdir="${dir.pvPlugin.src}" destdir="${pv.classes}"
release="8"
classpathref="pvPlugin.classpath"
includeantruntime="false"
debug="${build.debug}"
debuglevel="${build.debuglevel}"
optimize="${build.optimize}"
deprecation="${build.deprecation}"
encoding="UTF-8"
fork="true" />
<!-- copy resources to the same location as .class files -->
<copy todir="${pv.classes}">
<fileset dir="${dir.pvPlugin.res}" />
</copy>
</target>
<target name="compile-test" depends="compile" description="Compiles pgkb-pathvisio-plugin tests">
<property name="pv.testClasses" value="${dir.build.pv}/test-classes" />
<mkdir dir="${pv.testClasses}" />
<javac srcdir="${dir.pvPlugin.test.src}" destdir="${pv.testClasses}"
release="8"
includeantruntime="false"
debug="${build.debug}"
debuglevel="${build.debuglevel}"
optimize="${build.optimize}"
deprecation="${build.deprecation}"
encoding="UTF-8"
fork="true">
<compilerarg line="-parameters" />
<classpath>
<path refid="pvPlugin.classpath" />
<pathelement location="${pv.classes}" />
<pathelement location="${pv.testClasses}" />
</classpath>
</javac>
<copy todir="${pv.testClasses}">
<fileset dir="${dir.pvPlugin.test.res}" />
</copy>
</target>
<target name="test" depends="compile-test" description="Runs pgkb-pathvisio-plugin tests">
<property name="pvTestReportDir" value="${dir.build.pv}/test-reports" />
<mkdir dir="${pvTestReportDir}" />
<junitlauncher haltonfailure="true" printsummary="on">
<classpath>
<pathelement location="${pv.classes}" />
<pathelement location="${pv.testClasses}" />
<path refid="pvPlugin.classpath" />
</classpath>
<testclasses outputdir="${pvTestReportDir}">
<fork includeJUnitPlatformLibraries="true" includeAntRuntimeLibraries="true" />
<fileset dir="${pv.testClasses}">
<include name="org/pharmgkb/pathvisio/**/*Test*.class" />
</fileset>
<listener type="legacy-xml" sendSysErr="false" sendSysOut="false" />
</testclasses>
</junitlauncher>
</target>
<target name="jar" depends="compile" description="Creates ${pgkb.pvPlugin.jar}">
<mkdir dir="${dir.dist}" />
<echo message="Building PGKB PathVisio jar file" />
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${dir.pvPlugin.lib}/build/bnd.jar" />
<bnd output="${dir.build.pv}/${pgkb.pvPlugin.jar}"
classpath="${pv.classes}"
eclipse="false"
failok="false"
exceptions="true"
files="${dir.pvPlugin}/ant.bnd" />
</target>
<target name="dist" depends="jar" description="Builds the PGKB PathVisio distribution">
<echo>Building PathVisio plugin</echo>
<copy file="${pv.classes}/org/pharmgkb/pathvisio/plugin/timestamp.txt"
tofile="${dir.dist}/pgkb-pathvisio.timestamp.txt" />
<!-- Recreate staging so the distribution always uses the committed JARs. -->
<delete dir="${dir.build.pv}/jar" />
<unzip src="${dir.pvPlugin.lib}/build/pathvisio.jar" dest="${dir.build.pv}/jar" />
<!-- add plugin and OSGI-aware jar files -->
<copy todir="${dir.build.pv}/jar">
<fileset file="${dir.build.pv}/${pgkb.pvPlugin.jar}" />
<fileset dir="${dir.pvPlugin.lib}">
<!-- guava -->
<include name="guava.jar" />
<include name="failureaccess.jar" />
<!-- GSON -->
<include name="gson.jar" />
<!-- Commons Libraries -->
<include name="commons-beanutils.jar" />
<include name="commons-codec.jar" />
<include name="commons-collections.jar" />
<include name="commons-email.jar" />
<include name="commons-io.jar" />
<include name="commons-lang3.jar" />
<include name="commons-text.jar" />
<include name="joda-time.jar" />
<!-- HttpComponents -->
<include name="httpclient.jar" />
<include name="httpcore.jar" />
<!-- SLF4J, Logback and Log4J -->
<include name="slf4j-api.jar" />
<include name="jcl-over-slf4j.jar" />
<include name="jul-to-slf4j.jar" />
<include name="log4j-over-slf4j.jar" />
<include name="logback-classic.jar" />
<include name="logback-core.jar" />
<include name="log4j-api.jar" />
<include name="log4j-to-slf4j.jar" />
<!-- Misc -->
<include name="javax.mail.jar" />
<include name="jakarta.xml.bind-api.jar" />
<include name="jspecify.jar" />
<include name="stax2-api.jar" />
</fileset>
<fileset dir="${dir.pvPlugin.lib}">
<!-- formerly pgkb-core-pv/lib -->
<include name="collections-generic.jar" />
<include name="jdom.jar" />
<include name="jena-arq.jar" />
<include name="jena-core.jar" />
<include name="jena-iri.jar" />
<include name="org.bridgedb.bio.jar" />
<include name="org.bridgedb.jar" />
<include name="org.pathvisio.core.jar" />
<include name="paxtools-core.jar" />
<!-- OSGi support -->
<include name="asm.jar" />
<include name="asm-*.jar" />
<include name="org.apache.aries.spifly.dynamic.bundle.jar" />
<include name="org.apache.felix.configadmin.jar" />
</fileset>
</copy>
<!-- create final pathvisio.jar -->
<property name="pv.name" value="PGKB PathVisio" />
<jar destfile="${dir.build.pv}/pathvisio.jar" basedir="${dir.build.pv}/jar">
<manifest>
<attribute name="Main-Class" value="org.pathvisio.launcher.PathVisioMain" />
<attribute name="Permissions" value="all-permissions" />
<attribute name="Codebase" value="www.pathvisio.org" />
<attribute name="Application-Name" value="${pv.name}" />
</manifest>
</jar>
<echo>Building PGKB PathVisio distribution for Windows</echo>
<zip destfile="${dir.dist}/pgkb-pathvisio.zip">
<zipfileset prefix="pgkb-pathvisio" file="${dir.build.pv}/pathvisio.jar" />
<zipfileset prefix="pgkb-pathvisio" dir="${dir.pvPlugin}/bin" filemode="755">
<include name="pathvisio.bat" />
<include name="pathvisio.sh" />
</zipfileset>
</zip>
</target>
<target name="unpack-dist" depends="dist"
description="Unpacks the PGKB PathVisio distribution into the build directory">
<unzip src="${dir.dist}/pgkb-pathvisio.zip" dest="${dir.build.pv}" overwrite="true" />
</target>
<!-- this target only works on macOS; meant for local use -->
<target name="pathvisio-mac" depends="dist, pathvisio-mac-bundle"
description="Build full PGKB PathVisio app for Mac; must be run on macOS">
</target>
<!-- this target only works on macOS; meant for use in CI -->
<target name="pathvisio-mac-bundle"
description="Bundle full PGKB PathVisio app for Mac; must be run on macOS">
<echo>Bundling full Mac app</echo>
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"
classpath="${dir.pvPlugin.lib}/build/appbundler.jar" />
<property name="pv.name" value="PGKB PathVisio" />
<property name="pv.executableName" value="JavaApplicationStub" />
<property name="pv.iconName" value="pgkb-pathvisio.icns" />
<property name="pv.appDir" value="${dir.build.pv}/${pv.name}.app" />
<bundleapp outputdirectory="${dir.build.pv}"
jvmrequired="1.8"
name="${pv.name}"
displayname="${pv.name}"
executableName="${pv.executableName}"
icon="${dir.pvPlugin.res}/${pv.iconName}"
identifier="org.pathvisio.launcher.PathVisioMain"
shortVersion="${build.yearMonthDay}"
version="${build.release}"
mainclassname="org/pathvisio/launcher/PathVisioMain"
copyright="${build.year} PharmGKB"
applicationCategory="public.app-category.developer-tools"
>
<runtime dir="${env.JAVA_HOME}" />
<classpath file="${dir.build.pv}/pathvisio.jar" />
<!-- uncomment to enable remote debugging -->
<!--
<option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" />
-->
<!-- OS X specific options -->
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=${pv.name}"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dfile.encoding=UTF-8"/>
<!-- Workaround as com.apple.mrj.application.apple.menu.about.name property may no longer work -->
<option value="-Xdock:name=${pv.name}"/>
<!-- bundleapp's icon parameter above will get the file to the right place,
and this will make it show up in the dock (this is a workaround for a JavaAppLauncher bug)
-->
<option value="-Xdock:icon=$APP_ROOT/Contents/Resources/${pv.iconName}"/>
<option value="-Xmx1024M" name="Xmx"/>
<!-- register the application as an editor for .gpml files -->
<bundledocument extensions="gpml"
icon="$APP_ROOT/Contents/Resources/${pv.iconName}"
name="GPML"
role="editor">
</bundledocument>
</bundleapp>
<exec executable="${dir.pvPlugin}/bin/strip_jvmruntime.sh">
<arg value="${pv.appDir}" />
</exec>
<copy todir="${pv.appDir}/Contents/MacOS" overwrite="true">
<file file="${dir.pvPlugin}/bin/JavaApplicationStub" />
</copy>
<zip destfile="${dir.dist}/pgkb-pathvisio.app.full.zip">
<zipfileset prefix="${pv.name}.app" dir="${pv.appDir}">
<exclude name="Contents/MacOS/${pv.executableName}" />
</zipfileset>
<zipfileset prefix="${pv.name}.app/Contents/MacOS" file="${pv.appDir}/Contents/MacOS/${pv.executableName}"
filemode="755" />
</zip>
<delete dir="${pv.appDir}" />
</target>
</project>