-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
1021 lines (892 loc) · 52 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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- =============================================================================================================== -->
<!-- Build file for muCommander. -->
<!-- -->
<!-- Author: Nicolas Rinaudo -->
<!-- =============================================================================================================== -->
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="muCommander" default="run">
<!-- = Project structure ======================================================================================= -->
<!-- =========================================================================================================== -->
<!-- Source directory. -->
<property name="src" location="src"/>
<!-- Test sources directory. -->
<property name="src.test" location="${src}/test"/>
<!-- Main sources directory. -->
<property name="src.main" location="${src}/main"/>
<!-- Main resources directory. -->
<property name="res" location="res"/>
<!-- Ivy resources directory. -->
<property name="res.ivy" location="${res}/ivy"/>
<!-- Runtime resources directory. -->
<property name="res.runtime" location="${res}/runtime"/>
<!-- Resources required for muCommander packaging. -->
<property name="res.package" location="${res}/package"/>
<!-- External libraries directory. -->
<property name="lib" location="lib"/>
<!-- Libraries required at runtime. -->
<property name="lib.runtime" location="${lib}/runtime"/>
<!-- External libraries used for tests. -->
<property name="lib.test" location="${lib}/test"/>
<!-- External tools. -->
<property name="lib.tools" location="${lib}/tools"/>
<!-- Compile time dependencies. -->
<property name="lib.compile" location="${lib}/compile"/>
<!-- Where to store temporary files. -->
<property name="tmp" location="tmp"/>
<property name="tmp.deb" location="${tmp}/deb"/>
<property name="jar.normal" location="${tmp}/mucommander-hadoop-qfs.jar"/>
<property name="jar.obf" location="${tmp}/mucommander-obf.jar"/>
<property name="tmp.nsis" location="${tmp}/nsis"/>
<property name="tmp.portable" location="${tmp}/portable"/>
<property name="tmp.unix" location="${tmp}/unix"/>
<!-- Where to store the main source's code compilation output. -->
<property name="tmp.main" location="${tmp}/main"/>
<!-- Where to store the test source's code compilation output. -->
<property name="tmp.test" location="${tmp}/test"/>
<!-- Where to store the obfuscated bytecode. -->
<property name="tmp.obf" location="${tmp}/obf"/>
<!-- Where to store external libraries' bytecode. -->
<property name="tmp.libs" location="${tmp}/libs"/>
<!-- Where to store temporary Cobertura files. -->
<property name="tmp.cobertura" location="${tmp}/cobertura"/>
<!-- Where to store various project reports. -->
<property name="reports" location="reports"/>
<!-- Where to store Javac reports. -->
<property name="javac.reports" location="${reports}/javac"/>
<!-- Where to store ProGuard reports. -->
<property name="reports.proguard" location="${reports}/proguard"/>
<!-- Where to store TestNG reports. -->
<property name="testng.reports" location="${reports}/testng"/>
<!-- Where to store Cobertura reports. -->
<property name="cobertura.reports" location="${reports}/cobertura"/>
<!-- Where to store Checkstyle reports. -->
<property name="checkstyle.reports" location="${reports}/checkstyle"/>
<!-- Where to store CPD reports. -->
<property name="cpd.reports" location="${reports}/cpd"/>
<!-- Where to store FindBugs reports. -->
<property name="findbugs.reports" location="${reports}/findbugs"/>
<!-- Where to store PMD reports. -->
<property name="pmd.reports" location="${reports}/pmd"/>
<!-- Where to store Ivy dependency reports. -->
<property name="ivy.reports" location="${reports}/ivy"/>
<!-- Where to store JavaNCSS reports. -->
<property name="javancss.reports" location="${reports}/javancss"/>
<!-- Where to store the API's Javadoc. -->
<property name="docs" location="docs"/>
<!-- Where to store distribution files. -->
<property name="dist" location="dist"/>
<!-- JAR distribution file. -->
<property name="dist.jar" location="${dist}/mucommander.jar"/>
<!-- Signed JAR distribution file. -->
<property name="dist.jar.signed" location="${dist}/mucommander_signed.jar"/>
<!-- Where to store the Win32 executable. -->
<property name="dist.exe" value="${dist}/muCommander.exe"/>
<!-- Where to store the OS X executable. -->
<property name="dist.app.name" value="muCommander.app"/>
<property name="dist.app" value="${dist}/${dist.app.name}"/>
<!-- Ivy dependencies retrieval pattern. -->
<property name="ivy.retrieve.pattern" value="${lib}/[conf]/[organisation]/[artifact].[ext]"/>
<!-- Name of the icon used by the JNLP file. -->
<property name="jnlp.icon" value="icon.gif"/>
<!-- Name of the muCommander JNLP file. -->
<property name="jnlp.file" value="mucommander.jnlp"/>
<!-- Path to the Ivy settings file. -->
<property name="ivy.settings.file" value="${res.ivy}/ivysettings.xml"/>
<!-- Runtime classpath. -->
<path id="lib.runtime">
<fileset dir="${lib.runtime}" includes="**/*.jar"/>
</path>
<!-- Test classpath. -->
<path id="lib.test">
<fileset dir="${lib.test}" includes="**/*.jar"/>
</path>
<!-- Tools classpath. -->
<path id="lib.tools">
<fileset dir="${lib.tools}" includes="**/*.jar"/>
</path>
<!-- Compile time classpath. -->
<path id="lib.compile">
<fileset dir="${lib.compile}" includes="**/*.jar"/>
</path>
<!-- = Compilation targets ===================================================================================== -->
<!-- =========================================================================================================== -->
<target name="compile" depends="load-properties,retrieve-runtime,retrieve-compile"
description="Compiles the library's sources">
<echo>Compiling sources...</echo>
<mkdir dir="${tmp.main}"/>
<mkdir dir="${javac.reports}"/>
<record name="${javac.reports}/javac.log" action="start"/>
<javac destdir="${tmp.main}" debug="on" deprecation="on"
encoding="${source.encoding}" source="${source.version}" target="${source.version}"
srcdir="${src.main}">
<classpath refid="lib.runtime"/>
<classpath refid="lib.compile"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
<record name="${javac.reports}/javac.log" action="stop"/>
<copy todir="${tmp.main}">
<fileset dir="${res.runtime}"/>
</copy>
</target>
<target name="compile-tests" depends="compile,retrieve-test">
<echo>Compiling test sources...</echo>
<mkdir dir="${tmp.test}"/>
<javac destdir="${tmp.test}" debug="on" deprecation="on"
encoding="${source.encoding}" source="${source.version}" target="${source.version}"
srcdir="${src.test}">
<classpath>
<pathelement location="${tmp.main}"/>
<path refid="lib.test"/>
</classpath>
</javac>
<taskdef classpathref="lib.test" resource="net/sourceforge/cobertura/ant/antlib.xml"/>
<echo>Instrumenting source code...</echo>
<mkdir dir="${tmp.cobertura}"/>
<mkdir dir="${cobertura.reports}"/>
<instrument todir="${tmp.cobertura}" datafile="${tmp.cobertura}/cobertura.ser">
<fileset dir="${tmp.main}"/>
</instrument>
</target>
<!-- = Test targets ============================================================================================ -->
<!-- =========================================================================================================== -->
<target name="check-failed-tests">
<condition property="testng.suite" value="${testng.reports}/testng-failed.xml">
<available file="${testng.reports}/testng-failed.xml"/>
</condition>
<property name="testng.suite" value="${src.test}/testng.xml"/>
</target>
<target name="test" depends="compile-tests,check-failed-tests" description="Runs the library's tests.">
<echo>Running self-tests...</echo>
<taskdef classpathref="lib.test" resource="testngtasks"/>
<mkdir dir="${testng.reports}"/>
<testng outputdir="${testng.reports}" haltonfailure="true">
<jvmarg value="-Xmx256m" />
<sysproperty key="net.sourceforge.cobertura.datafile" file="${tmp.cobertura}/cobertura.ser"/>
<sysproperty key="java.awt.headless" value="true"/>
<classpath>
<pathelement location="${tmp.cobertura}"/>
<pathelement location="${tmp.main}"/>
<pathelement location="${tmp.test}"/>
<path refid="lib.test"/>
</classpath>
<xmlfileset file="${testng.suite}"/>
</testng>
<echo>Generating coverage report...</echo>
<report format="xml" destdir="${cobertura.reports}"
srcdir="${src.main}" datafile="${tmp.cobertura}/cobertura.ser" encoding="${source.encoding}"/>
<report format="html" destdir="${cobertura.reports}"
srcdir="${src.main}" datafile="${tmp.cobertura}/cobertura.ser" encoding="${source.encoding}"/>
</target>
<!-- = Portable packaging ====================================================================================== -->
<!-- =========================================================================================================== -->
<target name="portable-exe" depends="load-launch4j" if="launch4j.available">
<echo>Creating Win32 launcher...</echo>
<mkdir dir="${tmp.portable}"/>
<launch4j>
<config outfile="${tmp.portable}/mucommander.exe" jarpath="mucommander.jar"
icon="${res.package}/windows/mucommander.ico" dontwrapjar="true" cmdline="-p .mucommander"
chdir=".">
<jre minversion="${source.version}.0">
<opt>-Djava.system.class.loader=com.mucommander.commons.file.AbstractFileClassLoader</opt>
</jre>
</config>
</launch4j>
</target>
<target name="portable" depends="compress,portable-exe,release-prefixes">
<echo>Packaging portable distribution file...</echo>
<copy todir="${tmp.portable}" overwrite="true">
<fileset file="${res.package}/unix/mucommander.sh"/>
<filterset>
<filter token="ARGS" value="-p $0/../.mucommander"/>
<filter token="JAVA_ARGS"
value="-Djava.system.class.loader=com.mucommander.commons.file.AbstractFileClassLoader"/>
</filterset>
</copy>
<!-- Generates the TGZ file, keeping execution flags. -->
<tar destfile="${dist}/${package.prefix}-portable.tar.gz" compression="gzip">
<tarfileset file="${tmp.portable}/mucommander.sh" prefix="${archive.prefix}" mode="755"/>
<tarfileset file="${tmp.portable}/mucommander.exe" prefix="${archive.prefix}"/>
<tarfileset file="${res.runtime}/license.txt" prefix="${archive.prefix}"/>
<tarfileset file="readme.txt" prefix="${archive.prefix}"/>
<tarfileset file="${dist.jar}" prefix="${archive.prefix}"/>
</tar>
</target>
<!-- = OS X packaging ========================================================================================== -->
<!-- =========================================================================================================== -->
<target name="app.tgz" depends="app,release-prefixes">
<echo>Packaging Mac OS X distribution file...</echo>
<tar destfile="${dist}/${package.prefix}.app.tar.gz" compression="gzip">
<tarfileset dir="${dist.app}" prefix="${archive.prefix}/${dist.app.name}">
<include name="**"/>
<exclude name="**/JavaApplicationStub"/>
</tarfileset>
<tarfileset dir="${dist.app}" prefix="${archive.prefix}/${dist.app.name}" mode="755">
<include name="**/JavaApplicationStub"/>
</tarfileset>
<tarfileset file="${res.runtime}/license.txt" prefix="${archive.prefix}"/>
<tarfileset file="readme.txt" prefix="${archive.prefix}"/>
</tar>
</target>
<target name="app" depends="load-muant,compress">
<echo>Creating Mac OS X application...</echo>
<mkapp jar="${dist.jar}" dest="${dist.app}" type="APPL" creator="MUCO" icon="${res.package}/osx/icon.icns"
infoversion="0.9" classpath="/System/Library/Java">
<string name="CFBundleName" value="muCommander"/>
<string name="CFBundleIdentifier" value="com.mucommander.muCommander"/>
<string name="CFBundleVersion" value="${app.version}"/>
<boolean name="CFBundleAllowMixedLocalizations" value="true"/>
<string name="CFBundleDevelopmentRegion" value="English"/>
<string name="CFBundleShortVersionString" value="${app.version}"/>
<string name="CFBundleGetInfoString"
value="muCommander ${app.version}, (c) ${app.copyright} ${app.vendor}, ${url.homepage}"/>
<string name="CFBundleInfoDictionaryVersion" value="6.0"/>
<array name="CFBundleDocumentTypes">
<dict>
<array name="CFBundleTypeExtensions">
<string value="*"/>
</array>
<array name="CFBundleTypeMIMETypes">
<string value="*/*"/>
</array>
<array name="CFBundleTypeOSTypes">
<string value="****"/>
</array>
<string name="CFBundleTypeName" value="All"/>
<string name="CFBundleTypeRole" value="Viewer"/>
</dict>
</array>
<dict name="Java">
<string name="MainClass" value="${app.main}"/>
<string name="JVMVersion" value="${source.version}+"/>
<array name="JVMArchs">
<string value="x86_64"/>
<string value="i386"/>
<string value="ppc"/>
</array>
<string name="VMOptions" value="-Xmx128m"/>
<dict name="Properties">
<string name="java.system.class.loader"
value="com.mucommander.commons.file.AbstractFileClassLoader"/>
<string name="com.apple.smallTabs" value="true"/>
<string name="com.apple.hwaccel" value="true"/>
<string name="apple.laf.useScreenMenuBar" value="true"/>
<string name="file.encoding" value="UTF-8"/>
</dict>
</dict>
</mkapp>
</target>
<!-- = Win32 packaging ========================================================================================= -->
<!-- =========================================================================================================== -->
<target name="check-launch4j" depends="load-properties">
<condition property="launch4j.available" value="true">
<and>
<available file="${launch4j.dir}" type="dir"/>
<!-- If the property is defined but empty, it will default to ${user.dir}. We must make sure this -->
<!-- doesn't happen. -->
<not>
<equals arg1="${launch4j.dir}" arg2="${user.dir}" trim="true"/>
</not>
<not>
<equals arg1="${launch4j.dir}" arg2="" trim="true"/>
</not>
</and>
</condition>
<fail message="Launch4j not configured">
<condition>
<and>
<istrue value="${build.pedantic}"/>
<not>
<istrue value="${launch4j.available}"/>
</not>
</and>
</condition>
</fail>
</target>
<target name="load-launch4j" depends="check-launch4j" if="launch4j.available">
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/xstream.jar"/>
</target>
<target name="skip-launch4j" unless="launch4j.available">
<echo>Launch4j not available, skipping executable generation...</echo>
</target>
<target name="make-launch4j" depends="compress" if="launch4j.available">
<echo>Creating Win32 executable...</echo>
<launch4j>
<config headertype="gui" outfile="${dist.exe}" jarpath="mucommander.jar"
icon="${res.package}/windows/mucommander.ico" dontwrapjar="true" chdir="." customprocname="true"
supporturl="${url.homepage}">
<jre minversion="${source.version}.0">
<opt>-Djava.system.class.loader=com.mucommander.commons.file.AbstractFileClassLoader</opt>
</jre>
</config>
</launch4j>
</target>
<target name="launch4j" depends="load-launch4j,make-launch4j,skip-launch4j"/>
<target name="check-nsis" depends="load-properties">
<condition property="nsis.available" value="true">
<and>
<available file="${nsis.dir}" type="dir"/>
<available file="${nsis.bin}" type="file"/>
</and>
</condition>
<fail message="NSIS not available.">
<condition>
<and>
<istrue value="${build.pedantic}"/>
<not>
<istrue value="${nsis.available}"/>
</not>
</and>
</condition>
</fail>
</target>
<target name="make-nsis" depends="launch4j,release-prefixes" if="nsis.available">
<echo>Creating Win32 installer...</echo>
<mkdir dir="${tmp.nsis}"/>
<copy file="${dist.exe}" tofile="${tmp.nsis}/muCommander.exe" overwrite="true"/>
<copy file="${dist.jar}" tofile="${tmp.nsis}/mucommander.jar" overwrite="true"/>
<copy file="${res.package}/windows/mucommander.ico" tofile="${tmp.nsis}/mucommander.ico" overwrite="true"/>
<!-- Makes sure readme.txt and license.txt contain proper windows linebreaks. -->
<fixcrlf srcdir="." destdir="${tmp.nsis}" includes="readme.txt" eol="crlf"/>
<fixcrlf srcdir="${res.runtime}" destdir="${tmp.nsis}" includes="license.txt" eol="crlf"/>
<copy file="${res.package}/windows/mucommander.nsi" tofile="${tmp.nsis}/mucommander.nsi">
<filterset>
<filter token="MU_VERSION" value="${app.version}"/>
<filter token="MU_EXE" value="muCommander.exe"/>
<filter token="MU_JAR" value="mucommander.jar"/>
<filter token="MU_ICON" value="mucommander.ico"/>
<filter token="MU_OUT" value="mucommander-setup.exe"/>
<filter token="MU_README" value="readme.txt"/>
<filter token="MU_LICENSE" value="license.txt"/>
</filterset>
</copy>
<exec executable="${nsis.bin}" failonerror="true">
<arg value="-V3"/>
<arg value="${tmp.nsis}/mucommander.nsi"/>
<!-- Set the NSISDIR environment variable, required for includes to work properly. -->
<env key="NSISDIR" value="${nsis.dir}"/>
</exec>
<copy file="${tmp.nsis}/mucommander-setup.exe" tofile="${dist}/${package.prefix}-setup.exe" overwrite="true"/>
</target>
<target name="skip-nsis" unless="nsis.available">
<echo>Setup generation unavailable, skipping...</echo>
</target>
<target name="nsis" depends="check-nsis,make-nsis,skip-nsis"/>
<!-- = Unix packaging ========================================================================================== -->
<!-- =========================================================================================================== -->
<target name="tgz" depends="compress,release-prefixes">
<echo>Packaging Unix release file...</echo>
<mkdir dir="${tmp.unix}"/>
<copy todir="${tmp.unix}" overwrite="true">
<fileset file="${res.package}/unix/mucommander.sh"/>
<filterset>
<filter token="ARGS" value=""/>
<filter token="JAVA_ARGS"
value="-Djava.system.class.loader=com.mucommander.commons.file.AbstractFileClassLoader"/>
</filterset>
</copy>
<tar destfile="${dist}/${package.prefix}.tar.gz" compression="gzip">
<tarfileset file="${tmp.unix}/mucommander.sh" prefix="${archive.prefix}" mode="755"/>
<tarfileset file="${res.runtime}/license.txt" prefix="${archive.prefix}"/>
<tarfileset file="readme.txt" prefix="${archive.prefix}"/>
<tarfileset file="${dist.jar}" prefix="${archive.prefix}"/>
</tar>
</target>
<!-- Generates the muCommander debian package. -->
<!-- Output will be stored in ${dist}/${deb.name}. -->
<!-- This target will only be executed if JDeb is properly -->
<!-- configured. -->
<target name="deb" depends="load-muant,compress">
<tstamp/>
<condition property="deb.version" value="${app.version}-${DSTAMP}" else="${app.version}">
<istrue value="${build.snapshot}"/>
</condition>
<condition property="deb.name" value="mucommander_current_all.deb"
else="mucommander_${deb.version}_all.deb">
<istrue value="${build.snapshot}"/>
</condition>
<!-- Creates the required directories. -->
<echo>Creating debian release file...</echo>
<mkdir dir="${tmp.deb}"/>
<mkdir dir="${tmp.deb}/control"/>
<mkdir dir="${tmp.deb}/data"/>
<mkdir dir="${tmp.deb}/data/usr/share/mucommander"/>
<taskdef name="jdeb" classname="org.vafer.jdeb.ant.DebAntTask" classpathref="lib.tools"/>
<!-- Copies the debian data files. -->
<copy todir="${tmp.deb}/data/usr/share/mucommander" overwrite="true">
<fileset file="${res.package}/unix/mucommander.sh"/>
<filterset>
<filter token="ARGS" value=""/>
<filter token="JAVA_ARGS"
value="-Djava.system.class.loader=com.mucommander.commons.file.AbstractFileClassLoader"/>
</filterset>
</copy>
<copy todir="${tmp.deb}/data/usr/share/mucommander" overwrite="true">
<fileset file="${res.runtime}/license.txt"/>
<fileset file="readme.txt"/>
<fileset file="${dist.jar}"/>
</copy>
<!-- Generates the data.tar.gz file. -->
<tar destfile="${tmp.deb}/data.tar.gz" compression="gzip">
<tarfileset dir="${tmp.deb}/data/">
<include name="**"/>
<exclude name="**/usr/share/mucommander/mucommander.sh"/>
</tarfileset>
<tarfileset dir="${tmp.deb}/data/" mode="755">
<include name="**/usr/share/mucommander/mucommander.sh"/>
</tarfileset>
</tar>
<!-- Computes the install size. -->
<mksize name="deb.size">
<fileset dir="${tmp.deb}/data"/>
</mksize>
<copy todir="${tmp.deb}/control" overwrite="true">
<fileset dir="${res.package}/unix/deb"/>
<filterset>
<filter token="VERSION" value="${deb.version}"/>
<filter token="SIZE" value="${deb.size}"/>
</filterset>
</copy>
<jdeb destfile="${dist}/${deb.name}" control="${tmp.deb}/control">
<data src="${tmp.deb}/data.tar.gz" type="archive"/>
</jdeb>
</target>
<!-- = Packaging targets ======================================================================================= -->
<!-- =========================================================================================================== -->
<target name="release-prefixes" depends="load-ant-contribs,load-properties">
<condition property="package.prefix.tmp" value="mucommander-${app.version}" else="mucommander-current">
<not>
<istrue value="${build.snapshot}"/>
</not>
</condition>
<propertyregex property="package.prefix" input="${package.prefix.tmp}" regexp="[ .]" replace="_"/>
<!-- propertyregex doesn't set the property if the regexp isn't matched. -->
<condition property="package.prefix" value="${package.prefix.tmp}">
<not>
<isset property="package.prefix"/>
</not>
</condition>
<echo message="Using package prefix: ${package.prefix}"/>
<propertyregex property="archive.prefix" input="muCommander-${app.version}" regexp="[ .]" replace="_"/>
<!-- propertyregex doesn't set the property if the regexp isn't matched. -->
<condition property="archive.prefix" value="muCommander-${app.version}">
<not>
<isset property="archive.prefix"/>
</not>
</condition>
<echo message="Using archive prefix: ${archive.prefix}"/>
</target>
<target name="release" depends="release-prefixes,compile,javadoc,jnlp,version,nsis,app.tgz,portable,tgz,deb"
description="Generates the library's release artifacts.">
<echo>Packaging sources...</echo>
<tar destfile="${dist}/${package.prefix}-src.tar.gz" compression="gzip">
<tarfileset dir="${src}" prefix="${archive.prefix}"/>
</tar>
</target>
<target name="version">
<echo>Creating version file...</echo>
<tstamp/>
<copy file="${res.package}/version.xml" tofile="${dist}/version.xml">
<filterset>
<filter token="VERSION" value="${app.version}"/>
<filter token="DATE" value="${DSTAMP}"/>
<filter token="DOWNLOAD_URL" value="${url.download}"/>
<filter token="JAR_URL" value="${url.jar}"/>
</filterset>
</copy>
</target>
<target name="jnlp" depends="sign,load-muant">
<echo>Creating JNLP file...</echo>
<mkjnlp out="${dist}/${jnlp.file}" spec="1.0+" version="${app.version}" codebase="${url.jnlp}"
href="${jnlp.file}" allpermissions="true">
<information homepage="${url.homepage}" title="muCommander" vendor="Maxence Bernard" offline="true">
<description>A cross-platform file manager.</description>
<description kind="short">A cross-platform file manager.</description>
<icon href="icon.gif" />
</information>
<resources os="Mac OS X">
<property name="com.apple.smallTabs" value="true"/>
<property name="com.apple.hwaccel" value="true"/>
<property name="apple.laf.useScreenMenuBar" value="true"/>
<property name="file.encoding" value="UTF-8"/>
</resources>
<resources>
<j2se version="1.5+"/>
<jar href="mucommander.jar"/>
</resources>
<applicationdesc main="com.mucommander.Launcher"/>
</mkjnlp>
</target>
<!-- = JAR compression ========================================================================================= -->
<!-- =========================================================================================================== -->
<target name="check-7za" depends="load-properties">
<condition property="7za.available" value="true">
<available file="${7za.executable}" type="file"/>
</condition>
<fail message="7za compression unavailable.">
<condition>
<and>
<istrue value="${build.pedantic}"/>
<not>
<istrue value="${7za.available}"/>
</not>
</and>
</condition>
</fail>
</target>
<target name="copy-obfuscated" unless="7za.available">
<echo>7za unavailable, using standard compression...</echo>
<copy file="${jar.obf}" tofile="${dist.jar}"/>
</target>
<target name="compress-obfuscated" if="7za.available">
<echo>Compressing JAR file...</echo>
<mkdir dir="${dist}"/>
<unjar src="${jar.obf}" dest="${tmp.obf}"/>
<exec executable="${7za.executable}" dir="${tmp.obf}" failonerror="true">
<arg value="a"/>
<arg value="-tzip"/>
<arg value="-mm=Deflate"/>
<arg value="-mx9"/>
<arg value="-mfb=258"/>
<arg value="-mpass=15"/>
<arg value="${dist.jar}"/>
<arg value="*"/>
</exec>
</target>
<target name="compress" depends="obfuscate,check-7za,copy-obfuscated,compress-obfuscated"/>
<!-- = JAR signature =========================================================================================== -->
<!-- =========================================================================================================== -->
<target name="check-keystore" depends="load-properties">
<condition property="keystore.available" value="true">
<and>
<isset property="store.pass"/>
<not>
<equals arg1="${store.pass}" arg2="" trim="true"/>
</not>
</and>
</condition>
<fail message="Keystore password unavailable.">
<condition>
<and>
<istrue value="${build.pedantic}"/>
<not>
<istrue value="${keystore.available}"/>
</not>
</and>
</condition>
</fail>
</target>
<target name="skip-sign" unless="keystore.available">
<echo>Keystore password unavailable, skipping JAR signing...</echo>
</target>
<target name="do-sign" if="keystore.available">
<echo>Creating signed JAR file...</echo>
<signjar jar="${dist.jar}" signedjar="${dist.jar.signed}" alias="maxence" keystore="${res.package}/keystore"
storepass="${store.pass}"/>
</target>
<target name="sign" depends="compress,check-keystore,skip-sign,do-sign"/>
<!-- = JAR generation ========================================================================================== -->
<!-- =========================================================================================================== -->
<target name="obfuscate" depends="jar,load-muant">
<libpath property="java.lib" library="rt.jar:classes.jar"/>
<libpath property="jsse.lib" library="jsse.jar"/>
<libpath property="jce.lib" library="jce.jar"/>
<echo>Creating obfuscated JAR file...</echo>
<mkdir dir="${reports.proguard}"/>
<taskdef resource="proguard/ant/task.properties" classpathref="lib.tools"/>
<proguard overloadaggressively="false" ignorewarnings="true" optimize="false" shrink="true" obfuscate="false"
printmapping="${reports.proguard}/mapping.txt" printusage="${reports.proguard}/usage.txt"
printseeds="${reports.proguard}/seeds.txt" allowaccessmodification="false" repackageclasses=""
skipnonpubliclibraryclasses="true" target="${source.version}">
<injar name="${jar.normal}"/>
<outjar name="${jar.obf}"/>
<libraryjar path="${java.lib}"/>
<libraryjar path="${jsse.lib}"/>
<libraryjar path="${jce.lib}"/>
<libraryjar refid="lib.compile"/>
<keepattribute name="exceptions"/>
<!-- Action API uses reflection. -->
<keepclasseswithmembers extends="com.mucommander.ui.action.MuAction">
<constructor access="public" name="*"/>
</keepclasseswithmembers>
<!-- Yanfs uses reflection. -->
<keep name="com.sun.nfs.XFileAccessor"/>
<keep name="com.sun.nfs.XFileExtensionAccessor"/>
<!-- Main class. -->
<keep name="${app.main}">
<method access="public static" type="void" name="main" parameters="java.lang.String[]"/>
</keep>
<!-- Class loader. -->
<keep name="com.mucommander.commons.file.AbstractFileClassLoader">
<field access="public,protected"/>
<method access="public,protected"/>
<constructor access="public,protected"/>
</keep>
<!-- Don't obfuscate the JNA library. -->
<keep name="com.sun.jna.**">
<field name="*"/>
<method name="*"/>
<constructor name="*"/>
</keep>
<keep name="com.sun.jna.ptr.**">
<field name="*"/>
<method name="*"/>
<constructor name="*"/>
</keep>
<keep name="com.sun.jna.win32.**">
<field name="*"/>
<method name="*"/>
<constructor name="*"/>
</keep>
<keep name="com.sun.jna.examples.win32.**">
<field name="*"/>
<method name="*"/>
<constructor name="*"/>
</keep>
<!-- Don't obfuscate Classes that use JNA. -->
<keep extends="com.sun.jna.**">
<field name="*"/>
<method name="*"/>
<constructor name="*"/>
</keep>
<!-- Hadoop HDFS. -->
<keep name="org.apache.hadoop.hdfs.DistributedFileSystem"/>
<keep name="org.apache.hadoop.net.StandardSocketFactory"/>
<keep name="org.apache.hadoop.hdfs.protocol.DatanodeInfo$AdminStates"/>
<!-- Apache Commons logging (Hadoop + JetS3t dependency). -->
<keep name="org.apache.commons.logging.impl.LogFactoryImpl"/>
<keep name="org.apache.commons.logging.impl.Jdk14Logger">
<constructor/>
</keep>
<keep name="org.apache.commons.logging.Log"/>
<!-- Keep Enum methods so that they are still considered as Enum at runtime (Hadoop dependency). -->
<keepclassmembers extends="java.lang.Enum">
<method access="public static"
type="**[]"
name="values"
parameters="" />
<method access="public static"
type="**"
name="valueOf"
parameters="java.lang.String" />
</keepclassmembers>
</proguard>
</target>
<target name="jar" depends="compile">
<tstamp/>
<!-- Extract external libraries to be packed with muCommander, exclusing non-bytecode files. -->
<echo>Unpacking external libraries...</echo>
<mkdir dir="${tmp.libs}"/>
<unjar dest="${tmp.libs}">
<path refid="lib.runtime"/>
<patternset>
<exclude name="**/*.html"/>
<exclude name="**/*.css"/>
<exclude name="**/*.gif"/>
<exclude name="**/*.MF"/>
<exclude name="jcifs/util/mime.map"/>
<exclude name="META-INF/**/*"/>
</patternset>
</unjar>
<mkdir dir="${dist}"/>
<!-- Retrieves the implementation version. -->
<exec executable="svnversion" failifexecutionfails="no" outputproperty="svn.version">
<arg value="."/>
<arg value="-n"/>
</exec>
<echo>Creating JAR file...</echo>
<property name="version.url" value="${url.version}"/>
<jar jarfile="${jar.normal}">
<fileset dir="${tmp.main}"/>
<fileset dir="${tmp.libs}"/>
<manifest>
<attribute name="Main-Class" value="${app.main}"/>
<attribute name="Specification-Title" value="${app.name}"/>
<attribute name="Specification-Vendor" value="${app.vendor}"/>
<attribute name="Specification-Version" value="${app.version}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Vendor" value="${app.vendor}"/>
<attribute name="Implementation-Version" value="${svn.version}"/>
<attribute name="Build-Date" value="${DSTAMP}"/>
<attribute name="Build-URL" value="${version.url}"/>
</manifest>
</jar>
</target>
<!-- = Documentation targets =================================================================================== -->
<!-- =========================================================================================================== -->
<target name="javadoc" depends="retrieve-runtime,release-prefixes">
<echo>Creating API javadoc...</echo>
<mkdir dir="${docs}"/>
<javadoc destdir="${docs}" author="true" windowtitle="${app.name}" doctitle="${app.name}" encoding="UTF-8"
access="protected" classpathref="lib.runtime">
<packageset dir="${src.main}" defaultexcludes="yes"/>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
</javadoc>
<mkdir dir="${dist}"/>
<tar destfile="${dist}/${package.prefix}-docs.tar.gz" compression="gzip">
<tarfileset dir="${docs}" prefix="${archive.prefix}"/>
</tar>
</target>
<!-- = Reports targets ========================================================================================= -->
<!-- =========================================================================================================== -->
<target name="reports" depends="checkstyle,pmd,cpd,javancss,findbugs,ivy,test" description="Generates all available reports."/>
<target name="javancss" depends="retrieve-tools" description='Generates JavaNCSS reports.'>
<echo>Generating JavaNCSS reports...</echo>
<taskdef name="javancss" classname="javancss.JavancssAntTask" classpathref="lib.tools"/>
<mkdir dir="${javancss.reports}"/>
<javancss srcdir="${src.main}" includes="**/*.java" generateReport="true"
outputfile="${javancss.reports}/javancss.xml" format="xml"/>
<xslt in="${javancss.reports}/javancss.xml" out="${javancss.reports}/javancss.html"
style="${lib.tools}/mucommander/javancss.xsl"/>
</target>
<target name="checkstyle" depends="compile,retrieve-tools" description='Generates CheckStyle reports.'>
<echo>Generating CheckStyle reports...</echo>
<mkdir dir="${checkstyle.reports}"/>
<taskdef resource="checkstyletask.properties" classpathref="lib.tools"/>
<checkstyle config="${lib.tools}/mucommander/checkstyle.xml" failOnViolation="false">
<fileset dir="${src.main}" includes="**/*.java"/>
<formatter type="xml" toFile="${checkstyle.reports}/checkstyle.xml"/>
<classpath>
<pathelement location="${tmp.main}"/>
<path refid="lib.runtime"/>
</classpath>
</checkstyle>
<xslt in="${checkstyle.reports}/checkstyle.xml" out="${checkstyle.reports}/checkstyle.html"
style="${lib.tools}/mucommander/checkstyle.xsl">
<param name="root" expression="${src.main}/"/>
</xslt>
</target>
<target name="pmd" depends="retrieve-tools,compile" description="Generates PMD reports.">
<echo>Generating PMD report...</echo>
<taskdef classpathref="lib.tools" name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<mkdir dir="${pmd.reports}"/>
<pmd encoding="${source.encoding}" rulesetfiles="${lib.tools}/mucommander/pmd.xml">
<formatter type="xml" toFile="${pmd.reports}/pmd.xml"/>
<auxclasspath path="${tmp.main}"/>
<auxclasspath refid="lib.runtime"/>
<fileset dir="${src.main}">
<include name="**/*.java"/>
</fileset>
</pmd>
<xslt in="${pmd.reports}/pmd.xml" out="${pmd.reports}/pmd.html"
style="${lib.tools}/mucommander/pmd.xsl">
<param name="root" expression="${src.main}/"/>
</xslt>
</target>
<target name="cpd" depends="retrieve-tools" description="Generates CPD reports.">
<echo>Generating CPD reports...</echo>
<taskdef name="cpd" classpathref="lib.tools" classname="net.sourceforge.pmd.cpd.CPDTask" />
<property file="${lib.tools}/mucommander/cpd.properties"/>
<mkdir dir="${cpd.reports}"/>
<cpd minimumTokenCount="${cpd.tokens}" encoding="${source.encoding}" format="xml" outputFile="${cpd.reports}/cpd.xml"
ignoreidentifiers="${cpd.ignoreIdentifiers}" ignoreliterals="${cpd.ignoreLiterals}">
<fileset dir="${src.main}">
<include name="**/*.java"/>
</fileset>
</cpd>
<xslt in="${cpd.reports}/cpd.xml" out="${cpd.reports}/cpd.html"
style="${lib.tools}/mucommander/cpd.xsl">
<param name="root" expression="${src.main}/"/>
</xslt>
</target>
<target name="findbugs" depends="retrieve-tools" description="Generates FindBugs reports.">
<echo>Generating FindBugs reports...</echo>
<taskdef classpathref="lib.tools" name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<mkdir dir="${findbugs.reports}"/>
<findbugs classpathref="lib.tools" output="xml:withMessages" outputFile="${findbugs.reports}/findbugs.xml"
effort="max" jvmargs="-Xmx512m" excludefilter="${lib.tools}/mucommander/findbugs.xml">
<auxClasspath>
<path refid="lib.runtime"/>
</auxClasspath>
<sourcePath path="${src.main}"/>
<class location="${tmp.main}"/>
</findbugs>
<xslt in="${findbugs.reports}/findbugs.xml" out="${findbugs.reports}/findbugs.html"
style="${lib.tools}/mucommander/findbugs.xsl"/>
</target>
<target name="ivy" depends="ivy-config" description="Generates Ivy dependency reports." unless="ivy.offline">
<echo>Generating Ivy dependency report...</echo>
<mkdir dir="${ivy.reports}"/>
<ivy:report todir="${ivy.reports}" xml="true" graph="false" conf="runtime,test,tools"/>
</target>
<!-- = Maintenance targets ===================================================================================== -->
<!-- =========================================================================================================== -->
<target name="all" description="Generates all reports and release files." depends="reports,release"/>
<target name="load-properties">
<condition property="build.properties" value="build.properties">
<available file="build.properties"/>
</condition>
<property name="build.properties" value="build_template.properties"/>
<echo message="Using properties file: ${build.properties}"/>
<property file="${build.properties}"/>
</target>
<target name="load-muant" depends="retrieve-tools">
<taskdef resource="com/mucommander/commons/ant/antlib.xml" classpathref="lib.tools"/>
</target>
<target name="load-ant-contribs" depends="retrieve-tools">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="lib.tools"/>
</target>
<target name="clean" description="Deletes all temporary files.">
<echo>Deleting temporary files...</echo>
<delete dir="${tmp}"/>
<delete dir="${dist}"/>
<delete dir="${reports}"/>
<delete dir="${docs}"/>
<delete includeEmptyDirs="true">
<fileset dir="." includes="**/*~" defaultexcludes="no"/>
</delete>
</target>
<target name="clean-all" depends="clean" description="Deletes all libraries imported by Ivy and temporary files.">
<echo>Deleting external libraries...</echo>
<delete dir="${lib}"/>
</target>
<!-- = Dependencies targets ==================================================================================== -->
<!-- =========================================================================================================== -->
<target name="offline" description="Forces usage of the ivy cache.">
<property name="ivy.cache.ttl.default" value="eternal"/>
<property name="ivy.offline" value="true"/>
</target>
<target name="synchronize" description="Forces synchronisation of all dependencies."
depends="retrieve-runtime,retrieve-test,retrieve-tools,retrieve-compile"/>
<target name="ivy-config" unless="ivy.offline">
<echo>Resolving dependencies repository...</echo>
<ivy:configure/>
<ivy:resolve file="${res.ivy}/ivy.xml" haltonfailure="false"/>
</target>
<target name="retrieve-runtime" depends="ivy-config" unless="ivy.offline">
<echo>Retrieving runtime libraries...</echo>
<ivy:retrieve symlink="true" conf="runtime" type="jar"/>
</target>
<target name="retrieve-compile" depends="ivy-config" unless="ivy.offline">
<echo>Retrieving compile time libraries...</echo>
<ivy:retrieve symlink="true" conf="compile" type="jar"/>
</target>
<target name="retrieve-tools" depends="ivy-config" unless="ivy.offline">
<echo>Retrieving external tools...</echo>
<ivy:retrieve symlink="true" conf="tools" type="jar,conf"/>
</target>
<target name="retrieve-test" depends="ivy-config" unless="ivy.offline">
<echo>Retrieving test dependencies...</echo>
<ivy:retrieve symlink="true" conf="test" type="jar"/>
</target>
<!-- = Application launching targets =========================================================================== -->