-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
2186 lines (1952 loc) · 101 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"?>
<!-- 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-2017"/>
<property environment="env"/>
<!-- local.properties file (not an error if doesn't exist) -->
<!-- -->
<!-- Things you might want to set: -->
<!-- # Your SourceForge ID (used for Javadocs, distribution) if different -->
<!-- sourceforge.userid= -->
<!-- # JVM arguments to pass to the JVM running the JMRI application -->
<!-- jvm.args= -->
<!-- # paths to append to the classpath -->
<!-- cp.append= -->
<!-- # paths to prepend to the classpath -->
<!-- cp.prepend= -->
<!-- # The directory where Findbugs is installed -->
<!-- findbugs.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/ -->
<!-- -->
<!-- This 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"/>
<!-- The Jenkins official release builds force: -->
<!-- release.official=true -->
<!-- nsis.home=/opt/nsis/nsis-2.46/ -->
<!-- in their "invoke ant" step -->
<!-- The Packages build (dev downloads) forces: -->
<!-- release.official=false -->
<!-- nsis.home=/opt/nsis/nsis-2.46/ -->
<!-- in its "invoke ant" step -->
<property name="release.build_user" value="${user.name}"/>
<property name="release" value="${release.major}.${release.minor}.${release.build}"/>
<!-- 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>
<!-- should compiler warn of use of deprecated APIs? (on/off) -->
<property name="deprecation" value="off"/> <!-- off at start of 3.11 series, as we work through changes -->
<!-- SDK version (1.8 as of JMRI 3.11.1 [3.12/4.0 pre-releases]) -->
<property name="sdk_version" value="1.8"/>
<property name="source_version" value="${sdk_version}"/>
<property name="jre_version" value="${sdk_version}"/>
<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>
<!-- set global properties for this build -->
<property name="dist" value="${basedir}/dist"/>
<property name="jartarget" value="${basedir}"/>
<property name="libdir" value="${basedir}/lib"/>
<property name="resourcedir" value="${basedir}/resources"/>
<property name="scriptdir" value="${basedir}/scripts"/>
<property name="javadir" value="${basedir}/java"/>
<property name="doctarget" value="${javadir}/doc"/>
<property name="coveragetarget" value="${basedir}/coveragereport"/>
<property name="source" value="${javadir}/src"/>
<property name="maventarget" value="${basedir}/target"/>
<property name="target" value="${maventarget}/classes"/>
<property name="testtarget" value="${maventarget}/test-classes"/>
<property name="test" value="${javadir}/test"/>
<property name="templatedir" value="${javadir}/template"/>
<property name="tmptarget" value="${javadir}/tmp"/>
<property name="lineendtmp" value="${tmptarget}/lineend"/>
<property name="tempdir" value="${basedir}/temp"/> <!-- actual tmp files -->
<property name="java.debugging" value="yes" />
<!-- location for all generated java code -->
<property name="genjavasrcdir" value="${tmptarget}/"/>
<!-- 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}/RXTXcomm.jar"/>
<pathelement location="${libdir}/Serialio.jar"/>
<pathelement location="${libdir}/ch.ntb.usb.jar"/>
<pathelement location="${libdir}/xercesImpl.jar"/>
<pathelement location="${libdir}/gluegen-rt.jar"/>
<pathelement location="${libdir}/javacsv.jar"/>
<pathelement location="${libdir}/jdom-2.0.5.jar"/>
<pathelement location="${libdir}/jdom.jar"/>
<pathelement location="${libdir}/jhall.jar"/>
<pathelement location="${libdir}/jinput.jar"/>
<pathelement location="${libdir}/jmdns.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.0.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}/smtp.jar"/>
<pathelement location="${libdir}/xAPlib.jar"/>
<pathelement location="${libdir}/WinRegistry-4.4.jar"/>
<pathelement location="${libdir}/commons-lang3-3.2.1.jar"/>
<pathelement location="${libdir}/jakarta-regexp-1.5.jar"/>
<pathelement location="${libdir}/jackson-core-2.0.6.jar"/>
<pathelement location="${libdir}/jackson-annotations-2.0.6.jar"/>
<pathelement location="${libdir}/jackson-databind-2.0.6.jar"/>
<pathelement location="${libdir}/jetty-http-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/jetty-security-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/jetty-server-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/jetty-servlet-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/jetty-util-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/jetty-io-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/websocket-api-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/websocket-client-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/websocket-common-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/websocket-server-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/websocket-servlet-9.3.9.v20160517.jar"/>
<pathelement location="${libdir}/slf4j-api-1.7.13.jar"/>
<pathelement location="${libdir}/slf4j-log4j12-1.7.13.jar"/>
<pathelement location="${libdir}/jul-to-slf4j-1.7.13.jar"/>
<pathelement location="${libdir}/xbjlib-1.1.1.jar"/>
<pathelement location="${libdir}/pi4j-core.jar"/>
<pathelement location="${libdir}/pi4j-device.jar"/>
<pathelement location="${libdir}/pi4j-gpio-extension.jar"/>
<pathelement location="${libdir}/pi4j-service.jar"/>
<pathelement location="${libdir}/commons-io-1.3.1.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"/>
</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}/annotations.jar"/> <!-- findbugs build-time only-->
<pathelement location="${libdir}/jsr305.jar"/> <!-- findbugs build-time only-->
<pathelement location="${libdir}/junit-4.12.jar"/>
<pathelement location="${libdir}/hamcrest-core-1.3.jar"/>
<pathelement location="${libdir}/jfcunit.jar"/>
<pathelement path="${i18n.class.jars}"/> <!-- i18n test -->
<!-- powermock and it's dependencies -->
<pathelement location="${libdir}/mockito-core-2.0.42-beta.jar"/>
<pathelement location="${libdir}/powermock-mockito2-1.6.5-full.jar"/>
<pathelement location="${libdir}/powermock-api-mockito-common-1.6.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}/byte-buddy-1.2.1.jar"/>
<pathelement location="${libdir}/jemmy-2.2.7.5.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="${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/jacocoant.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 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="apps/tests/Log4JFixture.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}${NOW}"/>
<!-- Create the build directory structure used by compile -->
<quiet>
<mkdir dir="${target}"/>
<mkdir dir="${target}/resources"/>
<mkdir dir="${genjavasrcdir}/jmri/jmris/srcp/parser"/>
<mkdir dir="${genjavasrcdir}/jmri/jmrix/srcp/parser"/>
</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.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>
</target>
<target name="realclean"
description="remove all non-respository files from a build"
depends="clean">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="lib/cachedir"/>
<fileset dir="${coveragetarget}"/>
<fileset file=".run.sh"/>
</delete>
</target>
<target name="clean"
description="remove compilation results to force rebuild">
<delete includeEmptyDirs="true" quiet="true">
<fileset file="log.txt"/>
<fileset file="${jartarget}/jmri.jar"/>
<fileset dir="${doctarget}"/>
<fileset dir="${maventarget}"/>
<fileset dir="${javadir}/classes"/>
<fileset dir="${javadir}/test-classes"/>
<fileset dir="${dist}"/>
<fileset dir="${genjavasrcdir}"/>
<fileset file="${javadir}/manifest"/>
<fileset dir="${tempdir}"/>
<fileset file="findbugs.html"/>
<fileset file="findbugs.xml"/>
<fileset file="junit-results.xml"/>
<fileset file="jmri-fb.html"/>
<fileset file="jacoco.exec"/>
</delete>
<ant dir="xml/XSLT" target="clean" inheritAll="false" />
</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"/>
<fileset dir="${source}" includes="META-INF/**"/>
</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="${genjavasrcdir}" 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="${genjavasrcdir}/jmri/jmris/srcp/parser"/>
<jjtree
target="${source}/jmri/jmris/srcp/SRCPParser.jjt"
outputdirectory="${genjavasrcdir}/jmri/jmris/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${genjavasrcdir}/jmri/jmrix/srcp/parser"/>
<jjtree
target="${source}/jmri/jmrix/srcp/SRCPClientParser.jjt"
outputdirectory="${genjavasrcdir}/jmri/jmrix/srcp/parser"
javacchome="${libdir}"/>
<mkdir dir="${genjavasrcdir}/jmri/jmris/simpleserver/parser"/>
<jjtree
target="${source}/jmri/jmris/simpleserver/JmriServerParser.jjt"
outputdirectory="${genjavasrcdir}/jmri/jmris/simpleserver/parser"
javacchome="${libdir}"/>
</quiet>
</target>
<target name="jjdoc"
description="create JJDoc BNF documentation"
depends="init, javacc">
<mkdir dir="${doctarget}/jmri/jmris/srcp/"/>
<jjdoc target="${genjavasrcdir}/jmri/jmris/srcp/parser/SRCPParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmris/srcp/SRCPParser.html"/>
<mkdir dir="${doctarget}/jmri/jmrix/srcp/"/>
<jjdoc target="${genjavasrcdir}/jmri/jmrix/srcp/parser/SRCPClientParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmrix/srcp/SRCPClientParser.html"/>
<mkdir dir="${doctarget}/jmri/jmris/simpleserver/"/>
<jjdoc target="${genjavasrcdir}/jmri/jmris/simpleserver/parser/JmriServerParser.jj"
javacchome="${libdir}"
outputfile="${doctarget}/jmri/jmris/simpleserver/JmriServerParser.html"/>
</target>
<target name="javacc"
description="JavaCC related actions"
depends="jjtree">
<!-- Run JavaCC -->
<quiet>
<javacc
target="${genjavasrcdir}/jmri/jmris/srcp/parser/SRCPParser.jj"
outputdirectory="${genjavasrcdir}/jmri/jmris/srcp/parser"
javacchome="${libdir}"/>
<javacc
target="${genjavasrcdir}/jmri/jmrix/srcp/parser/SRCPClientParser.jj"
outputdirectory="${genjavasrcdir}/jmri/jmrix/srcp/parser"
javacchome="${libdir}"/>
<javacc
target="${genjavasrcdir}/jmri/jmris/simpleserver/parser/JmriServerParser.jj"
outputdirectory="${genjavasrcdir}/jmri/jmris/simpleserver/parser"
javacchome="${libdir}"/>
</quiet>
</target>
<!-- this one target handles the compiler processing for all of the JDK based
compilation - normal code, generated code and tests -->
<!-- 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.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"
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 value="-Xlint:-unchecked"/> <!-- off during 1.8 migration -->
</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="${genjavasrcdir}"/>
<copy todir="${target}/jmri" overwrite="true">
<fileset dir="${genjavasrcdir}/jmri" includes="*.properties"/>
</copy>
</target>
<target name="compile"
description="compile source, omitting tests"
depends="init, copyfiles, compile-generated-source">
<!-- Compile the java code from ${source} into ${target} -->
<java-compile javac.source="${source}"/>
</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 value="-Xlint:-unchecked"/>
<compilerarg value="-Xmaxwarns"/><compilerarg value="2000"/><!-- change from default 100 warnings -->
</javac>
</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"
depends="init, javacc, copyfiles, compile-generated-source">
<!-- Compile the java code from ${source} into ${target} -->
<java-compile javac.source="${source}"/>
</target>
<target name="tests"
description="compile test classes"
depends="debug">
<!-- Compile the test java code from ${source} into ${target} -->
<java-compile javac.source="${test}" javac.target="${testtarget}" javac.classpath="test.class.path"/>
<!-- 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="META-INF/**"/>
</copy>
</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">
<junit haltonerror="false" haltonfailure="false" printsummary="yes" fork="yes" dir="." errorProperty="test.failed" failureProperty="test.failed">
<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="jinput.plugins" path="net.bobis.jinput.hidraw.HidRawEnvironmentPlugin"/>
<classpath refid="test.class.path"/>
<test name="${test.test}">
<formatter usefile="no" type="brief"/>
</test>
</junit>
<fail>
<condition>
<istrue value="${test.failed}" />
</condition>
</fail>
</target>
<!-- the next target requires Ant 1.8 or later, which can be obtained from -->
<!-- http://ant.apache.org/bindownload.cgi -->
<!-- -->
<!-- The ecj.warning.options file 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 -->
<!-- -->
<target name="-ecj-compile-internal"> <!-- internal target for compiling Java source from a specified directory using ECJ -->
<!-- Compile the java code from ${source} into ${target} -->
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<javac srcdir="${java.source.directory}"
destdir="${target}"
source="${source_version}"
target="${jre_version}"
includeantruntime="false"
debug="yes" >
<compilerclasspath>
<pathelement path="${libdir}/ecj.jar"/>
</compilerclasspath>
<compilerarg value="@${basedir}/java/ecj.warning.options"/>
<classpath refid="compile.class.path"/>
</javac>
</target>
<target name="warnings"
description="compile source with warning generation on, omitting tests; requires Ant 1.8 and ecj.jar"
depends="check-ant-requirements, clean, init, copyfiles, compile-generated-source">
<antcall target="-ecj-compile-internal">
<param name="java.source.directory" value="${source}"/>
</antcall>
</target>
<target name="tests-warnings"
description="compile test sources with warning generation on; requires Ant 1.8 and ecj.jar"
depends="check-ant-requirements, clean, init, copyfiles, warnings">
<antcall target="-ecj-compile-internal">
<param name="java.source.directory" value="${test}"/>
</antcall>
</target>
<target name="rmic"
description="build RMI stubs and compile">
<!-- Run rmic on specified classes -->
<rmic includes="**/LnMessageBuffer.class, **/LnMessageServer.class"
base="${target}"
stubversion="compat">
<classpath refid="project.class.path"/>
</rmic>
</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"
if="application.relaunch">
<echo>Relaunching ${application.classname}</echo>
<antcall target="-run-jmri-application" inheritAll="false">
</antcall>
</target>
<!-- these next targets (-{run,debug}-jmri-application) are really the same,
except for the jvmarg values related to setting up the debugger support in
the VM. If you change one, please make the corresponding change in the other.
If you know how to make the jvmarg values conditional and combine this into one
target, PLEASE do so.
-->
<target name="-normal-jmri-application"
unless="debugger"
depends="runtime-library-selection">
<echo>Launch normally (no debugger support)</echo>
<java classname="${application.classname}" dir="${basedir}" fork="yes" resultproperty="application.returncode">
<classpath refid="project.class.path"/>
<sysproperty key="java.security.policy"
value="${libdir}/security.policy"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
<sysproperty key="apple.awt.graphics.UseQuartz" value="true"/>
<sysproperty key="apple.awt.graphics.EnableQ2DX" value="true"/>
<sysproperty key="log4j.ignoreTCL" path="true/"/>
<sysproperty key="file.encoding" value="UTF-8"/>
<sysproperty key="java.library.path"
path=".:${arch.lib.path}:${libdir}"/>
<sysproperty key="jinput.plugins"
path="net.bobis.jinput.hidraw.HidRawEnvironmentPlugin"/>
<jvmarg value="-Xms256m"/>
<jvmarg value="-Xmx640m"/>
<!-- <jvmarg value="-verbose"/> -->
<!-- <jvmarg value="-verbosegc"/> -->
<!-- <jvmarg value="-Xloggc:memory.vgc"/> --><!-- for JTune -->
<jvmarg line="${jvm.args}"/>
<arg value="${antargline}"/>
</java>
</target>
<!-- see comment just above -->
<target name="-debug-jmri-application"
if="debugger"
depends="runtime-library-selection">
<echo>Launch with debugger support</echo>
<!-- this value of 5432 conflicts with PostgreSQL -->
<property name="jpda.address" value="5432"/>
<!-- this is the JMRI, not the JDWP default, must be "n" for IDEs -->
<property name="jdpa.server" value="y"/>
<!-- this is the JDWP default -->
<property name="jdpa.suspend" value="y"/>
<java classname="${application.classname}" dir="${basedir}" fork="yes" resultproperty="application.returncode">
<classpath refid="project.class.path"/>
<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=".:${arch.lib.path}:${libdir}"/>
<sysproperty key="jinput.plugins"
path="net.bobis.jinput.hidraw.HidRawEnvironmentPlugin"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=${jdpa.server},suspend=${jdpa.suspend},address=${jpda.address}"/>
<!-- <jvmarg value="-verbose"/> -->
<!-- <jvmarg value="-verbosegc"/> -->
<!-- <jvmarg value="-Xloggc:memory.vgc"/> -->
<!-- for JTune -->
<jvmarg line="${jvm.args}"/>
<arg value="${antargline}"/>
</java>
</target>
<target name="run-sh" description="Create run.sh in SCM root">
<make-startup-script script.name=".run.sh"
script.class="jmri.util.junit.TestClassMainMethod"
dest="${basedir}/.run.sh"/>
</target>
<!-- This is a set of targets used to start up the various JMRI applications
They all use the same back-end target run-jmri-application to do the work,
with the only differences among them being the value of the initial classname
to run and the startup configfile as specified in the antargline -->
<target name="decoderpro-old"
description="build and run the old DecoderPro app"
depends="debug, copyfiles">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.DecoderPro.DecoderPro"/>
<param name="antargline" value="DecoderProConfig2.xml"/>
</antcall>
</target>
<target name="decoderpro"
description="build and run DecoderPro (formerly DecoderPro 3) app"
depends="debug, copyfiles">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.gui3.dp3.DecoderPro3"/>
<param name="antargline" value="DecoderProConfig3.xml"/>
</antcall>
</target>
<target name="panelpro"
description="build and run PanelPro app"
depends="debug">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.PanelPro.PanelPro"/>
<param name="antargline" value="PanelProConfig2.xml"/>
</antcall>
</target>
<target name="soundpro"
description="build and run SoundPro app"
depends="debug">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.SoundPro.SoundPro"/>
<param name="antargline" value="SoundProConfig2.xml"/>
</antcall>
</target>
<target name="gui3mdi"
description="build and run build and run GUI3 MDI demo app"
depends="debug">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.gui3.mdi.MDI"/>
</antcall>
</target>
<target name="gui3ide"
depends="debug"
description="build and run build and run GUI3 IDE demo app">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.gui3.paned.Paned"/>
</antcall>
</target>
<target name="installtest"
depends="debug"
description="build and run build and run InstallTest app">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.InstallTest.InstallTest"/>
<param name="antargline" value="InstallTestConfig2.xml"/>
</antcall>
</target>
<target name="jmridemo"
depends="debug"
description="build and run build and run JmriDemo app">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.JmriDemo.JMRIdemo"/>
<param name="antargline" value="JmriDemoConfig2.xml"/>
</antcall>
</target>
<target name="SampleMinimalProgram"
depends="debug"
description="build and run build and run SampleMinimalProgram class">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.SampleMinimalProgram"/>
</antcall>
</target>
<target name="jmrifaceless"
depends="debug"
description="build and run build and run JmriFaceless app">
<antcall target="-run-jmri-application">
<param name="application.classname" value="apps.JmriFaceless"/>
<param name="antargline" value="JmriFacelessConfig3.xml"/>
</antcall>
</target>
<!-- end of application startup targets -->
<!-- ============================================================================= -->
<!-- I18N testing section -->
<!-- ============================================================================= -->
<!-- Force false language/country to check I18N -->
<target name="locale"
description="check DecoderPro I8N"
depends="debug, runtime-library-selection">
<java classname="apps.DecoderPro.DecoderPro" dir="." fork="yes">
<classpath refid="project.class.path"/>
<sysproperty key="java.security.policy"
value="${libdir}/security.policy"/>
<sysproperty key="apple.laf.useScreenMenuBar" value="true"/>
<sysproperty key="apple.awt.graphics.UseQuartz" value="true"/>
<sysproperty key="apple.awt.graphics.EnableQ2DX" value="true"/>
<sysproperty key="log4j.ignoreTCL" path="true/"/>
<sysproperty key="file.encoding" value="UTF-8"/>
<sysproperty key="java.library.path"
path=".:${arch.lib.path}:${libdir}"/>
<sysproperty key="jinput.plugins"
path="net.bobis.jinput.hidraw.HidRawEnvironmentPlugin"/>
<jvmarg value="-Xms256m"/>
<jvmarg value="-Xmx640m"/>
<!-- klingon -->
<sysproperty key="user.language" value="tlh"/>
<sysproperty key="user.country" value="001"/>
<arg line="DecoderProConfig2.xml"/>
<!-- <jvmarg value="-verbose"/> -->
<!-- <jvmarg value="-verbosegc"/> -->
<!-- <jvmarg value="-Xloggc:memory.vgc"/> -->
<!-- for JTune -->
</java>
</target>
<target name="i18n-consistency-check" description="Verification of localized strings in source code" depends="jar">
<property name="i18n.modulefilter" value=""/>
<property name="i18n.logger" value="log" /> <!-- name of logging token to match with logging methods -->
<property name="i18n.loggerMethods" value="info,debug,error,warn" /> <!-- logging methods that should not be checked for i18n consistency -->
<echo>I18N Consistency Check - use modulefilter property if you want to see errors only from one module</echo>
<taskdef classname="org.i18nchecker.I18nChecker" name="i18nConsistencyCheck" classpathref="i18n.class.path"/>
<!-- check includes all .properties files including ones we use for non-translatable files -->
<i18nConsistencyCheck srcdir="${basedir}" topdirs="." allProperties="true" logger="${i18n.logger}" loggerMethods="${i18n.loggerMethods}" modulefilter="${i18n.modulefilter}"/>