-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.xml
More file actions
399 lines (309 loc) · 15.4 KB
/
build.xml
File metadata and controls
399 lines (309 loc) · 15.4 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
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="JSwingPlus" default="compile" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:doxygen="antlib:org.doxygen.tools">
<!-- convention-based folder locations -->
<property name="build" location="build"/>
<property name="src" location="src"/>
<property name="docs" location="docs"/>
<property name="distrib" location="distrib"/>
<property name="lib" location="lib"/>
<!-- compiler properties -->
<property name="classVersion" value="1.7"/>
<property name="verbosity" value="false"/>
<property name="debugClassFiles" value="on"/>
<!-- javac properties -->
<property name="myjvmargs" value=""/>
<!-- project properties -->
<property name="version" value="1.01"/>
<!-- jar file construction properties -->
<property name="jarFileName" value="${ant.project.name}-${version}"/>
<property name="jarCompress" value="false"/>
<property name="manifestClassPath" value="."/>
<property name="dataset" value="distData"/>
<property name="exampleJarFileName" value="${ant.project.name}-examples-${version}"/>
<property name="exampleMainClass" value="example.JSwingExampleLauncherHTML"/>
<!-- jar signing properties in separate property file -->
<property file="jarsign.properties"/>
<available file="${jarsign.keystore}" property="keystoreExists" />
<available file="${lib}" property="libExists"/>
<available file="${distData}" property="distDataExists"/>
<!-- jnlp construction properties - requires ant-contrib orangevolt task library -->
<property name="jnlpFilename" value="${ant.project.name}.jnlp"/>
<property name="jnlpCodebase" value="http://www.dcs.napier.ac.uk/~marting/JSwingPlus"/>
<property name="jnlpApplet" value="false"/>
<property name="jnlpAppletClass" value="ToddlePaint"/>
<property name="jnlpOneLineDescription" value="Extended Swing for IV"/>
<property name="jnlpVendor" value="CISS Group, Napier University"/>
<!-- lib folder files as a convenience fileset -->
<fileset id="libjars" dir="${lib}">
<include name="*.jar" />
</fileset>
<!-- ivy stuff -->
<property name="fromResolver" value="remoteResolvers" />
<property name="toResolver" value="local_repo" />
<!--
<property name="ivy.cache.dir" value="${basedir}/cache" />
<property name="dest.repo.dir" value="C:/Program Files/repository/" />
-->
<!-- make build and lib files if they don't exist -->
<target name="init" description="--> make ${build} and ${lib} files if they don't exist">
<mkdir dir="${build}"/>
<mkdir dir="${lib}"/>
</target>
<!-- compile/copy src folder files to build folder -->
<target name="compile" depends="init" description="--> compile/copy ${src} folder files to ${build} folder">
<echo message="java: ${java.home}"/>
<javac srcdir="${src}" destdir="${build}" debug="${debugClassFiles}" deprecation="on" verbose="${verbosity}" target="${classVersion}">
<!-- <compilerarg value="-Xlint"/> -->
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="${java.home}/lib/javaws.jar"/>
<fileset refid="libjars"/>
</classpath>
</javac>
<copy todir="${build}">
<fileset dir="${src}">
<include name="img/*.*"/>
<include name="**/*.css"/>
<include name="**/*.html"/>
<!-- <include name="*.properties"/> -->
<include name="**/*.properties"/>
<include name="*.txt"/>
</fileset>
</copy>
</target>
<!-- run compiled files in build folder -->
<target name="run" depends="compile" description="--> run compiled files in ${build} folder">
<echo>jvmargs: [${myjvmargs}]</echo>
<java classname="${exampleMainClass}" maxmemory="384m" fork="true" failonerror="true">
<jvmarg value="${myjvmargs}"/>
<classpath>
<pathelement path="${build}"/>
<fileset refid="libjars"/>
</classpath>
</java>
</target>
<!-- run compiled files with Xshare arg allowing VisualVM to monitor app -->
<target name="runProfiler" depends="compile" description="--> run compiled files with -Xshare arg allowing VisualVM to monitor app">
<antcall target="run">
<param name="myjvmargs" value="-Xshare:off"/>
</antcall>
</target>
<!-- construct basic jar file in distrib folder from compiled files in build folder -->
<target name="jarBasic" depends="compile" description="--> construct basic jar file in ${distrib} folder from compiled files in ${build} folder">
<mkdir dir="${distrib}"/>
<echo message="jarCompress: [${jarCompress}]"/>
<jar destfile="${distrib}/${jarFileName}.jar" basedir="${build}" compress="${jarCompress}">
<exclude name="**/Thumbs.db"/>
<exclude name="**/test/*.*"/>
<exclude name="example/**"/>
<manifest>
<attribute name="Class-Path" value="${manifestClassPath}" />
<attribute name="Permissions" value="all-permissions" />
</manifest>
</jar>
<jar destfile="${distrib}/${exampleJarFileName}.jar" basedir="${build}" compress="${jarCompress}">
<include name="example/**"/>
<include name="*.properties"/>
<include name="img/naplogo.png"/>
<include name="img/closeIcon.gif"/>
<exclude name="**/multiview/**"/>
<manifest>
<attribute name="Main-Class" value="${exampleMainClass}" />
<attribute name="Class-Path" value="${manifestClassPath} ${jarFileName}.jar" />
<attribute name="Permissions" value="all-permissions" />
</manifest>
</jar>
<copy todir="${distrib}/lib">
<fileset refid="libjars"/>
</copy>
</target>
<!-- as above but include lib folder jars as class path in jar manifest -->
<!-- this is needed for one click jar files, PortableJava and java -jar whatever.jar launching -->
<target name="jarBasicWithLibClasspath" description="--> as jarBasic but include ${lib} folder jars as class path in jar manifest">
<path id="libPath"><fileset refid="libjars"/></path>
<pathconvert property="libList" refid="libPath" pathsep=" " dirsep="/">
<map from="${lib}/" to="lib/" />
</pathconvert>
<antcall target="jarBasic">
<param name="manifestClassPath" value=".;${libList}"/>
</antcall>
</target>
<!-- include some data files in jar if wanted -->
<target name="jarData" if="distDataExists" description="--> include some data files in jar if wanted">
<property name="reldatasetpath" location="./${dataset}"/>
<echo message="[${reldatasetpath}]"/>
<jar destfile="${distrib}/${exampleJarFileName}.jar" basedir="${reldatasetpath}" compress="$(jarCompress)" update="true"/>
</target>
<!-- basic jar file including data if wanted -->
<target name="jar" depends="jarBasicWithLibClasspath,jarData" description="--> basic jar file including data if wanted"/>
<!-- make a signing key (properties declared in a separate property file) -->
<target name="makekey" unless="keystoreExists" description="--> make a signing key (properties declared in a separate property file)">
<echo>in makekey...</echo>
<genkey alias="${jarsign.alias}" storepass="${jarsign.keystorePassword}" keystore="${jarsign.keystore}">
<dname>
<param name="CN" value="${jarsign.vendor}"/>
<param name="OU" value="${jarsign.orgunit}"/>
<param name="O" value="${jarsign.org}"/>
<param name="C" value="${jarsign.country}"/>
</dname>
</genkey>
</target>
<!-- sign all the jars in the distrib folder using the generated key -->
<target name="jarsignerNotjar" depends="makekey" description="--> sign all the jars in the ${distrib} folder using the generated key">
<echo message="[${jarsign.keystorePassword}, ${jarsign.alias}, ${jarsign.mykeyPassword}]"/>
<signjar keystore="${jarsign.keystore}" storepass="${jarsign.keystorePassword}"
alias="${jarsign.alias}" keypass="${jarsign.mykeyPassword}"
maxmemory="512m">
<fileset dir="${distrib}">
<include name="*.jar"/>
</fileset>
</signjar>
</target>
<!-- make and sign jar files in distrib folder -->
<target name="jarsigner" depends="jar, jarsignerNotjar" description="--> make and sign jar files in ${distrib} folder"/>
<!-- clear out existing compiled class and jar files -->
<target name="clean" description="--> clear out existing compiled class and jar files">
<delete verbose="${verbosity}" includeEmptyDirs="true" quiet="true">
<fileset dir="${build}"/>
<fileset dir="${distrib}"/>
</delete>
</target>
<!-- make a signed jar from scratch -->
<target name="full" depends="clean, jarsigner" description="--> make a signed jar from scratch"/>
<!-- make and then run a signed jar from scratch -->
<target name="runjar" depends="full" description="--> make and then run a signed jar from scratch">
<java jar="${distrib}/${exampleJarFileName}.jar" maxmemory="384m" fork="true" failonerror="true">
<classpath>
<pathelement location="${distrib}/${exampleJarFileName}.jar"/>
<pathelement location="${distrib}/${jarFileName}.jar"/>
<pathelement path="${java.class.path}"/>
<fileset refid="libjars"/>
</classpath>
</java>
</target>
<!-- zip source files to datestamped zip file -->
<target name="zipsrc" description="--> zip source (${src}) files to datestamped zip file">
<tstamp/>
<zip destfile="${ant.project.name}Src${DSTAMP}.zip">
<zipfileset dir="${src}" prefix="src"/>
<fileset dir="." includes="*.xml,jarsign.properties"/>
</zip>
</target>
<!-- generate docs using doxygen - requires ant-contrib library and doxygen installed -->
<target name="docs" description="--> generate docs using doxygen - requires ant-contrib library and doxygen installed">
<mkdir dir="${docs}" />
<doxygen:doxygen />
</target>
<!-- make a jnlp file using orangevolt's ant-contrib tasks -->
<target name="makeJnlp" description="--> make a jnlp file using orangevolt's ant-contrib tasks">
<taskdef name="jnlp" classname="com.orangevolt.tools.ant.JNLPTask"
classpath="${ant.home}\lib\orangevolt-ant-tasks-1.3.8.jar" />
<taskdef name="if" classname="net.sf.antcontrib.logic.IfTask"
classpath="${ant.home}\lib\ant-contrib-1.0b3.jar" />
<mkdir dir="${distrib}" />
<if>
<equals arg1="${jnlpApplet}" arg2="true"/>
<then>
<jnlp
codebase="${jnlpCodebase}"
spec="1.5+"
href="${jnlpFilename}"
toFile="${distrib}/${jnlpFilename}">
<information>
<title>${ant.project.name}</title>
<vendor>${jnlpVendor}</vendor>
<homepage href="${jnlpCodebase}"/>
<description kind="one-line">${ant.project.name} - ${jnlpOneLineDescription}</description>
<offline_allowed/>
<shortcut>
<desktop/>
<menu submenu="JavaApps/${ant.project.name}"/>
</shortcut>
</information>
<security>
<all_permissions/>
</security>
<resources>
<j2se version="${classVersion}+" initial_heap_size="128m" max_heap_size="512m"/>
<fileset dir="${distrib}" includes="*.jar"/>
</resources>
<applet_desc documentBase="${jnlpCodebase}" name="${ant.project.name}" main_class="${jnlpAppletClass}" width="800" height="600"/>
</jnlp>
</then>
<else>
<jnlp
codebase="${jnlpCodebase}"
spec="1.5+"
href="${jnlpFilename}"
toFile="${distrib}/${jnlpFilename}">
<information>
<title>${ant.project.name}</title>
<vendor>${jnlpVendor}</vendor>
<homepage href="${jnlpCodebase}"/>
<description kind="one-line">${ant.project.name} - ${jnlpOneLineDescription}</description>
<offline_allowed/>
<shortcut>
<desktop/>
<menu submenu="JavaApps/${ant.project.name}"/>
</shortcut>
</information>
<security>
<all_permissions/>
</security>
<resources>
<j2se version="${classVersion}+" initial_heap_size="128m" max_heap_size="512m"/>
<fileset dir="${distrib}" includes="*.jar"/>
<fileset dir="${distrib}" includes="lib/*.jar"/>
</resources>
<application_desc main_class="${exampleMainClass}"/>
</jnlp>
</else>
</if>
</target>
<target name="ivyResolve" description="--> retrieve dependencies with ivy">
<ivy:resolve organisation="com.hp.hpl.jena" module="jena" revision="2.6.3" transitive="true" inline="true" />
</target>
<target name="ivyInstallRetrieve" depends="ivyInstall, ivyRetrieve" description="--> chain ivy install and retrieve operations"/>
<!-- retrieve resources listen in ivy.xml from repositories and put in lib folder-->
<target name="ivyRetrieve" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="${lib}/([classifier]/)[artifact]-[revision](-[classifier]).[ext]" conf="*"/>
</target>
<target name="ivyInstall" description="--> retrieve files from well formatted ivy repositories with dependencies">
<ivy:install organisation="log4j" module="log4j" revision="1.2.15" from="${fromResolver}" to="${toResolver}" transitive="false" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="com.hp.hpl.jena" module="jena" revision="2.6.3" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<!-- <ivy:install organisation="com.hp.hpl.jena" module="iri" revision="0.8" from="${fromResolver}" to="${toResolver}" transitive="false" overwrite="true" haltonfailure="false"/> -->
<!-- <ivy:install organisation="org.codehaus.jackson" module="jackson-core-asl" revision="1.8.5" from="${fromResolver}" to="${toResolver}" transitive="false" overwrite="true" haltonfailure="false"/> -->
<ivy:install organisation="org.codehaus.jackson" module="jackson-mapper-asl" revision="1.8.5" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="mysql" module="mysql-connector-java" revision="5.1.18" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-anim" revision="1.7" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-svggen" revision="1.7" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-transcoder" revision="1.7" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
<ivy:install organisation="org.apache.xmlgraphics" module="batik-codec" revision="1.7" from="${fromResolver}" to="${toResolver}" transitive="true" overwrite="true" haltonfailure="false"/>
</target>
<target name="ivyJenaInstall" description="--> retrieve jena files from ivy repositories">
<ivy:install organisation="com.hp.hpl.jena" module="iri" revision="0.8" from="repo2" to="${toResolver}" transitive="false" overwrite="true" haltonfailure="false"/>
</target>
<target name="ivyPublish" description="--> publish ivy-compatible JSwingPlus files to repository">
<delete file="${distrib}/ivy-${version}.xml"/> <!-- forces new file to be generated here -->
<ivy:resolve/>
<ivy:publish resolver="libraries" pubrevision="${version}" overwrite="true"
artifactspattern="${distrib}/[artifact]-[revision](-[classifier]).[ext]">
</ivy:publish>
</target>
<target name="ivyZipSrc" description="--> zip source (${src}) files to datestamped zip file">
<tstamp/>
<zip destfile="${distrib}/${ant.project.name}-${version}-sources.jar">
<zipfileset dir="${src}"/>
<fileset dir="." includes="build.xml,ivy*.*"/>
</zip>
</target>
<target name="ivyPublishFull" depends="clean, jarsigner, ivyZipSrc, ivyPublish" description="--> link together jar making and ivy publishing"/>
<target name="echoProperties" description="--> output system properties">
<echoproperties prefix="ivy."/>
<echoproperties prefix="user."/>
<echoproperties prefix="ant."/>
<echoproperties prefix="java."/>
</target>
</project>