forked from PistoiaHELM/HELMEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
391 lines (335 loc) · 17.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="HELM Editor" default="jar" basedir=".">
<description>Builds, tests, and runs, and deploys the project HELM Editor.</description>
<target name="init">
<tstamp/>
<!-- Give user a chance to override without editing this file and without using -D arguments each time they build using build.properties files). -->
<property file="${basedir}/build.properties" />
<property file="${basedir}/source/org/helm/editor/editor/resource/GUIBase.properties" />
<property name="name" value="HELMEditor"/>
<property name="version" value="1.0"/>
<property name="version.impl" value="${version}"/>
<property name="version.spec" value="1.0"/>
<property name="year" value="2012"/>
<property name="compile.debug" value="true" />
<property name="compile.optimize" value="true" />
<property name="compile.target" value="1.7" />
<property name="compile.source" value="1.7" />
<property name="compile.deprecation" value="true" />
<property name="src.dir" value="${basedir}/source"/>
<property name="resources.dir" value="${basedir}/resources"/>
<property name="marvin.dir" value="${basedir}/lib"/>
<property name="marvin.jar.name" value="MarvinBeans-5.0.jar"/>
<property name="yfiles.dir" value="${basedir}/local/yworks"/>
<property name="yguard.jar.name" value="yguard-2.5.3.jar"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="packages" value="org.helm.*"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.src" value="${basedir}/build/src"/>
<property name="build.dest" value="${basedir}/build/classes"/>
<property name="build.javadoc" value="${basedir}/build/javadoc"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="obf.dir" value="${basedir}/obf"/>
<property name="publish.dir" value="${basedir}/publish"/>
<property name="publish.jar.dir" value="${publish.dir}/jar"/>
<property name="publish.obf.dir" value="${publish.dir}/obf"/>
<property name="publish.javadoc.dir" value="${publish.dir}/javadoc"/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
<filter token="log" value="true"/>
<filter token="verbose" value="true"/>
<property name="jar.file.name" value="${name}-${version}.jar"/>
<property name="jar.file" value="${dist.dir}/${jar.file.name}"/>
<property name="toolkit.dir" value="../HELMNotationToolkit/publish/jar/"/>
<property name="toolkit.jar.name" value="HELMNotationToolkit-1.1.jar"/>
<property name="applet.helm.jar.name" value="HELM"/>
<property name="applet.lib.jar.name" value="AppletLibs"/>
<property name="applet.lib.dir" value="${dist.dir}/appletlib"/>
<property name="applet.dist.dir" value="${dist.dir}/applet"/>
<property name="applet.dir" value="${basedir}/applet"/>
<!-- Obfuscated jars -->
<property name="helm.name" value="${name}-${version}"/>
<property name="obf.helm.name" value="obf_${helm.name}"/>
<property name="helm.jar.name" value="${helm.name}.jar"/>
<property name="obf.helm.jar.name" value="obf_${helm.jar.name}"/>
<property name="yfiles.jar.name" value="yfiles-2.12.jar"/>
<property name="obf.yfiles.jar.name" value="${obf.helm.name}_${yfiles.jar.name}"/>
<!-- Compilation class path, include every jar file in lib.dir, plus the marvin and yfiles jars -->
<path id="compile.class.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<exclude name="MarvinBeans*.jar"/>
<exclude name="HELMNotationToolkit*.jar"/>
</fileset>
<fileset dir="${marvin.dir}">
<include name="${marvin.jar.name}"/>
</fileset>
<fileset dir="${toolkit.dir}">
<include name="${toolkit.jar.name}"/>
</fileset>
<fileset dir="${yfiles.dir}">
<include name="${yfiles.jar.name}"/>
</fileset>
</path>
<!-- Obfuscated jars -->
<path id="obfuscate.class.path">
<fileset dir="${obf.dir}">
<include name="*.jar"/>
</fileset>
</path>
<!-- Run class path-->
<path id="run.class.path">
<path refid="compile.class.path"/>
<pathelement location="${build.dest}"/>
</path>
<echo message="----------- ${name} ${version} ------------"/>
</target>
<!-- Help on usage -->
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="HELM Editor Build file"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" run --> run the editor"/>
<echo message=" jar --> compile the source code, and generate jar file from the toolkit and the editor"/>
<echo message=" javadoc --> generate the API documentation"/>
<echo message=" publish --> publish jar and javadoc"/>
<echo message=" clean --> clean up the build and dist directories"/>
<echo message=""/>
<echo message=" See the comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- Clean build and dist folder -->
<target name="clean" depends="init" description="Removes all build and dist files">
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
</target>
<!-- Prepares the source code -->
<target name="prepare" depends="clean">
<!-- create directories -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<!-- copy src files -->
<copy todir="${build.src}" >
<fileset dir="${src.dir}"/>
</copy>
</target>
<!-- Compiles the source directory -->
<target name="compile" depends="prepare" description="Compiles the source code">
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="compile.class.path"/>
</javac>
</target>
<!-- Creates the class package -->
<target name="jar" depends="compile" description="Creates the class package, include xml and xsd files">
<delete dir = "${dist.dir}" />
<mkdir dir = "${dist.dir}" />
<copy todir="${build.dest}">
<fileset dir="${build.src}">
<exclude name="**/*.java"/>
<exclude name="**/*.form"/>
</fileset>
</copy>
<copy todir="${build.dest}">
<fileset dir="${resources.dir}"/>
</copy>
<jar jarfile="${jar.file}" update="true">
<fileset dir="${build.dest}"/>
<manifest>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Codebase" value="*.pfizer.com pistoiahelm.github.io"/>
<attribute name="Application-Name" value="HELM Editor"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
</target>
<target name="obfuscate" depends="jar" >
<delete dir = "${obf.dir}" />
<mkdir dir = "${obf.dir}" />
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="${yfiles.dir}/${yguard.jar.name}"/>
<property name="shrink.log" value="${obf.dir}/shrink.log"/>
<property name="rename.log" value="${obf.dir}/rename.log"/>
<yguard>
<inoutpair in="${dist.dir}/${helm.jar.name}" out="${obf.dir}/${obf.helm.jar.name}"/>
<inoutpair in="${yfiles.dir}/${yfiles.jar.name}" out="${obf.dir}/${obf.yfiles.jar.name}"/>
<externalclasses>
<pathelement location="${marvin.dir}/${marvin.jar.name}" />
<pathelement location="${toolkit.dir}/${toolkit.jar.name}" />
<pathelement location="${lib.dir}/openbabel-2.3.1.jar"/>
<pathelement location="${lib.dir}/jdom-1.1.jar" />
<pathelement location="${lib.dir}/sdlib.jar" />
<pathelement location="${lib.dir}/xerces.jar" />
<pathelement location="${lib.dir}/swing-worker-1.1.jar" />
<pathelement location="${lib.dir}/swingx-0.9.4.jar" />
<pathelement location="${lib.dir}/swingx-beaninfo-0.9.4.jar" />
<pathelement location="${lib.dir}/aloe.jar" />
<pathelement location="${lib.dir}/forms-1.1.0.jar" />
<pathelement location="${lib.dir}/swing-layout-1.0.3.jar" />
</externalclasses>
<!-- [OPTIONALLY] Keep the line number table and the source file attributes of the public part of the "application" -->
<attribute name="LineNumberTable,SourceFile">
<patternset>
<include name="org.helm.**"/>
</patternset>
</attribute>
<rename logfile="${rename.log}" replaceClassNameStrings="true">
<!-- use some unique package prefix for obfuscated classes to avoid name clashes -->
<property name="obfuscation-prefix" value="yguard"/>
<!-- make sure not rely on cases to differentiate names -->
<property name="language-conformity" value="compatible" />
<keep>
<class classes="private" methods="private" fields="private">
<patternset>
<include name="org.helm.**"/>
</patternset>
</class>
</keep>
<!-- make sure that the .properties files are renamed according to their -->
<!-- corresponding class files, yFiles needs this to function properly when obfuscated -->
<adjust replaceName="true">
<include name="y/**/*.properties"/>
</adjust>
</rename>
</yguard>
</target>
<!-- Publish jar and javadoc -->
<target name="publish" depends="obfuscate, javadoc" description="Move jar and javadoc into publish folder">
<copy todir="${publish.jar.dir}" >
<fileset dir="${dist.dir}">
</fileset>
</copy>
<copy todir="${publish.obf.dir}" >
<fileset dir="${obf.dir}">
<include name="*.jar" />
</fileset>
</copy>
<jar jarfile="${dist.dir}/${name}-${version}-javadoc.zip" basedir="${build.javadoc}" />
<copy todir="${publish.javadoc.dir}" >
<fileset dir="${dist.dir}">
<include name="*.zip" />
</fileset>
</copy>
</target>
<!-- Run application -->
<target name="run" depends="jar" description="Run HELM Editor" >
<java classname="org.helm.editor.HELMApp" fork="true">
<classpath refid="run.class.path"/>
</java>
</target>
<!-- Create the applet jars -->
<target name="applet" depends="obfuscate" description="Create an applet from the HELM Editor" >
<delete dir="${applet.lib.dir}" />
<mkdir dir="${applet.lib.dir}" />
<unjar dest="${applet.lib.dir}" src="${obf.dir}/${obf.yfiles.jar.name}" />
<unjar dest="${applet.lib.dir}" src="${marvin.dir}/${marvin.jar.name}" />
<unjar dest="${applet.lib.dir}" src="${toolkit.dir}/${toolkit.jar.name}" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/openbabel-2.3.1.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/jdom-1.1.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/sdlib.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/xerces.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/swing-worker-1.1.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/swingx-0.9.4.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/swingx-beaninfo-0.9.4.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/aloe.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/forms-1.1.0.jar" />
<unjar dest="${applet.lib.dir}" src="${lib.dir}/swing-layout-1.0.3.jar" />
<delete dir = "${applet.lib.dir}" >
<include name="**/*.SF"/>
<include name="**/*.RSA"/>
</delete>
<delete dir="${applet.dist.dir}" />
<mkdir dir="${applet.dist.dir}" />
<jar jarfile="${applet.dist.dir}/${applet.lib.jar.name}.jar" basedir="${applet.lib.dir}" update="true">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Codebase" value="*.pfizer.com pistoiahelm.github.io"/>
<attribute name="Application-Name" value="HELM Editor"/>
<attribute name="Trusted-Library" value="true"/>
</manifest>
</jar>
<copy file="${obf.dir}/${obf.helm.jar.name}" tofile="${applet.dist.dir}/${applet.helm.jar.name}.jar" />
<delete dir="${applet.lib.dir}" />
<jar jarfile="${applet.dir}/HELMApplet-${version}.zip" basedir="${applet.dist.dir}" />
</target>
<!-- Creates the API documentation -->
<target name="javadoc" depends="prepare" description="Creates the API documentation">
<mkdir dir="${build.javadoc}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
splitindex="true"
noindex="false"
windowtitle="${name} v${version}"
doctitle="${name} v${version}<br>API Specification"
header="<b>${name}<br><font size='-1'>${version}</font></b>"
bottom="Copyright © ${year}, The Pistoia Alliance">
<classpath refid="compile.class.path"/>
</javadoc>
</target>
<!-- Create the binary files -->
<target name="binary" depends="obfuscate" description="Create binary files from the HELM Editor" >
<property name="binary.dir" value="${basedir}/binary"/>
<property name="binary.build.dir" value="${binary.dir}/build"/>
<property name="binary.lib.dir" value="${binary.build.dir}/lib"/>
<property name="binary.jar.dir" value="${binary.build.dir}/jar"/>
<!-- create binary directories -->
<delete dir="${binary.build.dir}" />
<mkdir dir="${binary.build.dir}" />
<mkdir dir="${binary.lib.dir}" />
<mkdir dir="${binary.jar.dir}" />
<!-- copy readme.txt file -->
<!--
<copy file="${binary.dir}/readme.txt" tofile="${binary.build.dir}/readme.txt" />
-->
<!-- copy jar files to binary directories -->
<copy file="${obf.dir}/${obf.helm.jar.name}" tofile="${binary.build.dir}/${jar.file.name}" />
<copy file="${obf.dir}/${obf.yfiles.jar.name}" tofile="${binary.lib.dir}/${obf.yfiles.jar.name}" />
<copy file="${marvin.dir}/${marvin.jar.name}" tofile="${binary.lib.dir}/${marvin.jar.name}" />
<copy file="${toolkit.dir}/${toolkit.jar.name}" tofile="${binary.lib.dir}/${toolkit.jar.name}" />
<copy todir="${binary.lib.dir}" >
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</copy>
<!-- define jars in classpath -->
<path id="binary.class.path">
<fileset dir="${binary.build.dir}">
<include name="${jar.file.name}"/>
<include name="lib/*.jar"/>
</fileset>
</path>
<!-- convert runtime classpath to manifest classpath -->
<manifestclasspath property="manifest.class.path" jarfile="${binary.build.dir}/${jar.file.name}">
<classpath refid="binary.class.path" />
</manifestclasspath>
<echo message="Manifest Class Path:"/>
<echo message="${manifest.class.path}"/>
<!-- unzip main jar file for update -->
<unzip src="${binary.build.dir}/${jar.file.name}" dest="${binary.jar.dir}" />
<!-- update manifest file -->
<manifest file="${binary.jar.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Main-Class" value="org.helm.editor.HELMApp" />
<attribute name="Class-Path" value="${manifest.class.path}" />
</manifest>
<zip file="${binary.build.dir}/${jar.file.name}" basedir="${binary.jar.dir}" update="true"/>
<delete dir="${binary.jar.dir}" />
<zip file="${binary.dir}/HELMEditor-${version}.zip" basedir="${binary.build.dir}" />
<delete dir="${binary.build.dir}" />
</target>
</project>