forked from JMRI/JMRI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
2737 lines (2449 loc) · 134 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"?>
<?xml-stylesheet type="text/xsl" href="/xml/XSLT/antdoc.xsl"?>
<!-- Ant build.xml file for JMRI development -->
<!-- Bob Jacobsen, Copyright 2002-2017 -->
<!-- This file is part of JMRI. -->
<!-- -->
<!-- JMRI is free software; you can redistribute it and/or modify it under -->
<!-- the terms of version 2 of the GNU General Public License as published -->
<!-- by the Free Software Foundation. See the "COPYING" file for a copy -->
<!-- of this license. -->
<!-- -->
<!-- JMRI is distributed in the hope that it will be useful, but WITHOUT -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
<!-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -->
<!-- for more details. -->
<project name="JMRI" default="debug" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<!-- basedir="." means all paths are relative to the top level -->
<!-- directory in the project. We expect that lib et al will -->
<!-- be present in that directory -->
<description>
Provides build services for JMRI libraries and applications
</description>
<property name="jmri.copyright.year" value="1997-2020"/>
<property environment="env"/>
<!-- local.properties file (not an error if doesn't exist) -->
<!-- -->
<!-- Things you might want to set: -->
<!-- # JVM arguments to pass to the JVM running the JMRI application -->
<!-- jvm.args= -->
<!-- # JVM arguments to pass to the JVM running single tests -->
<!-- test-single.jvmargs= -->
<!-- # paths to append to the classpath -->
<!-- cp.append= -->
<!-- # paths to prepend to the classpath -->
<!-- cp.prepend= -->
<!-- # The directory where SpotBugs is installed -->
<!-- spotbugs.home= -->
<!-- # You can specify a DecoderPro/PanelPro config file at runtime -->
<!-- # with e.g. "ant -Dantargline=DecoderProFile.xml decoderpro" -->
<!-- antargline=DecoderProFile.xml -->
<!-- # If building releases, define directory where nsis is found -->
<!-- # Make sure the trailing / is present, -->
<!-- # since the usage is ${nsis.home}makensis, -->
<!-- # Ant will do a $PATH search if nsis.home is not set. -->
<!-- nsis.home=/opt/nsis/nsis-2.46/ -->
<!-- # or -->
<!-- nsis.home=C:/Program Files/NSIS/ -->
<!-- -->
<!-- The local.properties file should NEVER be checked-in to Git, it is in the .gitignore file -->
<!-- -->
<property file="local.properties"/>
<!-- set any properties not overridden by local.properties -->
<property file="${basedir}/release.properties"/>
<!-- set global properties for this build -->
<property file="${basedir}/project.properties"/>
<!-- Retrieve Git revision via 'git describe' -->
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<!-- check output of git rev-parse above and place in release.revision_id -->
<condition property="release.revision_id"
value="${git.revision}"
else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<!-- RELEASED set in the environment forces release.official to true -->
<!-- Unless release.properties file already set it -->
<condition property="release.official" value="true" else="false">
<isset property="RELEASED"/>
</condition>
<condition property="nsis.home" value="">
<not><isset property="nsis.home"/></not>
</condition>
<condition property="jvm.args" value="">
<not>
<isset property="jvm.args"/>
</not>
</condition>
<condition property="cp.append" value="">
<not>
<isset property="cp.append"/>
</not>
</condition>
<condition property="cp.prepend" value="">
<not>
<isset property="cp.prepend"/>
</not>
</condition>
<condition property="os.linux" value="true">
<and>
<os family="unix"/>
<equals arg1="${os.name}" arg2="Linux"/>
</and>
</condition>
<!-- this is the list of jar files and class path elements that are not
a part of the JMRI codebase itself but which are needed at runtime
for the various apps. These will all be copied into the release
packages. Does not include JMRI itself.
-->
<path id="runtime.class.path">
<pathelement location="${libdir}/purejavacomm-1.0.1.jar"/>
<pathelement location="${libdir}/xercesImpl.jar"/>
<pathelement location="${libdir}/xml-apis-1.4.01.jar"/>
<pathelement location="${libdir}/gluegen-rt.jar"/>
<pathelement location="${libdir}/commons-csv-1.7.jar"/>
<pathelement location="${libdir}/jdom2-2.0.6.jar"/>
<pathelement location="${libdir}/jhall.jar"/>
<pathelement location="${libdir}/jinput.jar"/>
<pathelement location="${libdir}/jmdns-3.5.5.jar"/>
<pathelement location="${libdir}/openlcb.jar"/>
<pathelement location="${libdir}/jlfgr-1_0.jar"/>
<pathelement location="${libdir}/joal.jar"/>
<pathelement location="${libdir}/jython-standalone-2.7.2.jar"/>
<pathelement location="${libdir}/log4j-1.2.17.jar"/>
<pathelement location="${libdir}/javax.servlet-api-3.1.0.jar"/>
<pathelement location="${libdir}/vecmath-1.5.2.jar"/>
<pathelement location="${libdir}/mailapi.jar"/>
<pathelement location="${libdir}/xAPlib.jar"/>
<pathelement location="${libdir}/jna-4.4.0.jar"/>
<pathelement location="${libdir}/jna-platform-4.4.0.jar"/>
<pathelement location="${libdir}/commons-lang3-3.7.jar"/>
<pathelement location="${libdir}/commons-text-1.2.jar"/>
<pathelement location="${libdir}/commons-compress-1.18.jar"/>
<pathelement location="${libdir}/jackson-core-2.10.0.jar"/>
<pathelement location="${libdir}/jackson-annotations-2.10.0.jar"/>
<pathelement location="${libdir}/jackson-databind-2.10.0.jar"/>
<pathelement location="${libdir}/jetty-http-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/jetty-security-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/jetty-server-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/jetty-servlet-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/jetty-util-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/jetty-io-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/websocket-api-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/websocket-client-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/websocket-common-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/websocket-server-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/websocket-servlet-9.4.26.v20200117.jar"/>
<pathelement location="${libdir}/slf4j-api-1.7.25.jar"/>
<pathelement location="${libdir}/slf4j-log4j12-1.7.25.jar"/>
<pathelement location="${libdir}/jul-to-slf4j-1.7.25.jar"/>
<pathelement location="${libdir}/xbee-java-library-1.2.1.jar"/>
<pathelement location="${libdir}/pi4j-core-1.2.jar"/>
<pathelement location="${libdir}/commons-io-2.6.jar"/>
<pathelement location="${libdir}/bluecove-2.1.1-SNAPSHOT.jar"/>
<pathelement location="${libdir}/bluecove-bluez-2.1.1-SNAPSHOT.jar"/>
<pathelement location="${libdir}/bluecove-gpl-2.1.1-SNAPSHOT.jar"/>
<pathelement location="${libdir}/jhidrawplugin.jar"/>
<pathelement location="${libdir}/beansbinding-1.2.1.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-linux-aarch64.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-linux-arm.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-linux-x86.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-linux-x86-64.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-darwin-x86-64.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-win32-x86.jar"/>
<pathelement location="${libdir}/libusb4java-1.3.0-win32-x86-64.jar"/>
<pathelement location="${libdir}/usb-api-1.0.2.jar"/>
<pathelement location="${libdir}/usb4java-1.3.0.jar"/>
<pathelement location="${libdir}/usb4java-javax-1.3.0.jar"/>
<pathelement location="${libdir}/hid4java-0.5.0.jar"/>
<pathelement location="${libdir}/mqtt-client-0.4.0.jar"/>
<pathelement location="${libdir}/json-schema-validator-1.0.28.jar"/>
<pathelement location="${libdir}/jinputvalidator-0.8.0.jar"/>
<pathelement location="${libdir}/jsplitbutton-1.3.1.jar"/>
<pathelement location="${libdir}/thumbnailator-0.4.8.jar"/>
</path>
<pathconvert property="runtime.class.jars" refid="runtime.class.path"/>
<!-- jars needed for i18n testing only -->
<path id="i18n.class.path">
<pathelement location="${ant.home}/lib/ant.jar"/>
<pathelement location="${libdir}/antlr-3.4-complete.jar"/>
<pathelement location="${libdir}/i18nchecker.jar"/>
</path>
<pathconvert property="i18n.class.jars" refid="i18n.class.path"/>
<!-- jars that are needed at build and/or test time -->
<path id="compile.class.path">
<pathelement path="${runtime.class.jars}"/>
<pathelement location="${libdir}/AppleJavaExtensions.jar"/> <!-- build with Mac OS X-specific support -->
<pathelement location="${libdir}/junit-4.12.jar"/>
<pathelement location="${libdir}/junit-jupiter-5.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-console-standalone-1.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-commons-1.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-engine-1.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-launcher-1.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-runner-1.6.0.jar"/>
<pathelement location="${libdir}/junit-platform-suite-api-1.6.0.jar"/>
<pathelement location="${libdir}/junit-vintage-engine-5.6.0.jar"/>
<pathelement location="${libdir}/junit-jupiter-api-5.6.0.jar"/>
<pathelement location="${libdir}/junit-jupiter-engine-5.6.0.jar"/>
<pathelement location="${libdir}/junit-jupiter-params-5.6.0.jar"/>
<pathelement location="${libdir}/opentest4j-1.2.0.jar"/>
<pathelement location="${libdir}/apiguardian-api-1.1.0.jar"/>
<pathelement location="${libdir}/hamcrest-core-1.3.jar"/>
<pathelement location="${libdir}/archunit-junit4-0.11.0.jar"/>
<pathelement location="${libdir}/archunit-0.11.0.jar"/>
<pathelement path="${i18n.class.jars}"/> <!-- i18n test -->
<!-- SpotBugs annotations -->
<pathelement location="${libdir}/jcip-annotations-1.0.jar"/>
<pathelement location="${libdir}/jsr305.jar"/>
<pathelement location="${libdir}/spotbugs-annotations.jar"/>
<!-- ServiceProvider annotations -->
<pathelement location="${libdir}/org-openide-util-lookup-RELEASE113.jar"/>
</path>
<!-- path to run regular executables -->
<path id="project.class.path">
<pathelement path="${cp.prepend}"/> <!-- prepended by user -->
<pathelement location="${jartarget}"/>
<path refid="runtime.class.path"/>
<pathelement location="${target}/"/> <!-- after declared jars to check for name collisions -->
<pathelement path="${cp.append}"/> <!-- appended by user -->
</path>
<!-- path to run tests -->
<path id="test.class.path">
<pathelement location="${jartarget}"/>
<path refid="compile.class.path"/>
<pathelement location="${libdir}/mockito-core-3.3.0.jar"/>
<pathelement location="${libdir}/byte-buddy-1.10.5.jar"/>
<pathelement location="${libdir}/cglib-nodep-2.2.2.jar"/>
<pathelement location="${libdir}/javassist-3.20.0-GA.jar"/>
<pathelement location="${libdir}/objenesis-2.2.jar"/>
<pathelement location="${libdir}/jemmy-22-00c9f753cd0a.jar"/>
<pathelement location="${libdir}/system-rules-1.16.0.jar"/>
<!-- cucumber and it's dependencies -->
<pathelement location="${libdir}/cucumber-core-4.3.1.jar"/>
<pathelement location="${libdir}/cucumber-java-4.3.1.jar"/>
<pathelement location="${libdir}/cucumber-java8-4.3.1.jar"/>
<pathelement location="${libdir}/cucumber-junit-4.3.1.jar"/>
<pathelement location="${libdir}/cucumber-jvm-deps-1.0.6.jar"/>
<pathelement location="${libdir}/cucumber-picocontainer-4.3.1.jar"/>
<pathelement location="${libdir}/cucumber-html-0.2.7.jar"/>
<pathelement location="${libdir}/cucumber-expressions-6.2.2.jar"/>
<pathelement location="${libdir}/gherkin-5.1.0.jar"/>
<pathelement location="${libdir}/gherkin-jvm-deps-1.0.4.jar"/>
<pathelement location="${libdir}/picocontainer-2.15.jar"/>
<pathelement location="${libdir}/tag-expressions-1.1.1.jar"/>
<pathelement location="${libdir}/typetools-0.5.0.jar"/>
<pathelement location="${libdir}/datatable-1.1.12.jar"/>
<pathelement location="${libdir}/datatable-dependencies-1.1.12.jar"/>
<!-- Selenium and it's dependencies -->
<pathelement location="${libdir}/selenium-server-standalone-3.6.0.jar"/>
<pathelement location="${libdir}/webdrivermanager-3.4.0.jar"/>
<pathelement location="${libdir}/jarchivelib-1.0.0.jar"/>
<!-- Spring Mock and it's dependencies -->
<pathelement location="${libdir}/spring-test-5.1.3.RELEASE.jar"/>
<pathelement location="${libdir}/spring-core-5.1.3.RELEASE.jar"/>
<pathelement location="${libdir}/spring-web-5.1.3.RELEASE.jar"/>
<!-- Assertj -->
<pathelement location="${libdir}/assertj-core-3.12.0.jar"/>
<pathelement location="${libdir}/assertj-swing-3.9.2.jar"/>
<pathelement location="${libdir}/assertj-swing-junit-3.9.2.jar"/>
<!-- include JMRI classes last -->
<pathelement location="${target}/"/> <!-- after declared jars to check for name collisions -->
<pathelement location="${testtarget}"/> <!-- test resources in classpath that collide with stock resources -->
</path>
<macrodef name="quiet">
<element name="body" implicit="yes"/>
<sequential>
<script language="javascript" >
// to see type of 1st logger, uncomment the following
//echo = JMRI.createTask("echo");
//echo.setMessage(Object.prototype.toString.call(project.getBuildListeners().firstElement()));
//echo.perform();
// Only attempt to quiet if the top logger is the default Ant logger
// This avoids errors when e.g. NetBeans has injected it's own logger ([object org.apache.tools.ant.module.bridge.impl.NbBuildLogger])
if (Object.prototype.toString.call(project.getBuildListeners().firstElement()) == "[object org.apache.tools.ant.DefaultLogger]") {
project.getBuildListeners().firstElement().setMessageOutputLevel(0);
}
</script>
<body/>
<script language="javascript" >
// TODO: restore last log level instead of going to fixed value "2"
if (Object.prototype.toString.call(project.getBuildListeners().firstElement()) == "[object org.apache.tools.ant.DefaultLogger]") {
project.getBuildListeners().firstElement().setMessageOutputLevel(2);
}
</script>
</sequential>
</macrodef>
<!-- Java Code Coverage -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/org.jacoco.ant-0.8.5-nodeps.jar" />
</taskdef>
<!-- fileset for the jacoco targets. -->
<fileset id="jacocofileset" dir="${target}">
<include name="**/*.class" />
<!-- Exclude classes necessary for testing only from the code coverage report-->
<exclude name="**/*Test*.class" />
<exclude name="**/*IT.class" />
<exclude name="**/IT*.class" />
<!-- Exclude testing infrastructure classes -->
<exclude name="**/*Scaffold.class" />
<exclude name="**/*JUnit*.class" />
<exclude name="**/*Demo.class" />
<exclude name="**/*Mock*.class" />
<exclude name="jmri/jmrit/symbolicprog/tabbedframe/CheckProgrammerNames.class" />
<exclude name="jmri/jmrix/openlcb/SampleFactory.class" />
<exclude name="jmri/util/swing/SamplePane.class" />
<exclude name="jmri/jmrit/display/EditorFrameOperator.class" />
<exclude name="jmri/util/web/BrowserFactory.class" />
<!-- Exclude pure interfaces and classes only providing constants. -->
<exclude name="jmri/AddressedProgrammerManager.class" />
<exclude name="jmri/jmris/simpleserver/parser/JmriServerParserTreeConstants.class" />
<exclude name="jmri/jmris/srcp/parser/SRCPParserTreeConstants.class" />
<exclude name="jmri/jmrit/audio/AudioSource.class" />
<exclude name="jmri/jmrix/srcp/parser/SRCPClientParserTreeConstants.class" />
<!-- Exclude deprecated classes. -->
<exclude name="jmri/jmrix/loconet/AbstractAlmImplementation.class" />
<!-- Exclude files meant to check SpotBugs. -->
<exclude name="apps/FindBugsCheck.class" />
<exclude name="apps/CheckerFrameworkCheck.class" />
</fileset>
<!-- fileset for the junitlauncher targets. -->
<fileset id="junitfileset" dir="${testtarget}">
<include name="**/Test*.class"/>
<include name="**/*Test.class"/>
<include name="**/*IT.class"/>
<include name="**/IT*.class"/>
<exclude name="apps.tests.AllTest.class"/>
<exclude name="jmri.HeadLessTest.class"/>
<exclude name="jmri.ArchitectureTest.class"/>
</fileset>
<!-- end of definitions -->
<!-- target definitions start here -->
<!-- ============================================================================= -->
<!-- Utility targets -->
<!-- ============================================================================= -->
<target name="init"> <!-- create timestamp and needed directories, not for user use -->
<!-- Create the time stamp properties -->
<tstamp>
<format property="TODAY" pattern="yyyyMMdd" timezone="GMT"/>
<format property="NOW" pattern="HHmm" timezone="GMT"/>
</tstamp>
<property name="release.build_date" value="${TODAY}T${NOW}Z"/>
<!-- Create the build directory structure used by compile -->
<quiet>
<mkdir dir="${target}"/>
<mkdir dir="${target}/resources"/>
<mkdir dir="${maventarget}/testreport"/>
</quiet>
<filterset id="release-information"
begintoken="@@"
endtoken="@@">
<filter token="release.major" value="${release.major}"/>
<filter token="release.minor" value="${release.minor}"/>
<filter token="release.build" value="${release.build}"/>
<filter token="release.modifier" value="${release.modifier}"/>
<filter token="release.revision_id" value="${release.revision_id}"/>
<filter token="release.build_user" value="${release.build_user}"/>
<filter token="release.official" value="${release.official}"/>
<filter token="release.build_date" value="${release.build_date}"/>
<filter token="jmri.copyright.year" value="${jmri.copyright.year}"/>
</filterset>
</target>
<target name="check-ant-requirements"> <!-- check build system requirements, not for user use -->
<antversion property="ant-version-ok" atleast="1.8.0"/>
<antversion property="ant-version-actual"/>
<fail unless="ant-version-ok" message="Minimum ant version required is 1.8.0, this is ${ant-version-actual}"/>
</target>
<target name="get-version-string" depends="compile"><!-- compute the version string, not for user use -->
<java classname="jmri.Version"
dir="${basedir}"
fork="yes"
resultproperty="version-string.returncode"
outputproperty="release.version-string"
errorproperty="release.version-string-error">
<classpath>
<pathelement path="${target}"/>
</classpath>
</java>
<echo message="release version string is ${release.version-string}"/>
<fail message="error getting version string: ${version-string.returncode}">
<condition>
<not>
<equals arg1="${version-string.returncode}" arg2="0"/>
</not>
</condition>
</fail>
<!-- create a URL-encoded version -->
<loadresource property="release.version-encoded-string">
<propertyresource name="release.version-string"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replaceregex flags="g" pattern="\+" replace="%2B" />
</tokenfilter>
</filterchain>
</loadresource>
<echo message="${release.version-encoded-string}" />
</target>
<target name="realclean"
description="remove all non-respository files from a build"
depends="clean">
<delete dir="target"/>
<delete dir="release"/>
<delete dir="dist"/>
<delete dir="temp"/>
<delete dir="web/TrainCrew"/>
<delete dir="lib/cachedir"/>
<delete dir="java/tmp"/>
<delete includeEmptyDirs="true" quiet="true" verbose="true">
<!-- .gitignore build artifacts -->
<fileset file="jmri.jar"/>
<fileset dir="java/docs"/>
<!-- .gitignore test artifacts -->
<fileset dir="." includes="junit*.properties"/>
<!-- .gitignore transient artifacts -->
<fileset file=".ant-targets-build.xml"/>
<fileset file=".run.sh"/>
<fileset file="release.zip"/>
<fileset dir="." includes="hs_err_pid*.log"/>
</delete>
</target>
<target name="clean"
description="remove compilation results to force rebuild">
<delete dir="${doctarget}"/>
<delete dir="${maventarget}"/>
<delete dir="${javadir}/classes"/>
<delete dir="${javadir}/test-classes"/>
<delete dir="${dist}"/>
<delete dir="${tempdir}"/>
<delete includeEmptyDirs="true" quiet="true" verbose="true">
<fileset file="log.txt"/>
<fileset file="${jartarget}/jmri.jar"/>
<fileset file="${javadir}/manifest"/>
<!-- .gitignore test artifacts -->
<fileset file="junit-results.xml"/>
<fileset file="findbugs.html"/>
<fileset file="findbugs.xml"/>
<fileset file="spotbugs.html"/>
<fileset file="spotbugs.xml"/>
<fileset file="jacoco.exec"/>
<fileset file="jmri-fb.html"/>
<fileset file="coveragereport"/>
<fileset file="testreport"/>
<fileset file="tests.log"/>
<fileset file="cucumber-results.xml"/>
<!-- .gitignore runtime artifacts -->
<fileset file="messages.log"/>
<fileset file="session.log"/>
</delete>
<ant dir="xml/XSLT" target="clean" inheritAll="false" />
<!-- Eclipse artifacts -->
<delete dir=".apt_generated"/>
<delete dir=".apt_generated_tests"/>
</target>
<!-- end of utility targets -->
<!-- ============================================================================= -->
<!-- Program build targets -->
<!-- ============================================================================= -->
<target name="copyfiles" depends="init"><!-- copy resource files, not for user use -->
<!-- Copy top level resources to include in jar file -->
<copy todir="${target}/resources/">
<fileset dir="${resourcedir}" includes="*.gif"/>
</copy>
<copy todir="${target}">
<fileset dir="${source}" includes="**/*.properties,**/*.js,**/*.png,**/*.json"/>
</copy>
</target>
<!-- generated source code that uses keyword substitution -->
<!-- Typically configured to take a template Version.properties -->
<!-- file from java/templates/jmri and copy it, expanded, to -->
<!-- target/classes where the jmri.Version class can reference -->
<!-- the values at run time -->
<target name="update-template-code" depends="init"><!-- create the substituted template java code, not for user use -->
<copy todir="${target}" overwrite="true" >
<filterset refid="release-information"/>
<fileset dir="${templatedir}"/>
</copy>
</target>
<!-- jj* and javacc* targets are the javacc based generated source -->
<target name="jjtree"
description="Run JJTree related actions"
depends="init">
<quiet>
<!-- Run JJTree -->
<!-- Create the build directory structure used by compiler -->
<mkdir dir="${jjtreegen}/jmri/jmris/srcp/parser"/>
<jjtree
target="${source}/jmri/jmris/srcp/SRCPParser.jjt"
outputdirectory="${jjtreegen}/jmri/jmris/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${jjtreegen}/jmri/jmrix/srcp/parser"/>
<jjtree
target="${source}/jmri/jmrix/srcp/SRCPClientParser.jjt"
outputdirectory="${jjtreegen}/jmri/jmrix/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${jjtreegen}/jmri/jmris/simpleserver/parser"/>
<jjtree
target="${source}/jmri/jmris/simpleserver/JmriServerParser.jjt"
outputdirectory="${jjtreegen}/jmri/jmris/simpleserver/parser"
javacchome="${libdir}"/>
</quiet>
</target>
<target name="jjdoc"
description="create JJDoc BNF documentation"
depends="init, javacc">
<quiet>
<mkdir dir="${doctarget}/jmri/jmris/srcp/"/>
<jjdoc target="${jjtreegen}/jmri/jmris/srcp/parser/SRCPParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmris/srcp/SRCPParser.html"/>
<mkdir dir="${doctarget}/jmri/jmrix/srcp/"/>
<jjdoc target="${jjtreegen}/jmri/jmrix/srcp/parser/SRCPClientParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmrix/srcp/SRCPClientParser.html"/>
<mkdir dir="${doctarget}/jmri/jmris/simpleserver/"/>
<jjdoc target="${jjtreegen}/jmri/jmris/simpleserver/parser/JmriServerParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmris/simpleserver/JmriServerParser.html"/>
</quiet>
</target>
<target name="javacc"
description="JavaCC related actions"
depends="jjtree">
<!-- Run JavaCC -->
<quiet>
<mkdir dir="${javaccgen}/jmri/jmris/srcp/parser"/>
<javacc
target="${jjtreegen}/jmri/jmris/srcp/parser/SRCPParser.jj"
outputdirectory="${javaccgen}/jmri/jmris/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${javaccgen}/jmri/jmrix/srcp/parser"/>
<javacc
target="${jjtreegen}/jmri/jmrix/srcp/parser/SRCPClientParser.jj"
outputdirectory="${javaccgen}/jmri/jmrix/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${javaccgen}/jmri/jmris/simpleserver/parser"/>
<javacc
target="${jjtreegen}/jmri/jmris/simpleserver/parser/JmriServerParser.jj"
outputdirectory="${javaccgen}/jmri/jmris/simpleserver/parser"
javacchome="${libdir}"/>
</quiet>
<!-- Turn all Javadoc comments in generated code into plain comments -->
<replaceregexp match="\/\*\*" replace="\/\*" flags="g">
<fileset dir="${javaccgen}">
<include name="**/*.java"/>
</fileset>
</replaceregexp>
</target>
<!-- this one target handles the compiler processing for all of the JDK based
compilation - normal code, generated code and tests -->
<!-- Deprecated, use the java-compile macro instead -->
<target name="-java-compile-internal"> <!-- Internal target for compiling Java source from a specified directory -->
<java-compile
javac.source="${java.source.directory}"
javac.target="${target}"
/>
</target>
<macrodef name="java-compile">
<attribute name="javac.source"/>
<attribute name="javac.includes" default=""/>
<attribute name="javac.target" default="${target}"/>
<attribute name="javac.deprecation" default="${deprecation}"/>
<attribute name="javac.classpath" default="compile.class.path"/>
<sequential>
<mkdir dir="@{javac.target}"/> <!-- ensure destdir exists -->
<javac compiler="modern"
includes="@{javac.includes}"
srcdir="@{javac.source}"
destdir="@{javac.target}"
source="${source_version}"
target="${jre_version}"
includeantruntime="false"
fork="true"
deprecation="@{javac.deprecation}"
debug="${java.debugging}">
<classpath refid="@{javac.classpath}"/>
<compilerarg line="-encoding utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xpkginfo:always"/> <!-- compile all package-info.java to avoid empty-file warnings -->
<compilerarg value="-Xmaxerrs"/><compilerarg value="1000"/><!-- change from default 100 errors -->
</javac>
</sequential>
</macrodef>
<target name="compile-generated-source"
depends="javacc, update-template-code"><!-- compile all generated Java source; internal target -->
<!-- Compile the java code from ${genjavasrcdir} into ${target} -->
<java-compile
javac.source="${javaccgen};${jjtreegen}"
javac.deprecation="off"
/>
</target>
<target name="compile"
description="compile source, omitting tests - identical to debug target"
depends="init, copyfiles, compile-generated-source">
<!-- Compile the java code from ${source} into ${target} -->
<java-compile
javac.source="${source}"
javac.deprecation="on"
/>
</target>
<!-- Note if modifying the debug target, please be sure to up date the -->
<!-- NetBeans IDE debug target in nbproject/ide-targets.xml -->
<target name="debug"
description="compile source with debugging on, omitting tests - identical to compile target"
depends="compile">
</target>
<target name="tests"
description="compile test classes"
depends="debug">
<!-- Compile the test java code from ${source} into ${target} -->
<java-compile
javac.source="${test};${acceptancetest}"
javac.target="${testtarget}"
javac.classpath="test.class.path"
javac.deprecation="off"
/>
<!-- Copy resources into ${testtarget} so they coexist with identical
resources in ${target} (this is important for the Java ServiceLoader -->
<copy todir="${testtarget}">
<fileset dir="${test}" includes="**/*.properties"/>
<fileset dir="${test}" includes="**/*.xml"/>
<fileset dir="${test}" includes="META-INF/**"/>
</copy>
</target>
<target name="ci-compile-deprecations"
description="compile source, omitting tests, warning on deprecations - for Jenkins CI"
depends="init, copyfiles, compile-generated-source">
<!-- Compile the java code from ${source} into ${target} allowing lots of deprecations!-->
<!-- The following is copied from the -java-compile-internal target -->
<!-- Eventually, we want to turn deprecation warnings "on" and remove this target's Xmax parameters -->
<javac compiler="modern"
srcdir="${source}"
destdir="${target}"
source="${source_version}"
target="${jre_version}"
includeantruntime="false"
fork="true"
deprecation="on"
debug="${java.debugging}">
<classpath refid="compile.class.path"/>
<compilerarg line="-encoding utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xpkginfo:always"/> <!-- compile all package-info.java to avoid empty-file warnings -->
<compilerarg value="-Xmaxwarns"/><compilerarg value="2000"/><!-- change from default 100 warnings -->
</javac>
</target>
<target name="ci-tests-deprecations"
description="compile source and tests, warning on deprecations - for Jenkins CI"
depends="ci-compile-deprecations">
<!-- Compile the java test code allowing lots of deprecations!-->
<!-- The following is copied from the -java-compile-internal target -->
<!-- Eventually, we want to turn deprecation warnings "on" and remove this target's Xmax parameters -->
<mkdir dir="${testtarget}"/>
<javac compiler="modern"
srcdir="${test};${acceptancetest}"
destdir="${testtarget}"
source="${source_version}"
target="${jre_version}"
includeantruntime="false"
fork="true"
deprecation="on"
debug="${java.debugging}">
<classpath refid="test.class.path"/>
<compilerarg line="-encoding utf-8"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xpkginfo:always"/> <!-- compile all package-info.java to avoid empty-file warnings -->
<compilerarg value="-Xmaxwarns"/><compilerarg value="2000"/><!-- change from default 100 warnings -->
</javac>
</target>
<target name="-pre-single-test">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<condition property="test.isTest">
<matches pattern=".*Test$" string="${test.includes}" />
</condition>
</target>
<target depends="-pre-single-test" if="test.isTest" name="-test-single-test">
<property name="test.test" value="${test.includes}"/>
</target>
<target depends="-pre-single-test" unless="test.isTest" name="-test-single-src">
<property name="test.test" value="${test.includes}Test"/>
</target>
<target depends="-test-single-src,-test-single-test,tests,runtime-library-selection" description="Run single unit test." name="test-single">
<mkdir dir="${tempdir}"/>
<mkdir dir="${testreport}"/>
<property name="test-single.jvmargs" value=""/>
<java classpathref="test.class.path" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true" >
<sysproperty key="wdm.forceCache" value="true"/>
<!-- wdm.targetPath specifies the locaion of the web drivers on appveyor. -->
<sysproperty key="wdm.targetPath" value="C:\Tools\WebDriver"/>
<sysproperty key="java.security.policy" value="${libdir}/security.policy"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
<sysproperty key="log4j.ignoreTCL" path="true/"/>
<sysproperty key="java.library.path" path=".:${libdir}:${arch.lib.path}"/>
<sysproperty key="jmri.prefsdir" path="${tempdir}"/>
<sysproperty key="jmri.shutdownmanager" value="jmri.util.MockShutDownManager" />
<sysproperty key="jmri.skipTestsRequiringSeparateRunning" value="false"/><!-- skip intermittent tests -->
<sysproperty key="user.language" value="en"/>
<sysproperty key="user.country" value="US"/>
<sysproperty key="cucumber.options" value="--tags 'not @Ignore' --tags 'not @webtest'"/>
<arg value="--scan-classpath"/>
<arg value="--details=none"/>
<arg value="--include-engine=junit-jupiter"/>
<arg value="--include-engine=junit-vintage"/>
<arg line="-n ${test.includes}"/>
<arg line="--reports-dir '${testreport}'" />
<jvmarg value="-Xmx1536m"/>
<jvmarg line="${test-single.jvmargs}"/>
</java>
<fail>
<condition>
<istrue value="${test.failed}" />
</condition>
</fail>
</target>
<target depends="-test-single-src,-test-single-test,tests,runtime-library-selection" description="Run single unit test with Coverage." name="test-single-coverage">
<mkdir dir="${tempdir}"/>
<mkdir dir="${testreport}"/>
<jacoco:agent property="jacocoagent" destfile="${jacocoexec}" excludes="org.slf4j.*" />
<property name="test-single.jvmargs" value=""/>
<java classpathref="test.class.path" classname="org.junit.platform.console.ConsoleLauncher" fork="true" failonerror="true" >
<sysproperty key="wdm.forceCache" value="true"/>
<!-- wdm.targetPath specifies the locaion of the web drivers on appveyor. -->
<sysproperty key="wdm.targetPath" value="C:\Tools\WebDriver"/>
<sysproperty key="java.security.policy" value="${libdir}/security.policy"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
<sysproperty key="log4j.ignoreTCL" path="true/"/>
<sysproperty key="java.library.path" path=".:${libdir}:${arch.lib.path}"/>
<sysproperty key="jmri.prefsdir" path="${tempdir}"/>
<sysproperty key="jmri.shutdownmanager" value="jmri.util.MockShutDownManager" />
<sysproperty key="jmri.skipTestsRequiringSeparateRunning" value="false"/><!-- skip intermittent tests -->
<sysproperty key="user.language" value="en"/>
<sysproperty key="user.country" value="US"/>
<sysproperty key="cucumber.options" value="--tags 'not @Ignore' --tags 'not @webtest'"/>
<arg value="--scan-classpath"/>
<arg value="--details=none"/>
<arg value="--include-engine=junit-jupiter"/>
<arg value="--include-engine=junit-vintage"/>
<arg line="-n ${test.includes}"/>
<arg line="--reports-dir ${testreport}" />
<jvmarg value="-Xmx1536m"/>
<jvmarg value="${jacocoagent}"/>
<jvmarg line="${test-single.jvmargs}"/>
</java>
<fail>
<condition>
<istrue value="${test.failed}" />
</condition>
</fail>
</target>
<target name="single-test-coveragereport" depends="test-single-coverage, coveragereport" description="Generate Test Coverage Report from a single test" />
<target name="single-test-coveragecheck" depends="test-single-coverage, coveragecheck" description="Generate Test Coverage check from a single test" />
<!-- The java/ecj.warning.options and java/ecj.warning.options-ci files defines which warnings are on and off -->
<!-- By default, we set them explicitly, so that new ones will show up -->
<!-- See http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm -->
<!-- -->
<macrodef name="ecj-compile">
<attribute name="javac.source"/>
<attribute name="javac.target" default="${target}"/>
<attribute name="javac.deprecation" default="${deprecation}"/>
<attribute name="javac.classpath" default="compile.class.path"/>
<element name="javac-options" optional="yes"/>
<sequential>
<mkdir dir="@{javac.target}"/> <!-- ensure destdir exists -->
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<javac srcdir="@{javac.source}"
destdir="@{javac.target}"
source="${source_version}"
target="${jre_version}"
includeantruntime="false"
deprecation="@{javac.deprecation}"
debug="yes">
<compilerclasspath>
<pathelement path="${libdir}/ecj.jar"/>
</compilerclasspath>
<javac-options/>
<classpath refid="@{javac.classpath}"/>
</javac>
</sequential>
</macrodef>
<target name="warnings"
description="compile source with ECJ warning generation on, omitting tests"
depends="check-ant-requirements, clean, init, copyfiles, compile-generated-source">
<ecj-compile
javac.source="${source}"
javac.deprecation="on"
>
<javac-options>
<compilerarg value="@${basedir}/java/ecj.warning.options"/>
</javac-options>
</ecj-compile>
</target>
<target name="warnings-check"
description="compile source with ECJ warning generation on and fail if any warnings, omitting tests"
depends="check-ant-requirements, clean, init, copyfiles, compile-generated-source">
<ecj-compile
javac.source="${source}"
javac.deprecation="on"
>
<javac-options>
<compilerarg value="@${basedir}/java/ecj.warning.options-ci"/>
</javac-options>
</ecj-compile>
</target>
<target name="tests-warnings"
description="compile test sources with ECJ warning generation on"
depends="warnings">
<ecj-compile
javac.source="${test}"
javac.target="${testtarget}"
javac.classpath="test.class.path"
javac.deprecation="off"
>
<javac-options>
<compilerarg value="@${basedir}/java/ecj.warning.options"/>
<compilerarg value="@${basedir}/java/ecj.warning.options-test"/>
</javac-options>
</ecj-compile>
</target>
<target name="tests-warnings-check"
description="compile test sources with ECJ warning generation on and fail if any warnings"
depends="warnings-check">
<ecj-compile
javac.source="${test}"
javac.target="${testtarget}"
javac.classpath="test.class.path"
javac.deprecation="off"
>
<javac-options>
<compilerarg value="@${basedir}/java/ecj.warning.options-ci"/>
<compilerarg value="@${basedir}/java/ecj.warning.options-test-ci"/>
</javac-options>
</ecj-compile>
</target>
<!-- end of program build targets -->
<!-- ============================================================================= -->
<!-- Application startup targets -->
<!-- ============================================================================= -->
<target name="runtime-library-selection">
<condition property="baseOS" value="windows">
<os family="windows"/>
</condition>
<condition property="baseOS" value="macosx">
<os family="mac"/>
</condition>
<condition property="baseOS" value="linux">
<and>
<os family="unix"/>
<equals arg1="${os.name}" arg2="Linux"/>
</and>
</condition>
<condition property="baseArch" value="x64">
<and>
<os family="windows"/>
<or>
<equals arg1="${os.arch}" arg2='x86_64'/>
<equals arg1="${os.arch}" arg2='x64'/>
<equals arg1="${os.arch}" arg2='amd64'/>
</or>
</and>
</condition>
<condition property="baseArch" value="x86">
<and>
<os family="windows"/>
<or>
<equals arg1="${os.arch}" arg2='i386'/>
<equals arg1="${os.arch}" arg2='x86'/>
</or>
</and>
</condition>
<condition property="baseArch" value="i386">
<and>
<os family="unix"/>
<or>
<equals arg1="${os.arch}" arg2='i386'/>
<equals arg1="${os.arch}" arg2='i686'/>
</or>
</and>
</condition>
<condition property="baseArch" value="x86_64">
<and>
<os family="unix"/>
<or>
<equals arg1="${os.arch}" arg2='x86_64'/>
<equals arg1="${os.arch}" arg2='amd64'/>
</or>
</and>
</condition>
<condition property="baseArch" value="armv5">
<and>
<os family="unix" />
<or>
<equals arg1="${os.arch}" arg2='armv5' />
<equals arg1="${os.arch}" arg2='armv5tel' />
</or>
</and>
</condition>
<condition property="baseArch" value="armv6l">
<and>
<os family="unix" />
<equals arg1="${os.arch}" arg2='arm' />
</and>
</condition>
<property name="arch.lib.path" value="${libdir}/${baseOS}/${baseArch}:${libdir}/${baseOS}"/>
<echo message="arch.lib.path ${arch.lib.path}"/>
</target>
<!-- the two targets in the depends are correct: only one will run, depending upon ${debugger} -->
<!-- Internal target to run a given JMRI application, under the debugger if the debugger property is set -->
<target name="-run-jmri-application" depends="-normal-jmri-application,-debug-jmri-application">
<echo>${application.classname} finished with return code ${application.returncode}</echo>
<condition property="application.relaunch" value="yes">
<equals arg1="${application.returncode}" arg2="100"/>
</condition>
<antcall target="-relaunch-jmri-application"/>
</target>
<!-- this target is used to conditionally re-launch the JMRI application
if the return code is 100.
-->
<target name="-relaunch-jmri-application"