-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
610 lines (492 loc) · 32.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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE xml>
<project name="fun-ops" default="create-ALL-project-executables" basedir=".">
<description>
Custom Ant Build Script for all fun-ops apps. Includes compile, jar,
run, create exe, javadoc, unjar tasks for build generation for all apps.
Prerequisite for running the create exe targets is that you must have the Launch4j folder in the project space.
</description>
<property file="build.properties" />
<property environment="env" />
<target name="define-launch4j-task" description="defines the launch4j task">
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
</target>
<tstamp>
<format property="TODAY_US_DATE" pattern="MM/dd/yyyy hh:mm a z" locale="en, US" />
</tstamp>
<echo message="Project name: ${ant.project.name}${line.separator}Current date and time: ${TODAY_US_DATE}
${line.separator}${ant.version}${line.separator}${line.separator}JAVA_HOME path = ${env.JAVA_HOME}
${line.separator}Java version used by Ant: ${ant.java.version}${line.separator}OS family = ${env.OS}" level="info" />
<!-- path reference id for classpath holding references to all 3rd party jars in project
If you add any 3rd party jars to use in this project, be sure to it to this lib folder -->
<path id="build.classpath" description="a path including all dependency libraries needed to build main application classes in this project">
<fileset dir="${lib.dir}" includes="*.jar" />
</path>
<macrodef name="launch4j-create-exe-task" description="macrodef that creates a wrapped exe file from the provided jar content">
<attribute name="outputFile" />
<attribute name="jarPath" />
<attribute name="icon" />
<sequential>
<launch4j>
<config headerType="gui" outfile="${release.dir}/@{outputFile}/@{outputFile}.exe" dontWrapJar="false" jarPath="@{jarPath}" icon="@{icon}">
<jre minVersion="${min.jre.version}">
<opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
<opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
</jre>
<messages startupErr="Startup Error" bundledJreErr="Bundled JRE Error" jreVersionErr="JRE Version Error" launcherErr="Launcher Error" />
</config>
</launch4j>
</sequential>
</macrodef>
<target name="zip-executable" depends="skip-zip-executable" if="${zip.executable}" description="checks build script's property to see if user wants all executables to be zipped">
<echo message="zip.executable build property set to true, zipping the parent folder of the executable along with resource files" />
<zip-and-delete-task app-name="${app-name}" />
</target>
<target name="skip-zip-executable" unless="${zip.executable}" description="Skips zip process if zip.executable property is set to false">
<echo message="Skipping zip process because zip.executable build property is set to false" />
</target>
<macrodef name="zip-and-delete-task" description="task to perform move, zip, and delete operations on a provided app and it's resources">
<attribute name="app-name" />
<sequential>
<zip destfile="${release.dir}/@{app-name}.zip" basedir="${release.dir}/@{app-name}" update="true" />
<delete dir="${release.dir}/@{app-name}" verbose="${verbose.on}" />
</sequential>
</macrodef>
<target name="load-signjar-properties" description="checks if the signjar-key.properties file is found">
<condition property="isSignJarPropertiesFound" value="Yes" else="No">
<available file="${signjar.properties.file.path}" />
</condition>
<echo message="signjar properties file found under file path ${signjar.properties.file.path}? ${isSignJarPropertiesFound}" />
</target>
<target name="are-signjar-properties-missing" depends="load-signjar-properties" unless="${isSignJarPropertiesFound}">
<echo message="Could not load signjar-key.properties, skipping the sign jar process" />
</target>
<target name="sign-jar-if-properties-exist" depends="are-signjar-properties-missing" if="${isSignJarPropertiesFound}" description="loads the signjar-key config file and signs the jar only if the signjar-key config file is found">
<property name="signjar.properties.file" value="${signjar.properties.file.path}" file="${signjar.properties.file.path}" />
<echo message="${signjar.properties.file} file has been loaded" />
<signjar jar="${jarPath}" keystore="${keystore}" storepass="${keystore.password}" alias="${key.alias}" keypass="${key.password}" storetype="jks" sigalg="SHA256withRSA" digestalg="SHA-256" verbose="${verbose.on}" />
<echo message="provided jar file '${jarPath}' has been signed" />
</target>
<!-- clean -->
<target name="clean" description="cleans all build generated folders">
<delete dir="${build.dir}" verbose="${verbose.on}" />
<delete dir="logs" verbose="${verbose.on}" />
</target>
<!-- target to create all project executables -->
<target name="create-ALL-project-executables" description="creates all project executables" depends="clean">
<antcall target="create-and-zip-calculator.exe" />
<antcall target="create-and-zip-stopwatch.exe" />
<antcall target="create-and-zip-encryption.exe" />
<antcall target="create-and-zip-clock.exe" />
<antcall target="create-and-zip-number_game.exe" />
<antcall target="create-and-zip-hangman.exe" />
<antcall target="create-and-zip-pong.exe" />
<antcall target="create-and-zip-tic-tac-toe.exe" />
<antcall target="create-and-zip-wigglemouse.exe" />
</target>
<!-- targets for calculator -->
<target name="compile-calculator" description="compile the java sources that will be included in the build for the specified application">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/calculator" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-calculator" depends="compile-calculator" description="creates associated .jar file for the specified application">
<jar destfile="${jar.dir}/calculator-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/calculator/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.calculator.MyCalculatorGui" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/calculator-${version.num}.jar" />
</antcall>
</target>
<target name="run-calculator" depends="jar-calculator" description="run the program">
<java jar="${jar.dir}/calculator-${version.num}.jar" fork="true" />
</target>
<!-- create calculator.exe target -->
<target name="create-and-zip-calculator.exe" description="creates .exe file for calculator program" depends="jar-calculator, define-launch4j-task">
<mkdir dir="${release.dir}/calculator" />
<launch4j-create-exe-task outputFile="calculator" jarPath="${jar.dir}/calculator-${version.num}.jar" icon="${res.graphics.icons.dir}/calculator.ico" />
<copy file="${res.graphics.dir}/taskbar_icons/calculator.png" todir="${release.dir}/calculator/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="calculator" />
</antcall>
</target>
<!-- targets for encryption program -->
<target name="compile-encryption-program" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/encryption" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-encryption" depends="compile-encryption-program" description="creates associated .jar file">
<jar destfile="${jar.dir}/encryptDecrypt-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/encryption/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.encryption.EncryptDecryptGui" />
<attribute name="Resource" value="${res.graphics.dir}/bg-image-encryption.jpg" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/encryptDecrypt-${version.num}.jar" />
</antcall>
</target>
<target name="run-encryption-program" depends="jar-encryption" description="run the program">
<java jar="${jar.dir}/encryptDecrypt-${version.num}.jar" fork="true" />
</target>
<!-- zip encryption program -->
<target name="zip-encryption-jar-with-resources" description="Create a zipped folder for encryption folder with jar and resources" depends="jar-encryption">
<copy file="secret.txt" todir="${dist.dir}/encryption" overwrite="true" verbose="${verbose.on}" />
<copy file="${jar.dir}/encryptDecrypt-${version.num}.jar" todir="${dist.dir}/encryption" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/bg-image-encryption.jpg" todir="${dist.dir}/encryption/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/encryption.png" todir="${dist.dir}/encryption/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/encryption-unlocked.png" todir="${dist.dir}/encryption/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<zip destfile="${dist.dir}/encryption.zip" basedir="${dist.dir}/encryption" update="true" />
<delete dir="${dist.dir}/encryption" verbose="${verbose.on}" />
</target>
<!-- create and zip encryption.exe target -->
<target name="create-and-zip-encryption.exe" description="creates .exe file for encryption program" depends="jar-encryption, define-launch4j-task">
<mkdir dir="${release.dir}/encryption" />
<launch4j-create-exe-task outputFile="encryption" jarPath="${jar.dir}/encryptDecrypt-${version.num}.jar" icon="${res.graphics.icons.dir}/encryption.ico" />
<copy file="${res.graphics.dir}/bg-image-encryption.jpg" todir="${release.dir}/encryption/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/encryption.png" todir="${release.dir}/encryption/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/encryption-unlocked.png" todir="${release.dir}/encryption/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<copy file="secret.txt" todir="${release.dir}/encryption" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="encryption" />
</antcall>
</target>
<!-- targets for hangman -->
<target name="compile-hangman" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/hangman" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-hangman" depends="compile-hangman" description="creates associated .jar file">
<jar destfile="${jar.dir}/hangman-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/hangman/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.hangman.Hangman" />
<attribute name="Resource" value="${res.graphics.dir}/bg-image-hangman.jpg" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/hangman-${version.num}.jar" />
</antcall>
</target>
<target name="run-hangman" depends="jar-hangman" description="run the program">
<java jar="${jar.dir}/hangman-${version.num}.jar" fork="true" />
</target>
<!-- zip-hangman-jar with resources target -->
<target name="zip-hangman-jar-with-resources" description="Create zipped folder for hangman game with jar and resources" depends="jar-hangman">
<copy file="hangman_words.txt" todir="${dist.dir}/hangman" overwrite="true" verbose="${verbose.on}" />
<copy file="${jar.dir}/hangman-${version.num}.jar" todir="${dist.dir}/hangman" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/bg-image-hangman.jpg" todir="${dist.dir}/hangman/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/hangman.png" todir="${dist.dir}/hangman/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<zip destfile="${dist.dir}/hangman.zip" basedir="${dist.dir}/hangman" update="true" />
<delete dir="${dist.dir}/hangman" verbose="${verbose.on}" />
</target>
<!-- create and zip hangman.exe target -->
<target name="create-and-zip-hangman.exe" description="creates .exe file for hangman program" depends="jar-hangman, define-launch4j-task">
<mkdir dir="${release.dir}/hangman" />
<launch4j-create-exe-task outputFile="hangman" jarPath="${jar.dir}/hangman-${version.num}.jar" icon="${res.graphics.icons.dir}/hangman.ico" />
<copy file="${res.graphics.dir}/bg-image-hangman.jpg" todir="${release.dir}/hangman/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/hangman.png" todir="${release.dir}/hangman/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<copy file="hangman_words.txt" todir="${release.dir}/hangman" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="hangman" />
</antcall>
</target>
<!-- create stopwatch.exe target -->
<target name="create-and-zip-stopwatch.exe" description="creates .exe file for stopwatch program" depends="jar-stopwatch, define-launch4j-task">
<mkdir dir="${release.dir}/stopwatch" />
<launch4j-create-exe-task outputFile="stopwatch" jarPath="${jar.dir}/stopwatch-${version.num}.jar" icon="${res.graphics.icons.dir}/stopwatch.ico" />
<copy file="${res.graphics.dir}/taskbar_icons/stopwatch.png" todir="${release.dir}/stopwatch/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="stopwatch" />
</antcall>
</target>
<!-- targets for guessing game and advanced guessing game -->
<target name="compile-number_game" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/stopwatch; ${src.dir}/com/numbergame" destdir="${classes.dir}" debug="true" classpathref="build.classpath" compiler="modern" />
</target>
<target name="jar-number_game" depends="compile-number_game" description="creates associated .jar file">
<jar destfile="${jar.dir}/guessingGame-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/numbergame/*.class, com/stopwatch/*.class" excludes="com/numbergame/Advanced*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.numbergame.GuessingGame" />
<attribute name="Resource1" value="${res.audio.dir}/chimes.wav" />
<attribute name="Resource2" value="${res.audio.dir}/fail.wav" />
<attribute name="Resource3" value="${res.audio.dir}/win.wav" />
<attribute name="Resource4" value="${res.graphics.dir}/bg-image-guessing-figure.jpg" />
<attribute name="Resource5" value="${res.graphics.dir}/bg-image-guess.jpg" />
<attribute name="Resource6" value="${res.graphics.dir}/green_checkmark.png" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/guessingGame-${version.num}.jar" />
</antcall>
</target>
<target name="run-number_game" depends="jar-number_game" description="run the program">
<java jar="${jar.dir}/guessingGame-${version.num}.jar" fork="true" />
</target>
<target name="jar-adv-number_game" depends="compile-number_game" description="creates associated .jar file">
<jar destfile="${jar.dir}/adv-guessingGame-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/numbergame/*.class, com/stopwatch/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.numbergame.AdvancedGuessingGame" />
<attribute name="Resource" value="${res.audio.dir}/chimes.wav" />
<attribute name="Resource2" value="${res.audio.dir}/fail.wav" />
<attribute name="Resource3" value="${res.audio.dir}/win.wav" />
<attribute name="Resource4" value="${res.graphics.dir}/bg-image-guessing-figure.jpg" />
<attribute name="Resource5" value="${res.graphics.dir}/bg-image-guess.jpg" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/adv-guessingGame-${version.num}.jar" />
</antcall>
</target>
<target name="run-adv-number_game" depends="jar-adv-number_game" description="run the program">
<java jar="${jar.dir}/adv-guessingGame-${version.num}.jar" fork="true" />
</target>
<!-- targets for ping pong game -->
<target name="compile-pong" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/pingpong" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-pong" depends="compile-pong" description="creates associated .jar file">
<jar destfile="${jar.dir}/pong-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/pingpong/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.pingpong.PingPongGui" />
<attribute name="Resource" value="${res.graphics.dir}/restart-sign.png" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/pong-${version.num}.jar" />
</antcall>
</target>
<target name="run-pong" depends="jar-pong" description="run the program">
<java jar="${jar.dir}/pong-${version.num}.jar" fork="true" />
</target>
<!-- zip guessing game -->
<target name="zip-guessing-game-jar-with-resources" description="Create zipped folder for guessing game with jar and resources" depends="jar-number_game">
<copy file="${jar.dir}/guessingGame-${version.num}.jar" todir="${dist.dir}/guessingGame" overwrite="true" verbose="${verbose.on}" />
<copy todir="${dist.dir}/guessingGame/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.graphics.dir}" includes="bg-image-guess*.jpg" />
</copy>
<copy todir="${dist.dir}/guessingGame/${res.audio.dir}" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.audio.dir}" includes="*.wav" />
</copy>
<copy file="${res.graphics.dir}/taskbar_icons/guessing-game.png" todir="${dist.dir}/guessingGame/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<zip destfile="${dist.dir}/guessingGame.zip" basedir="${dist.dir}/guessingGame" update="true" />
<delete dir="${dist.dir}/guessingGame" verbose="${verbose.on}" />
</target>
<!-- create and zip number_game.exe target -->
<target name="create-and-zip-number_game.exe" description="creates .exe file for number game" depends="jar-number_game, jar-adv-number_game, define-launch4j-task">
<mkdir dir="${release.dir}/number_game" />
<mkdir dir="${release.dir}/adv_number_game" />
<launch4j-create-exe-task outputFile="number_game" jarPath="${jar.dir}/guessingGame-${version.num}.jar" icon="${res.graphics.icons.dir}/guessing-game.ico" />
<launch4j-create-exe-task outputFile="adv_number_game" jarPath="${jar.dir}/adv-guessingGame-${version.num}.jar" icon="${res.graphics.icons.dir}/guessing-game.ico" />
<!-- because I'm packaging 2 executables into 1 folder I need this additional move statement -->
<move file="${release.dir}/adv_number_game/adv_number_game.exe" todir="${release.dir}/number_game" verbose="${verbose.on}" />
<copy todir="${release.dir}/number_game/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.graphics.dir}" includes="bg-image-guess*.jpg" />
</copy>
<copy todir="${release.dir}/number_game/${res.audio.dir}" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.audio.dir}" includes="*.wav" />
</copy>
<copy todir="${release.dir}/number_game/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.graphics.dir}/taskbar_icons" includes="guessing-game.png, stopwatch.png" />
</copy>
<copy file="${res.graphics.dir}/green-checkmark.png" todir="${release.dir}/number_game/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="number_game" />
</antcall>
<delete dir="${release.dir}/adv_number_game" verbose="${verbose.on}" />
</target>
<!-- targets for stopwatch -->
<target name="compile-stopwatch" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/stopwatch" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-stopwatch" depends="compile-stopwatch" description="creates associated .jar file">
<jar destfile="${jar.dir}/stopwatch-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/stopwatch/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.stopwatch.StopWatch" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/stopwatch-${version.num}.jar" />
</antcall>
</target>
<target name="run-stopwatch" depends="jar-stopwatch" description="run the program">
<java jar="${jar.dir}/stopwatch-${version.num}.jar" fork="true" />
</target>
<!-- targets for tic tac toe -->
<target name="compile-tic-tac-toe" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/tictactoe" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-tic-tac-toe" depends="compile-tic-tac-toe" description="creates associated .jar file">
<jar destfile="${jar.dir}/tic-tac-toe-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/tictactoe/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.tictactoe.TicTacToe" />
<attribute name="Resource" value="${res.graphics.dir}/bg-image-tac.jpg" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/tic-tac-toe-${version.num}.jar" />
</antcall>
</target>
<target name="run-tic tac toe" depends="jar-tic-tac-toe" description="run the program">
<java jar="${jar.dir}/tic-tac-toe-${version.num}.jar" fork="true" />
</target>
<!-- zip tic tac toe program -->
<target name="zip-tic-tac-toe-jar-with-resources" description="Create zipped folder for hangman game with jar and resources" depends="jar-tic-tac-toe">
<copy file="${jar.dir}/tic-tac-toe-${version.num}.jar" todir="${dist.dir}/tic-tac-toe" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/bg-image-tac.jpg" todir="${dist.dir}/tic-tac-toe/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/tic-tac-toe.png" todir="${dist.dir}/tic-tac-toe/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<zip destfile="${dist.dir}/tic_tac_toe.zip" basedir="${dist.dir}/tic-tac-toe" update="true" />
<delete dir="${dist.dir}/tic-tac-toe" verbose="${verbose.on}" />
</target>
<!-- create tic-tac-toe.exe target -->
<target name="create-and-zip-tic-tac-toe.exe" description="creates and zip .exe file for tic tac toe game" depends="jar-tic-tac-toe, define-launch4j-task">
<mkdir dir="${release.dir}/tic-tac-toe" />
<launch4j-create-exe-task outputFile="tic-tac-toe" jarPath="${jar.dir}/tic-tac-toe-${version.num}.jar" icon="${res.graphics.icons.dir}/tic-tac-toe.ico" />
<copy file="${res.graphics.dir}/bg-image-tac.jpg" todir="${release.dir}/tic-tac-toe/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/tic-tac-toe.png" todir="${release.dir}/tic-tac-toe/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="tic-tac-toe" />
</antcall>
</target>
<!-- targets for wiggle mouse -->
<target name="compile-wiggle-mouse" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/wigglemouse" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-wiggle-mouse" depends="compile-wiggle-mouse" description="creates associated .jar file">
<jar destfile="${jar.dir}/wigglemouse-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/wigglemouse/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.wigglemouse.WiggleMouse" />
<attribute name="Resource" value="${res.graphics.dir}/image-mouse-shake.jpg" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/wigglemouse-${version.num}.jar" />
</antcall>
</target>
<target name="run-wiggle-mouse" depends="jar-wiggle-mouse" description="run the program">
<java jar="${jar.dir}/wigglemouse-${version.num}.jar" fork="true" />
</target>
<!-- zip wigglemouse program -->
<target name="zip-wigglemouse-jar-with-resources" description="Create zipped folder for wigglemouse with jar and resources" depends="jar-wiggle-mouse">
<copy file="${jar.dir}/wigglemouse-${version.num}.jar" todir="${dist.dir}/wigglemouse" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/image-mouse-shake.jpg" todir="${dist.dir}/wigglemouse/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<zip destfile="${dist.dir}/wigglemouse.zip" basedir="${dist.dir}/wigglemouse" update="true" />
<delete dir="${dist.dir}/wigglemouse" verbose="${verbose.on}" />
</target>
<!-- create wiggle mouse.exe target -->
<target name="create-and-zip-wigglemouse.exe" description="creates .exe file for wiggle mouse program" depends="jar-wiggle-mouse, define-launch4j-task">
<mkdir dir="${release.dir}/wigglemouse" />
<launch4j-create-exe-task outputFile="wigglemouse" jarPath="${jar.dir}/wigglemouse-${version.num}.jar" icon="${res.graphics.icons.dir}/mouse.ico" />
<copy file="${res.graphics.dir}/image-mouse-shake.jpg" todir="${release.dir}/wigglemouse/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/mouse.png" todir="${release.dir}/wigglemouse/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="wigglemouse" />
</antcall>
</target>
<!-- create and zip clock.exe target -->
<target name="create-and-zip-clock.exe" description="creates .exe file for wiggle mouse program" depends="jar-clock, define-launch4j-task">
<mkdir dir="${release.dir}/clock" />
<launch4j-create-exe-task outputFile="clock" jarPath="${jar.dir}/clock-${version.num}.jar" icon="${res.graphics.icons.dir}/clock.ico" />
<copy file="res/fonts/clock-font.ttf" todir="${release.dir}/clock/res/fonts" overwrite="true" verbose="${verbose.on}" />
<copy todir="${release.dir}/clock/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}">
<fileset dir="${res.graphics.dir}" includes="alarm-clock-sign.png, night-sky-stars-animation.gif" />
</copy>
<copy file="${res.graphics.dir}/taskbar_icons/clock.png" todir="${release.dir}/clock/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.audio.dir}/clock-alarm.wav" todir="${release.dir}/clock/${res.audio.dir}" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="clock" />
</antcall>
</target>
<!-- create and zip pong.exe target -->
<target name="create-and-zip-pong.exe" description="creates .exe file for wiggle mouse program" depends="jar-pong, define-launch4j-task">
<mkdir dir="${release.dir}/pong" />
<launch4j-create-exe-task outputFile="pong" jarPath="${jar.dir}/pong-${version.num}.jar" icon="${res.graphics.icons.dir}/pingpong.ico" />
<copy file="${res.graphics.dir}/restart-sign.png" todir="${release.dir}/pong/${res.graphics.dir}" overwrite="true" verbose="${verbose.on}" />
<copy file="${res.graphics.dir}/taskbar_icons/pingpong.png" todir="${release.dir}/pong/${res.graphics.dir}/taskbar_icons" overwrite="true" verbose="${verbose.on}" />
<antcall target="zip-executable">
<param name="app-name" value="pong" />
</antcall>
</target>
<!-- targets for clock -->
<target name="compile-clock" description="compile program">
<mkdir dir="${classes.dir}" />
<javac includeantruntime="false" srcdir="${src.dir}/com/clock" destdir="${classes.dir}" classpathref="build.classpath" debug="true" compiler="modern" />
</target>
<target name="jar-clock" depends="compile-clock" description="creates associated .jar file">
<jar destfile="${jar.dir}/clock-${version.num}.jar">
<fileset dir="${classes.dir}" includes="com/clock/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.clock.Clock" />
<attribute name="Resource1" value="res/fonts/clock-font.tff" />
<attribute name="Resource2" value="${res.audio.dir}/clock-alarm.wav" />
<attribute name="Resource3" value="${res.graphics.dir}/alarm-clock-sign.png" />
<attribute name="Resource4" value="${res.graphics.dir}/night-sky-stars-animation.gif" />
<attribute name="Built-Date" value="${TODAY_US_DATE}" />
<attribute name="Built-By" value="${env.USERNAME}" />
</manifest>
</jar>
<antcall target="sign-jar-if-properties-exist">
<param name="jarPath" value="${jar.dir}/clock-${version.num}.jar" />
</antcall>
</target>
<target name="run-clock" depends="jar-clock" description="run the program">
<java jar="${jar.dir}/clock-${version.num}.jar" fork="true" />
</target>
<!-- javadoc target -->
<target name="create-project-javadoc" description="generate Javadoc for all applications">
<javadoc sourcepath="src" destdir="${build.dir}/docs/api" classpathref="build.classpath" docencoding="UTF-8" author="true" version="true" windowtitle="My API Page" />
</target>
<!-- unjar (extract jar files) target -->
<target name="unjar-all-jars" description="unjar all existing program jars" depends="clean, jar-calculator,
jar-clock, jar-encryption, jar-hangman, jar-number_game, jar-adv-number_game, jar-pong, jar-stopwatch,
jar-tic-tac-toe, jar-wiggle-mouse">
<unjar dest="${unjar.dir}" overwrite="true">
<fileset dir="${jar.dir}" includes="*.jar" />
</unjar>
<copy todir="${unjar.dir}/META-INF" overwrite="true" verbose="${verbose.on}">
<fileset dir="META-INF" />
</copy>
</target>
</project>