forked from HDFGroup/hdfview
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
2515 lines (2267 loc) · 114 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"?>
<project name="HDFView" basedir="." default="main"
xmlns:fx="javafx:com.sun.javafx.tools.ant"
xmlns:sonar="antlib:org.sonar.ant"
xmlns:jacoco="antlib:org.jacoco.ant"
xmlns:doxygen="antlib:org.doxygen.tools"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<property environment="env" />
<!-- Configuration files: -->
<property file="build.properties" />
<property file="package.properties" />
<record name="antoutput.log" action="start" append="${build.antoutput.append}" loglevel="verbose" />
<property name="sign_state" value="${env.BINSIGN}" />
<condition property="sign.enable">
<equals arg1="${sign_state}" arg2="exists" />
</condition>
<!-- MAC signing: -->
<property name="sign.account" value="${env.SIGNER}" />
<property name="pass.keychain_key" value="${env.KEYCHAIN_PASSWD}" />
<property name="name.keychain_key" value="${env.KEYCHAIN_NAME}.keychain" />
<!-- MAC notary: -->
<property name="notarize.account" value="${env.NOTARY_USER}" />
<property name="notarize.keychain_key" value="${env.NOTARY_KEY}" />
<!-- Get HDFView, HDF4, HDF5 and HDF-Java version information -->
<loadfile property="app.version" srcFile="${basedir}/VERSION">
<filterchain>
<tokenfilter>
<stringtokenizer delims="-\r\n" suppressdelims="true" />
<containsregex pattern="[0-9]+\.[0-9]+\.[0-9]+" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- Optional hdf4 -->
<property name="hdf4.settings.version" value="${hdf.lib.dir}/libhdf4.settings" />
<condition property="h4path" value="${hdf.lib.dir}">
<available file="${hdf4.settings.version}" />
</condition>
<property name="h4.object.path" value="hdf/object/h4/**"/>
<condition property="h4.object.path.files" value="${h4.object.path}.java">
<isset property="h4path"/>
</condition>
<!-- Required hdf5 -->
<property name="hdf5.settings.version" value="${hdf5.lib.dir}/libhdf5.settings" />
<condition property="h5path" value="${hdf5.lib.dir}">
<available file="${hdf5.settings.version}" />
</condition>
<property name="h5.object.path" value="hdf/object/h5/**"/>
<condition property="h5.object.path.files" value="${h5.object.path}.java">
<isset property="h5path"/>
</condition>
<!-- Other types -->
<property name="fits.object.path" value="hdf/object/fits/**"/>
<property name="nc2.object.path" value="hdf/object/nc2/**"/>
<property name="all.object.path" value="${fits.object.path} ${nc2.object.path} ${h4.object.path} ${h5.object.path}"/>
<property name="hdf.view.path" value="hdf/view/**"/>
<property name="examples.path" value="examples/**"/>
<property name="test.path" value="test/**"/>
<property name="examples.test.path" value="${examples.path} ${test.path}"/>
<loadfile property="hdf4.version" srcFile="${hdf4.settings.version}" failonerror="false">
<filterchain>
<tokenfilter>
<linetokenizer />
<containsregex pattern="HDF4 Version:" />
</tokenfilter>
<tokenfilter>
<stringtokenizer delims=":- \r\n" suppressdelims="true" />
<containsregex pattern="[0-9]+\.[0-9]+\.[0-9]+" />
</tokenfilter>
</filterchain>
</loadfile>
<loadfile property="hdf5.version" srcFile="${hdf5.settings.version}">
<filterchain>
<tokenfilter>
<linetokenizer />
<containsregex pattern="HDF5 Version:" />
</tokenfilter>
<tokenfilter>
<stringtokenizer delims=":- \r\n" suppressdelims="true" />
<containsregex pattern="[0-9]+\.[0-9]+\.[0-9]+" />
</tokenfilter>
</filterchain>
</loadfile>
<!-- platform type -->
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isMac">
<os family="mac" />
</condition>
<condition property="isUnix">
<and>
<os family="unix" />
<not>
<equals arg1="${isMac}" arg2="true" />
</not>
</and>
</condition>
<condition property="machine.os" value="win">
<equals arg1="${isWindows}" arg2="true" />
</condition>
<condition property="machine.os" value="osx">
<and>
<equals arg1="${isMac}" arg2="true" />
<not>
<equals arg1="${isWindows}" arg2="true" />
</not>
<not>
<equals arg1="${isUnix}" arg2="true" />
</not>
</and>
</condition>
<condition property="machine.os" value="linux">
<and>
<equals arg1="${isUnix}" arg2="true" />
<not>
<equals arg1="${isWindows}" arg2="true" />
</not>
<not>
<equals arg1="${isMac}" arg2="true" />
</not>
</and>
</condition>
<exec executable="hostname" outputproperty="computer.hostname"/>
<condition property="isUbuntu">
<contains string="${computer.hostname}" substring="ubuntu" />
</condition>
<!-- Build 64-bit binary.
Note: os.arch gives the architecture of the JVM, NOT the OS;
It is assumed that a ppc JVM is used for building on a powerpc system. -->
<condition property="machine.arch" value="ppc64le">
<and>
<matches pattern="ppc64le" string="${os.arch}" />
<equals arg1="${isUnix}" arg2="true" />
<not>
<equals arg1="${isWindows}" arg2="true" />
</not>
<not>
<equals arg1="${isMac}" arg2="true" />
</not>
</and>
</condition>
<condition property="machine.arch" value="aarch64" else="x86_64">
<matches pattern="aarch64" string="${os.arch}" />
</condition>
<condition property="machine.wix.arch" value="x64">
<equals arg1="${isWindows}" arg2="true" />
</condition>
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property name="src.dir" value="src" />
<property name="hdfview.dir" value="org.hdfgroup.hdfview" />
<property name="object.dir" value="org.hdfgroup.object" />
<property name="fits.dir" value="org.hdfgroup.object" />
<property name="nc2.dir" value="org.hdfgroup.object" />
<property name="h4.dir" value="org.hdfgroup.object" />
<property name="h5.dir" value="org.hdfgroup.object" />
<property name="testsrc.dir" value="test" />
<property name="test.dir" value="org.hdfgroup.object.test" />
<property name="examples.dir" value="org.hdfgroup.object.example.test" />
<property name="test.hdfview.dir" value="org.hdfgroup.hdfview.test" />
<property name="samples.dir" value="samples" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="testclasses.dir" value="${classes.dir}/${test.dir}" />
<property name="uitestclasses.dir" value="${classes.dir}/${test.hdfview.dir}" />
<property name="hdf4uitestclasses.dir" value="${uitestclasses.dir}/uitest/HDF4UITests" />
<property name="hdf5uitestclasses.dir" value="${uitestclasses.dir}/uitest/HDF5UITests" />
<property name="exclasses.dir" value="${classes.dir}/${examples.dir}" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="report.dir" value="${build.dir}/junitreport" />
<property name="javadoc.dir" value="${build.dir}/javadocs" />
<property name="docs.dir" value="docs" />
<property name="bin.dir" value="bin" />
<property name="lib.dir" value="lib" />
<property name="packagefiles.dir" value="package_files" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="release.dir" value="${build.dir}/HDF_Group/${ant.project.name}/${app.version}" />
<property name="includeantruntime" value="false" />
<property name="jre.version" value="${ant.java.version}" />
<property name="version.slf4j" value="-2.0.6" />
<!-- Define the SonarQube global properties (the most usual way is to pass these properties via the command line) -->
<property name="sonar.host.url" value="http://localhost:9000" />
<!-- Define the SonarQube project properties -->
<property name="sonar.projectKey" value="org.sonarqube:sonarqube-scanner-ant" />
<property name="sonar.projectName" value="HDFView-development" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="${src.dir}/hdf" />
<property name="sonar.java.binaries" value="${classes.dir}" />
<property name="sonar.tests" value="${testsrc.dir}" />
<property name="sonar.sourceEncoding" value="UTF-8" />
<property name="sonar.language" value="java" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPaths" value="${report.dir}/jacoco.exec" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<path id="obj-classpath">
<fileset dir="${lib.dir}" includes="fits.jar netcdf.jar" excludes="*sources.jar" />
</path>
<path id="swt-classpath">
<fileset file="${lib.dir}/ext/swt/${machine.os}/${machine.arch}/swt.jar" />
<fileset dir="${lib.dir}/ext/swt" includes="*.jar" />
</path>
<path id="jni4-classpath">
<fileset dir="${hdf.lib.dir}" includes="jarhdf*.jar" />
</path>
<path id="jni5-classpath">
<fileset dir="${hdf5.lib.dir}" includes="jarhdf5*.jar" />
</path>
<path id="slf4j-classpath">
<fileset dir="${lib.dir}" includes="slf4j-api${version.slf4j}.jar" excludes="*sources.jar" />
</path>
<path id="log-classpath">
<fileset dir="${lib.dir}/extra" includes="slf4j-simple${version.slf4j}.jar" excludes="*sources.jar" />
</path>
<path id="nop-classpath">
<fileset dir="${lib.dir}/extra" includes="slf4j-nop${version.slf4j}.jar" excludes="*sources.jar" />
</path>
<path id="unit-classpath">
<fileset dir="${lib.dir}" includes="org.junit.jar org.hamcrest.jar" excludes="*sources.jar" />
</path>
<path id="swtbot-classpath">
<fileset dir="${lib.dir}/ext/swt/swtbot" includes="*swtbot*.jar *log4j*.jar" excludes="*sources.jar" />
</path>
<path id="build-classpath">
<fileset dir="${classes.dir}" excludes="*.properties" />
</path>
<path id="ui-test4-sources">
<fileset dir="${src.dir}/" includes="**/uitest/*Test*.java" excludes="**/uitest/*CLGeometry.java **/uitest/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF4UITests/*Test*.java" excludes="**/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF4UITests/BugFixTests/*Test*.java" excludes="**/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF4UITests/FeatureTests/*Test*.java" excludes="**/*All*.java" />
</path>
<path id="ui-test5-sources">
<fileset dir="${src.dir}/" includes="**/uitest/*Test*.java" excludes="**/uitest/*CLGeometry.java **/uitest/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF5UITests/*Test*.java" excludes="**/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF5UITests/BugFixTests/*Test*.java" excludes="**/*All*.java" />
<fileset dir="${src.dir}/" includes="**/uitest/HDF5UITests/FeatureTests/*Test*.java" excludes="**/*All*.java" />
</path>
<path id="object-classpath">
<path refid="obj-classpath" />
<path refid="jni4-classpath" />
<path refid="jni5-classpath" />
<path refid="slf4j-classpath" />
<path refid="log-classpath" />
</path>
<path id="project-classpath">
<path refid="obj-classpath" />
<path refid="jni4-classpath" />
<path refid="jni5-classpath" />
<path refid="swt-classpath" />
<path refid="slf4j-classpath" />
<path refid="log-classpath" />
<path refid="swtbot-classpath" />
</path>
<path id="view-classpath">
<path refid="hdfobject-jar" />
<path refid="swt-classpath" />
<path refid="slf4j-classpath" />
<path refid="nop-classpath" />
</path>
<path id="test-classpath">
<path refid="project-classpath" />
<path refid="unit-classpath" />
<path refid="swtbot-classpath" />
<path refid="hdfobject-jar" />
<path refid="application" />
</path>
<property name="main-class" value="hdf.view.HDFView" />
<echo>
Application: ${ant.project.name} ${app.version}
Build File: ${ant.file}
<!-- Run Date : ${build.time} -->
Run by: ${user.name}
Build Dir: ${build.dir}
Base Dir: ${basedir}
Dist Dir: ${dist.dir}
Java Home: ${java.home}
HDF libpath: ${hdf.lib.dir},${hdf5.lib.dir}
HDF4 version: ${hdf4.version}
HDF5 version: ${hdf5.version}
Operating System: ${os.name} ${os.version} ${os.arch}
Debug Build: ${build.debug}
</echo>
<echo if:set="isMac">running on MacOS</echo>
<echo if:set="isUnix">running on Unix</echo>
<echo if:set="isWindows">running on Windows</echo>
<target name="clean" description="Cleans up the build directory">
<delete dir="${classes.dir}" />
<delete dir="${jar.dir}" />
<delete dir="${report.dir}" />
<delete dir="${javadoc.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${release.dir}" />
<delete dir="${build.dir}" />
<mkdir dir="${classes.dir}/${object.dir}" />
<mkdir dir="${classes.dir}/${hdfview.dir}" />
<mkdir dir="${classes.dir}/hdf" />
</target>
<target name="clean-build" depends="clean,objectjar,jar" />
<target name="clean-package">
<delete dir="${dist.dir}" />
</target>
<!-- Store compile-time Version information -->
<target name="create-property-file">
<propertyfile file="${classes.dir}/hdf/versions.properties">
<entry key="JAVA_VERSION" value="${ant.java.version}"/>
<entry key="HDF4_VERSION" value="${hdf4.version}"/>
<entry key="HDF5_VERSION" value="${hdf5.version}"/>
<entry key="HDFVIEW_VERSION" value="${app.version}"/>
</propertyfile>
</target>
<target name="compile" depends="clean, create-property-file, compileobj, compilehdf4, compilefits, compilenc2, compilehdf5">
<javac modulesourcepath="${src.dir}" modulepathref="project-classpath" destdir="${classes.dir}"
classpathref="project-classpath"
excludes="${examples.test.path} **/*.in **/*.gif **/*.png **/*.icns **/*.html **/*.properties"
includeantruntime="false" debug="${build.debug}" />
<copy todir="${classes.dir}/${hdfview.dir}">
<fileset dir="${src.dir}/${hdfview.dir}"
excludes="${all.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<path id="build-classpath" location="${classes.dir}" />
<target name="compileobj" depends="clean">
<copy todir="${classes.dir}/${object.dir}">
<fileset dir="${src.dir}/${object.dir}"
excludes="${hdf.view.path} ${all.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<target name="compilehdf4" depends="clean" if="h4path">
<copy todir="${classes.dir}/${h4.dir}">
<fileset dir="${src.dir}/${h4.dir}"
excludes="${hdf.view.path} ${fits.object.path} ${nc2.object.path} ${h5.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<target name="compilefits" depends="clean">
<copy todir="${classes.dir}/${fits.dir}">
<fileset dir="${src.dir}/${fits.dir}"
excludes="${hdf.view.path} ${nc2.object.path} ${h4.object.path} ${h5.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<target name="compilenc2" depends="clean">
<copy todir="${classes.dir}/${nc2.dir}">
<fileset dir="${src.dir}/${nc2.dir}"
excludes="${hdf.view.path} ${fits.object.path} ${h4.object.path} ${h5.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<target name="compilehdf5" depends="clean">
<copy todir="${classes.dir}/${h5.dir}">
<fileset dir="${src.dir}/${h5.dir}"
excludes="${hdf.view.path} ${fits.object.path} ${nc2.object.path} ${h4.object.path} **/*.in **/*.java ${examples.test.path}" />
</copy>
</target>
<target name="objectjar" depends="compile">
<mkdir dir="${jar.dir}" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="object-classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${jar.dir}/hdfobject.jar"
excludes="${hdf.view.path} ${examples.test.path} *.log *.h5 *.data">
<fileset dir="${classes.dir}/${object.dir}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${classes.dir}/${fits.dir}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${classes.dir}/${nc2.dir}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${classes.dir}/${h4.dir}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${classes.dir}/${h5.dir}">
<include name="**/*.class"/>
</fileset>
<manifest>
<attribute name="Class-Path" value="${manifest.classpath}" />
</manifest>
</jar>
</target>
<path id="hdfobject-jar" location="${jar.dir}/hdfobject.jar" />
<target name="modulejar" depends="compile-uitest, compile-test">
<mkdir dir="${testclasses.dir}/lib/ext" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="view-classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${testclasses.dir}/lib/ext/test.modules.TestModuleLoading.jar"
includes="test/modules/**" excludes="Test*.java *.h5" />
</target>
<target name="jar" depends="compile, objectjar">
<mkdir dir="${jar.dir}" />
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="view-classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
</chainedmapper>
</mapper>
</pathconvert>
<jar destfile="${jar.dir}/${ant.project.name}.jar" excludes="${examples.test.path} *.log *.h5 *.data">
<fileset dir="${classes.dir}/${hdfview.dir}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${classes.dir}/${hdfview.dir}">
<include name="**/*.ico"/>
</fileset>
<fileset dir="${classes.dir}/${hdfview.dir}">
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="${classes.dir}/hdf">
<include name="versions.properties"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Class-Path" value="${manifest.classpath}" />
</manifest>
</jar>
</target>
<path id="application" location="${jar.dir}/${ant.project.name}.jar" />
<!-- SWT on Mac requires the -XstartOnFirstThreadFlag. -->
<condition property="XstartOnFirstThreadFlag" value="-XstartOnFirstThread" else="-Dgwt.dummy.arg1=">
<os family="mac" />
</condition>
<target name="rundebug" depends="deploy,jar" description="Runs the application with remote debugger">
<mkdir dir="${jar.dir}/lib/ext" />
<java fork="true" classname="${main-class}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.run}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432" />
<classpath>
<path refid="project-classpath" />
<path refid="log-classpath" />
<path refid="hdfobject-jar" />
<path refid="application" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<sysproperty key="hdfview.root" path="${basedir}/${jar.dir}" />
<!-- <sysproperty key="hdfview.workdir" path="${basedir}/${jar.dir}" /> -->
<env key="HDF5_PLUGIN_PATH" path="${hdf5.plugin.dir}" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
</java>
</target>
<target name="run" depends="deploy,jar" description="Runs the application">
<mkdir dir="${jar.dir}/lib/ext" />
<java fork="true" classname="${main-class}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.run}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<classpath>
<path refid="project-classpath" />
<path refid="log-classpath" />
<path refid="obj-classpath" />
<path refid="hdfobject-jar" />
<path refid="application" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<sysproperty key="hdfview.root" path="${basedir}/${jar.dir}" />
<!-- <sysproperty key="hdfview.workdir" path="${basedir}/${jar.dir}" /> -->
<env key="HDF5_PLUGIN_PATH" path="${hdf5.plugin.dir}" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
</java>
</target>
<target name="run-jar" depends="jar" description="Runs the application directly from the .jar file">
<mkdir dir="${jar.dir}/lib" />
<mkdir dir="${jar.dir}/lib/ext" />
<copy todir="${jar.dir}/lib">
<fileset dir="${lib.dir}" includes="fits.jar netcdf.jar" excludes="*sources.jar" />
<fileset dir="${hdf.lib.dir}" includes="*.jar" excludes="slf4j*.jar" />
<fileset dir="${hdf5.lib.dir}" includes="*.jar" excludes="slf4j*.jar" />
</copy>
<java fork="true" jar="${jar.dir}/${ant.project.name}.jar">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.run}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<sysproperty key="java.library.path" path="${hdf.lib.dir}${path.separator}${hdf5.lib.dir}" />
<sysproperty key="hdfview.root" path="${basedir}/${jar.dir}" />
<!-- <sysproperty key="hdfview.workdir" path="${basedir}/${jar.dir}" /> -->
<env key="HDF5_PLUGIN_PATH" path="${hdf5.plugin.dir}" />
</java>
</target>
<!-- =================================================================
EXAMPLES
================================================================= -->
<target name="compile-examples" depends="compile, jar">
<copy todir="${exclasses.dir}">
<fileset dir="${testsrc.dir}/${examples.dir}" excludes=" **/*.in **/*.java hdf/** ${test.path}" />
</copy>
</target>
<target name="run-examples" depends="compile-examples" description="Runs the examples">
<fileset dir="${exclasses.dir}" includes="**/*.class" excludes="**/*$* **/*.txt testfiles/**" />
</target>
<target name="run-one-example" depends="deploy,compile-test" description="Runs one example">
<dirname property="exfile.dir" file="${build.exfile}" />
<basename property="exdir.name" file="${exfile.dir}" />
<basename property="exfile.name" file="${build.exfile}" suffix=".class" />
<property name="exdir.rel" value="${exclasses.dir}" relative="yes" />
<basename property="exdirrel.name" file="${exdir.rel}" />
<echo message="Test example: ${exfile.name}" />
<java fork="true" classname="${exfile.name}" dir="${classes.dir}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.test}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg line="${exfile.name}.class" />
<classpath>
<path refid="project-classpath" />
<path refid="log-classpath" />
<path refid="hdfobject-jar" />
<pathelement location="${exclasses.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
</java>
</target>
<target name="clean-examples">
<delete>
<fileset dir="${exclasses.dir}" includes="**/*.h5" />
</delete>
</target>
<!-- =================================================================
TESTS
================================================================= -->
<target name="compile-test" depends="objectjar, jar, compile-objtest, compile-uitest, compile-examples">
<javac modulesourcepath="${testsrc.dir}" modulepathref="test-classpath" modulepath="build-classpath"
destdir="${classes.dir}"
classpathref="test-classpath"
includes="**/*.java"
includeantruntime="false" debug="${build.debug}">
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="compile-objtest" depends="objectjar, jar">
<copy todir="${testclasses.dir}">
<fileset dir="${testsrc.dir}/${test.dir}" excludes=" **/JUnit*.txt **/*.err **/*.in **/*.java hdf/** ${examples.path}" />
</copy>
<mkdir dir="${testclasses.dir}/lib/ext" />
</target>
<target name="compile-uitest" depends="objectjar, jar">
<copy todir="${uitestclasses.dir}">
<fileset dir="${testsrc.dir}/${test.hdfview.dir}" excludes=" **/JUnit*.txt **/*.err **/*.in **/*.java hdf/** ${examples.path}" />
</copy>
<mkdir dir="${uitestclasses.dir}/lib/ext" />
</target>
<target name="compile-uimodtest" depends="modulejar, jar">
<copy todir="${testclasses.dir}/${test.dir}">
<fileset dir="${testsrc.dir}/${test.dir}" excludes=" **/JUnit*.txt **/*.err **/*.in **/*.java hdf/** ${examples.path}" />
</copy>
<!--<mkdir dir="${testclasses.dir}/lib/ext" /> -->
</target>
<path id="alltest-classes" location="${testclasses.dir}" />
<target name="clean-junit-uitest">
<delete>
<filelist dir="${uitestclasses.dir}" files="
closebutton.hdf,
dataset_saveto_test.h5,
image_saveto_test.h5,
group_saveto_test.h5,
testopenbutton.hdf,
testopenfile.hdf,
testopenrofile.h5,
testfile.hdf,
testfile.h5,
apollo17_earth.jpg.hdf,
apollo17_earth.jpg.h5,
test_libversion.h5,
closefile.hdf,
closeallfile.hdf,
closeallfile.h5,
testsavefile.h5,
testsaveasfile.h5,
testsaveasfile2.h5,
test_tab_import.h5,
test_comma_import.h5,
test_space_import.h5,
test_colon_import.h5,
test_semicolon_import.h5,
test_large_dataset.h5,
testintsfile2.h5,
testlinks.h5,
testgrp.h5,
testds.h5,
DS16BITS.txt,
float3D.txt,
DU32BITS.txt,
chunked.txt,
CompoundInts.txt,
DS64BITS.txt,
DU64BITS.bin" />
</delete>
<mkdir dir="${uitestclasses.dir}" />
</target>
<target name="jacoco" depends="jacoco-skip, jacoco-run" />
<!-- Define jacoco Scanner for Ant Target -->
<target name="jacoco-run" if="${build.jacoco}">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" onerror="ignore">
<classpath path="/opt/jacoco-0.8.3/lib/jacocoant.jar" />
</taskdef>
<jacoco:agent property="agentvmparam" destfile="${report.dir}/jacoco.exec" xmlns:jacoco="antlib:org.jacoco.ant" />
</target>
<target name="jacoco-skip" unless="${build.jacoco}">
<property name="agentvmparam" value="" />
</target>
<target name="junit-debug-test" depends="deploy,objectjar,clean-junit-uitest,compile-test,jacoco">
<mkdir dir="${report.dir}" />
<junit showoutput="yes" enabletestlistenerevents="true" fork="yes" printsummary="withOutAndErr" dir="${classes.dir}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.test}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg line="${agentvmparam}" />
<jvmarg value="-Xdebug" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432" />
<classpath>
<path refid="test-classpath" />
<path refid="build-classpath" />
<pathelement location="${testclasses.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
<test name="${build.object.test}" todir="${report.dir}" outfile="TEST-${build.object.test}">
<formatter type="plain" />
</test>
</junit>
</target>
<target name="junit-single-test" depends="deploy,objectjar,clean-junit-uitest,compile-test,jacoco">
<mkdir dir="${report.dir}" />
<junit showoutput="yes" enabletestlistenerevents="true" fork="yes" printsummary="withOutAndErr" dir="${classes.dir}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.test}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg line="${agentvmparam}" />
<classpath>
<path refid="test-classpath" />
<path refid="build-classpath" />
<pathelement location="${testclasses.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
<test name="${build.object.test}" todir="${report.dir}" outfile="TEST-${build.object.test}">
<formatter type="plain" />
</test>
</junit>
</target>
<target name="junit" depends="deploy,objectjar,clean-junit-uitest,compile-test,jacoco" description="Runs the Object Library tests">
<mkdir dir="${report.dir}" />
<junit showoutput="yes" enabletestlistenerevents="true" fork="yes" printsummary="withOutAndErr" dir="${classes.dir}">
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.test}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg line="${agentvmparam}" />
<classpath>
<path refid="test-classpath" />
<path refid="build-classpath" />
<pathelement location="${testclasses.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
<formatter type="xml" />
<formatter type="plain" />
<batchtest fork="yes" todir="${report.dir}">
<fileset dir="${testclasses.dir}/" includes="**/object/*Test*" excludes="**/object/*All*,**/object/H5Test*" />
</batchtest>
</junit>
</target>
<!-- Define SonarQube Scanner for Ant Target -->
<target name="sonar" depends="jacoco, junit, junit-uitest">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml" onerror="ignore">
<!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
<classpath path="~/.ant/lib/sonarqube-ant-task-*.jar" />
</taskdef>
<!-- Execute SonarQube Scanner for Ant Analysis -->
<sonar:sonar />
</target>
<target name="ensure-test4-name" unless="test">
<!-- Capture the path as a delimited property using the refid attribute -->
<pathconvert pathsep="${line.separator}" property="filesetref" refid="ui-test4-sources">
<!-- the path stripped -->
<mapper>
<flattenmapper />
</mapper>
</pathconvert>
<!-- Emit the property to the ant console -->
<echo message="Where TestName is the the base name of: ${filesetref}" />
<fail message="You must run this target with -Dtest=TestName" />
</target>
<target name="ensure-test5-name" unless="test">
<!-- Capture the path as a delimited property using the refid attribute -->
<pathconvert pathsep="${line.separator}" property="fileset5ref" refid="ui-test5-sources">
<!-- the path stripped -->
<mapper>
<flattenmapper />
</mapper>
</pathconvert>
<!-- Emit the property to the ant console -->
<echo message="Where TestName is the the base name of: ${filesetref}" />
<fail message="You must run this target with -Dtest=TestName" />
</target>
<!-- Macro for common code for running a junit task. The two attributes that are changeable
correspond to the HDFView sysproperties 'hdfview.root' and 'hdfview.workdir'. By changing
these to the appropriate paths, UI tests in different nested folder structures are able
to find the test files they are looking for simply by name, instead of having to specify
a relative pathname. -->
<macrodef name="run-ui-junit">
<attribute name="rootdir" default="${basedir}/${uitestclasses.dir}" />
<attribute name="workdir" default="${basedir}/${uitestclasses.dir}/uitest" />
<attribute name="propfile" default="${user.home}/.hdfview${app.version}" />
<attribute name="includes" default="**/*Test*" />
<attribute name="excludes" default="**/*All* **/*$*" />
<attribute name="if" default="" />
<sequential>
<echo message="JUnit Testing: @{includes}" />
<junit showoutput="yes" enabletestlistenerevents="true" fork="yes" printsummary="withOutAndErr" dir="${classes.dir}">
<!-- Run in debug logging level because trace generates way too much output.
We will run manually using trace logging output when there are UI test failures. -->
<jvmarg value="-Dorg.slf4j.simpleLogger.defaultLogLevel=${build.log.level.test}" />
<jvmarg value="${XstartOnFirstThreadFlag}" />
<jvmarg line="${agentvmparam}" />
<classpath>
<path refid="test-classpath" />
<path refid="build-classpath" />
<pathelement location="${uitestclasses.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${release.dir}${path.separator}${release.dir}/bin" />
<sysproperty key="hdfview.root" path="@{rootdir}" />
<sysproperty key="hdfview.workdir" path="@{workdir}" />
<sysproperty key="hdfview.propfile" path="@{propfile}" />
<env key="${platform.hdf.lib}" path="${release.dir}${path.separator}${release.dir}/bin${path.separator}${platform.hdf.lib}" />
<test name="uitest.${test}" todir="${report.dir}" outfile="TEST-uitest.${test}">
<formatter type="xml" />
<formatter type="plain" />
</test>
</junit>
</sequential>
</macrodef>
<target name="runauitest" description="Runs the test you specify on the command line with -Dtest=" depends="deploy,jar, clean-junit-uitest, compile-test, ensure-test5-name, ensure-test4-name, jacoco">
<mkdir dir="${report.dir}" />
<run-ui-junit
rootdir="${basedir}/${jar.dir}"
workdir="${basedir}/${uitestclasses.dir}/uitest"
propfile="${basedir}/${uitestclasses.dir}/.hdfview${app.version}"
includes="**/${uitestclasses.dir}/${test}.class"
excludes="**/*All* **/*$*"
/>
</target>
<!-- Top-level target for UI tests. Calls separate targets for HDFView UI tests, HDF4 UI tests and HDF5 UI tests. -->
<target name="junit-uitest" depends="jar, clean-junit-uitest, jacoco, compile-test, deploy, -hdfview-ui-tests" description="Runs the UI tests" />
<!-- Internal target to run HDFView UI tests that are independent of FileFormats. -->
<target name="-hdfview-ui-tests" depends="jar, compile-uitest, clean-junit-uitest">
<mkdir dir="${report.dir}" />
<run-ui-junit
rootdir="${basedir}/${jar.dir}"
workdir="${basedir}/${uitestclasses.dir}/uitest"
propfile="${basedir}/${uitestclasses.dir}/.hdfview${app.version}"
includes="**/${uitestclasses.dir}/${test}.class"
excludes="**/*All* **/*$*"
/>
</target>
<!-- Internal target to run HDF4-related HDFView UI tests. -->
<target name="-hdf4-ui-tests" if="h4path">
<mkdir dir="${report.dir}" />
<!-- Run the top-level HDF4 UI tests -->
<run-ui-junit
rootdir="${basedir}/${jar.dir}"
workdir="${basedir}/${hdf4uitestclasses.dir}"
propfile="${basedir}/${uitestclasses.dir}/.hdfview${app.version}"
includes="**/${hdf4uitestclasses.dir}/${test}.class"
excludes="**/*All* **/*$*"
if="h4path"
/>
</target>
<target name="-hdf5-ui-tests">
<mkdir dir="${report.dir}" />
<!-- Run the top-level HDF5 UI tests -->
<run-ui-junit
rootdir="${basedir}/${jar.dir}"
workdir="${basedir}/${hdf5uitestclasses.dir}"
propfile="${basedir}/${uitestclasses.dir}/.hdfview${app.version}"
includes="${hdf5uitestclasses.dir}/${test}.class"
excludes="**/*All* **/*$*"
/>
</target>
<target name="junit-uimodules" depends="jar,modulejar,compile-uimodtest,clean-junit-uitest,jacoco" description="Runs the tests for the UI modules">
<mkdir dir="${report.dir}" />
<run-ui-junit
rootdir="${basedir}/${jar.dir}"
workdir="${basedir}/${testclasses.dir}/modules"
includes="**/modules/*Test*"
excludes="**/modules/*$*"
/>
</target>
<target name="junitreport">
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}" includes="TEST-*.xml" />
<report todir="${report.dir}" />
</junitreport>
</target>
<!-- =================================================================
JAVADOC
================================================================= -->
<target name="javadoc" depends="jar">
<javadoc
modulesourcepath="${src.dir}"
modulepathref="project-classpath"
packagenames="hdf.*"
use="true"
author="true"
version="true"
access="package"
destdir="${javadoc.dir}"
windowtitle="${ant.project.name} ${app.version}"
noqualifier="java.*:javax.*:com.sun.*"
linksource="true"
failonerror="false">
<fileset dir="${src.dir}" />
<doctitle>
<![CDATA[= HDFView Application =]]>
</doctitle>
<bottom>
<![CDATA[Copyright © 2022. All Rights Reserved.]]>
</bottom>
<group title="object packages" packages="hdf.object.*" />
<group title="view packages" packages="hdf.view.*" />
<classpath>
<path refid="project-classpath" />
<path refid="application" />
</classpath>
</javadoc>
</target>
<target name="createDocumentationTGZ" description="Compresses the application User's Guide project pointed to by userguide.dir into a .tar.gz file to be distributed">
<mkdir dir="${build.dir}/docs" />
<tar destfile="${build.dir}/docs/UserGuide.tar.gz" compression="gzip">
<tarfileset dir="${userguide.dir}" includes="images/** javadocs/** *.html RELEASE.txt" />
</tar>
</target>
<macrodef name="jdepslink" description="Generate a stand-alone application">
<attribute name="java.bindir" default="${java.home}/bin" description="The directory in which Java executables can be found" />
<sequential>
<!-- Use generated list of Java modules to create custom JRE -->
<exec executable="@{java.bindir}/jlink">
<arg value="--no-header-files" />
<arg value="--no-man-pages" />
<arg value="--output" />
<arg value="${jar.dir}/jre" />
<arg value="--module-path" />
<arg value="${release.dir}" />
<arg value="--add-modules" />
<arg value="java.desktop" />
</exec>
</sequential>
</macrodef>
<target name="createREADME" depends="clean-package" description="Creates the project README.txt file">
<mkdir dir="${dist.dir}" />
<echo>Create README.txt and add appropriate information</echo>
<copy file="${packagefiles.dir}/README.txt.in" tofile="${dist.dir}/README.txt" />
<replace file="${dist.dir}/README.txt" token="@HDFJAVA_PACKAGE_NAME@" value="${ant.project.name}" />
<replace file="${dist.dir}/README.txt" token="@HDFVIEW_PACKAGE_VERSION_STRING@" value="${app.version}" />
<replace file="${dist.dir}/README.txt" token="@HDFVIEW_PACKAGE_VERSION@" value="${app.version}" />
<replace file="${dist.dir}/README.txt" token="@JDK_VERSION@" value="${java.version}" />
<replace file="${dist.dir}/README.txt" token="@LIB_TYPE@" value="SHARED" />
<replace file="${dist.dir}/README.txt" token="@HDF4_VERSION_STRING@" value="${hdf4.version}" />
<replace file="${dist.dir}/README.txt" token="@HDF5_VERSION_STRING@" value="${hdf5.version}" />
<replace file="${dist.dir}/README.txt" token="@JRE_VERSION@" value="${jre.version}" />
<replace file="${dist.dir}/README.txt" token="@FILE_SEP@" value="${file.separator}" />
</target>
<target name="createWindowsREADME" depends="createREADME" if="${isXWindows}">
<!-- Windows-specific README.txt replacements -->
<echo>Create Windows-specific README.txt and add appropriate version information</echo>
<replace file="${dist.dir}/README.txt" token="@BINARY_PLATFORM@" value="Windows win-${os.arch}" />
<replace file="${dist.dir}/README.txt" token="@BINARY_FILE@" value="${ant.project.name}-${app.version}.exe (or .msi) - ${ant.project.name} Installer" />
<replace file="${dist.dir}/README.txt" token="@EXECUTABLE@" value="C:\Users\user-name\AppData\Local\HDF_Group\HDFView" />
<replace file="${dist.dir}/README.txt" token="@INSTALL_TYPE@" value="Running" />
<replace file="${dist.dir}/README.txt" token="@INSTALL_PREFIX_HEADER@" value="To install ${ant.project.name} for Windows:${line.separator}" />
<replace file="${dist.dir}/README.txt" token="@INSTALL_OR_RUN_FILE@" value="1. Execute ${ant.project.name}-${app.version}.exe (or .msi)" />
<replace file="${dist.dir}/README.txt" token="@OPTIONAL_STEP@" value="2. Follow prompts${line.separator}3. Execute install-dir\${ant.project.name}.exe" />
</target>
<target name="createWindowsAppREADME" depends="createREADME" if="${isAppWindows}">
<!-- Windows-specific README.txt replacements -->
<echo>Create Windows-specific README.txt and add appropriate version information</echo>