-
Notifications
You must be signed in to change notification settings - Fork 30
/
build.xml
437 lines (350 loc) · 17.9 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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="Alchemy" default="default" basedir=".">
<description>Builds, tests, and runs the project Alchemy.</description>
<import file="nbproject/build-impl.xml"/>
<import file="nbproject/profiler-build-impl.xml"/> <import file="nbproject/profiler-build-impl.xml"/>
<!-- Import the resource bundle where the version info is stored -->
<property file="${basedir}/src/org/alchemy/core/AlcResourceBundle.properties"/>
<!-- Detect the OS -->
<condition property="mac">
<os family="mac"/>
</condition>
<condition property="unix">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="windows">
<os family="windows"/>
</condition>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Alchemy-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<target name="-pre-jar">
<!-- Ant config lets us loop & use if statements -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<!-- Copy the required libraries into the build file -->
<unjar src="${file.reference.commons-logging.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.itext.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.jpf.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.foxtrot.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.PDFRenderer.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.mime-util.jar}" dest="${build.classes.dir}"/>
<if>
<equals arg1="${mac}" arg2="true" />
<then>
<echo message="Ignoring the JPen Library for now" />
</then>
<else>
<unjar src="${file.reference.jpen-2.jar}" dest="${build.classes.dir}"/>
</else>
</if>
<!--
<unjar src="${file.reference.beads.jar}" dest="${build.classes.dir}"/>
-->
<unjar src="${file.reference.miglayout.jar}" dest="${build.classes.dir}"/>
<!-- The mass of batik libraries -->
<unjar src="${file.reference.batik-awt-util.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.batik-dom.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.batik-ext.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.batik-svggen.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.batik-util.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.batik-xml.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.xml-apis.jar}" dest="${build.classes.dir}"/>
<!-- Copy the module folder over to be built.-->
<copy todir="${build.dir}/modules">
<fileset dir="${basedir}/modules">
<!-- Leave out the old zip and class files -->
<exclude name="**/*.class"/>
<exclude name="**/*.zip"/>
</fileset>
</copy>
<!-- Copy the module class files over starting with core -->
<copy file="${build.classes.dir}/org/alchemy/core/AlcCore.class" todir="${build.dir}/modules/core/org/alchemy"/>
<!-- CREATES -->
<for list="shapes,typeShapes,inverseShapes,micShapes,medianShapes,speedShapes,xShapes,traceShapes,detachShapes,scrawlShapes,pullShapes,pressureShapes,splatterShapes,ribbonShapes,pitchShapes,evolveShapes" param="create">
<sequential>
<copy todir="${build.dir}/modules/@{create}/org/alchemy/create">
<!-- Include all files that begin with the module name -->
<fileset dir="${build.classes.dir}/org/alchemy/create/" includes="@{create}*" casesensitive="no" />
</copy>
</sequential>
</for>
<!-- AFFECTS -->
<for list="mirror,blindness,random,micExpand,repeat,displace,colorSwitcher,shapeSwap,gradient,smooth,limit" param="affect">
<sequential>
<copy todir="${build.dir}/modules/@{affect}/org/alchemy/affect">
<!-- Include all files that begin with the module name -->
<fileset dir="${build.classes.dir}/org/alchemy/affect/" includes="@{affect}*" casesensitive="no" />
</copy>
</sequential>
</for>
<!-- Delete the module class files so they are included as plugins and not in the dist -->
<delete includeemptydirs="true">
<fileset dir="${build.classes.dir}/org/alchemy/affect" includes="**/*"/>
<fileset dir="${build.classes.dir}/org/alchemy/create" includes="**/*"/>
</delete>
</target>
<target name="-post-jar">
<!-- Classpath for the custom tasks -->
<path id="classpath">
<fileset dir="lib/jpf" includes="*.jar" />
</path>
<!-- Define custom JPF specific Ant tasks -->
<typedef resource="org/java/plugin/tools/ant/jpf-tasks.properties">
<classpath refid="classpath" />
</typedef>
<!-- Call "jpf-zip" task to process plug-ins packaging every plug-in
from the build dir as single ZIP file -->
<jpf-zip
basedir="${build.dir}/modules"
includes="*/*.xml"
destdir="${build.dir}/modules"/>
<!-- The Alchemy folder in the dist directory -->
<property name="alchemy.dir" value="${dist.dir}/Alchemy"/>
<!-- Copy all of the modules to the dist/Alchemy/modules dir -->
<copy todir="${alchemy.dir}/modules">
<fileset dir="${build.dir}/modules">
<include name="**/*.zip"/>
<exclude name="**/*shapeSwap*"/>
<exclude name="**/*pitchShapes*"/>
</fileset>
</copy>
<!-- Delete the old modules then copy the new ones to the base directory -->
<delete>
<fileset dir="${basedir}/modules" includes="*.zip"/>
</delete>
<copy todir="${basedir}/modules">
<fileset dir="${build.dir}/modules">
<include name="*.zip"/>
</fileset>
</copy>
<!-- Delete the lib directory
Required libs are added manually based on the platform -->
<delete dir="${dist.dir}/lib"/>
<!-- Delete the Netbeans README.TXT file -->
<delete file="${dist.dir}/README.TXT"/>
<!-- Copy the manual into the dist directory -->
<copy file="${basedir}/res/Alchemy.pdf" todir="${alchemy.dir}"/>
<copy file="${basedir}/res/COPYING" todir="${alchemy.dir}"/>
<copy file="${basedir}/res/ReadMe.txt" todir="${alchemy.dir}"/>
<!-- Copy the shapes folder into the dist directory -->
<copy todir="${alchemy.dir}/shapes">
<fileset dir="${basedir}/shapes" />
</copy>
<!-- Create platform specific executables -->
<antcall target="mac"/>
<antcall target="unix"/>
<antcall target="windows"/>
</target>
<!--
======================
MAC
======================
-->
<target name="mac" if="mac">
<!-- Create the mac .app executable bundle -->
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" >
<classpath>
<pathelement location="${basedir}/lib/ant/jarbundler-2.0.0.jar"/>
</classpath>
</taskdef>
<jarbundler
dir="${alchemy.dir}"
name="${application.title}"
mainclass="${main.class}"
jar="${dist.jar}"
icon="${basedir}/res/Alchemy.icns"
jvmversion="1.5+"
version="${version.numeric}"
infostring="${version.string}, ${copyright}"
arguments="-Xms128m -Xmx512m">
<!-- Adjust the look, feel and behavior -->
<javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
</jarbundler>
<property name="mac.bundle" value="${alchemy.dir}/Alchemy.app/Contents/Resources/Java" />
<!-- Copy the Quaqua libraries for more mac looking interface support -->
<copy file="${file.reference.quaqua.jar}" todir="${mac.bundle}/lib"/>
<copy file="${basedir}/lib/quaqua/libquaqua.jnilib" todir="${mac.bundle}"/>
<copy file="${basedir}/lib/quaqua/libquaqua64.jnilib" todir="${mac.bundle}"/>
<!-- Alchemy Native -->
<copy file="${basedir}/lib/libAlcNative.jnilib" todir="${mac.bundle}"/>
<!-- JPen -->
<!-- Copy the regular version -->
<copy file="${basedir}/lib/jpen/libjpen-2-3.jnilib" todir="${mac.bundle}"/>
<copy file="${file.reference.jpen-2.jar}" todir="${mac.bundle}/lib"/>
<!-- Copy the Tiger version
<copy file="${basedir}/lib/jpen/jpen-tiger/libjpen-2.jnilib" todir="${mac.bundle}"/>
<copy file="${basedir}/lib/jpen/jpen-tiger/jpen-2.jar" todir="${mac.bundle}/lib"/>
-->
<!-- Delete the Alchemy Jar file -->
<delete file="${dist.dir}/Alchemy.jar"/>
<!-- Move the Alchemy folder to a sub directory to make a drag and drop install easier -->
<move todir="${alchemy.dir}/Alchemy">
<fileset dir="${alchemy.dir}" />
</move>
<!-- Create a Mac .dmg file for distribution.
Create a hidden folder and copy the background image,
then copy the DS_Store file which holds the preferences of how it looks,
finally create the .dmg file using the command line hdiutil -->
<copy file="${basedir}/res/dmg/Alchemy.png" todir="${alchemy.dir}/.background"/>
<copy file="${basedir}/res/dmg/DS_Store" todir="${alchemy.dir}"/>
<move file="${alchemy.dir}/DS_Store" tofile="${alchemy.dir}/.DS_Store"/>
<exec executable="hdiutil">
<arg line="create -srcfolder ${alchemy.dir} ${dist.dir}/Alchemy-${version.number}.dmg"/>
</exec>
<move todir="${alchemy.dir}">
<fileset dir="${alchemy.dir}/Alchemy" />
</move>
</target>
<!--
======================
LINUX
======================
-->
<target name="unix" if="unix">
<!-- LINUX Shell Script to Launch Alchemy -->
<copy file="${basedir}/res/Alchemy" todir="${alchemy.dir}"/>
<copy file="${basedir}/res/AlchemyOpenGL" todir="${alchemy.dir}"/>
<!-- Make the shell script executable -->
<chmod file="${alchemy.dir}/Alchemy" perm="+x"/>
<chmod file="${alchemy.dir}/AlchemyOpenGL" perm="+x"/>
<!-- JPen -->
<copy file="${basedir}/lib/jpen/libjpen-2-3.so" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/libjpen-2-3-ia64.so" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/libjpen-2-3-x86_64.so" todir="${alchemy.dir}/lib"/>
<!-- Move the Jar file -->
<move file="${dist.dir}/Alchemy.jar" tofile="${alchemy.dir}/Alchemy.jar"/>
<!-- Create a .tar.gz for distribution -->
<tar destfile="${dist.dir}/Alchemy-${version.number}.tar" basedir="${dist.dir}"/>
<gzip destfile="${dist.dir}/Alchemy-${version.number}.tar.gz" src="${dist.dir}/Alchemy-${version.number}.tar"/>
<delete file="${dist.dir}/Alchemy-${version.number}.tar" />
</target>
<!--
======================
WINDOWS
======================
-->
<target name="windows" if="windows">
<!--
Create the Windows executable bundle
Launch4j needs to be installed into the Program Files folder
http://launch4j.sourceforge.net/
-->
<property name="launch4j.dir" location="C:/Program Files/Launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar
:${launch4j.dir}/lib/xstream.jar" />
<launch4j>
<config
dontWrapJar="false"
headerType="console"
jarPath="${dist.jar}"
outfile="${alchemy.dir}/Alchemy.exe"
errTitle="Java Install Required"
priority="normal"
downloadUrl="http://java.com/download"
customProcName="true"
stayAlive="false"
icon="${basedir}/res/Alchemy.ico">
<jre
minVersion="1.5.0"
dontUsePrivateJres="false"
initialHeapSize="128"
maxHeapSize="512">
<opt>-Djava.library.path=lib</opt>
</jre>
<versionInfo
fileVersion="${version.numeric}"
txtFileVersion="${version.string}"
productVersion="${version.numeric}"
fileDescription="${application.desc}"
copyright="${copyright}"
txtProductVersion="${version.string}"
productName="${application.title}"
internalName="${application.title}"
originalFilename="Alchemy.exe"
/>
</config>
</launch4j>
<!-- JPen -->
<copy file="${basedir}/lib/jpen/jpen-2-2.dll" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/jpen-2-2-64.dll" todir="${alchemy.dir}/lib"/>
<!-- Delete the Alchemy Jar file -->
<delete file="${dist.dir}/Alchemy.jar"/>
<!-- Create a .zip for distribution -->
<zip destfile="${dist.dir}/Alchemy-${version.number}.zip"
basedir="${dist.dir}"
/>
</target>
<!-- JAVA DOCS -->
<target name="-javadoc-build" depends="init">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<sourcepath>
<pathelement location="${basedir}/src/org/alchemy/core"/>
</sourcepath>
<packageset dir="${basedir}/src/org/alchemy/core" includes="*/**"/>
<fileset dir="${basedir}/src/org/alchemy/core" includes="*.java" excludes="AlcCore.java"/>
</javadoc>
</target>
</project>