forked from wearefrank/frank-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
815 lines (774 loc) · 56.4 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
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
<project default="restart" xmlns:if="ant:if" xmlns:unless="ant:unless">
<target name="init">
<basename property="basedir.basename" file="${basedir}"/>
<property file="build.properties"/>
<property name="project.dir" value="${main.project}" if:set="sub.project"/>
<property name="configurations.names" value="${main.project},${sub.project}" if:set="sub.project"/>
<property name="projects.dir" value="${basedir}/.."/>
<property name="project.dir" value="${basedir.basename}/examples/Frank2Example1"/>
<property file="${projects.dir}/${project.dir}/frank-runner.properties"/>
<available property="war.pom.xml.available" file="${projects.dir}/${project.dir}/war/pom.xml"/>
<available property="pom.xml.available" file="${projects.dir}/${project.dir}/pom.xml"/>
<property name="classes.dir" value="war/src/main/resources" if:set="war.pom.xml.available"/>
<property name="configurations.dir" value="war/src/main/configurations" if:set="war.pom.xml.available"/>
<property name="java.dir" value="war/src/main/java" if:set="war.pom.xml.available"/>
<property name="tests.dir" value="war/src/test/testtool" if:set="war.pom.xml.available"/>
<property name="context.xml" value="war/src/main/webapp/META-INF/context.xml" if:set="war.pom.xml.available"/>
<property name="maven.exec.dir" value="${projects.dir}/${project.dir}/war" if:set="war.pom.xml.available"/>
<property name="classes.dir" value="src/main/resources" if:set="pom.xml.available"/>
<property name="configurations.dir" value="src/main/configurations" if:set="pom.xml.available"/>
<property name="java.dir" value="src/main/java" if:set="pom.xml.available"/>
<property name="tests.dir" value="src/test/testtool" if:set="pom.xml.available"/>
<property name="context.xml" value="src/main/webapp/META-INF/context.xml" if:set="pom.xml.available"/>
<property name="maven.exec.dir" value="${projects.dir}/${project.dir}" if:set="pom.xml.available"/>
<property name="classes.dir" value="classes"/>
<property name="configurations.dir" value="configurations"/>
<property name="java.dir" value="java"/>
<property name="tests.dir" value="tests"/>
<property name="context.xml" value="context.xml"/>
<property name="maven" value="false"/><!-- feature toggle for now -->
<property name="maven" value="true" if:set="war.pom.xml.available"/>
<property name="maven" value="true" if:set="pom.xml.available"/>
<property name="maven.phase" value="compile" if:true="${maven}"/>
<property name="maven.skip.clean" value="false" if:true="${maven}"/>
<property name="maven.skip.tests" value="false" if:true="${maven}"/>
<property name="maven.skip.javadoc" value="false" if:true="${maven}"/>
<property name="maven.verbose" value="false" if:true="${maven}"/>
<property name="classloader.type" value="DirectoryClassLoader"/>
<property name="lib.server.dir" value="lib/server"/>
<property name="lib.webapp.dir" value="lib/webapp"/>
<property name="database.type" value="h2"/>
<property name="dtap.stage" value="LOC"/>
<property name="otap.stage" value="LOC"/>
<property file="${projects.dir}/${project.dir}/${classes.dir}/DeploymentSpecifics.properties" prefix="ds.properties."/>
<property name="instance.name" value="${ds.properties.instance.name}" if:set="ds.properties.instance.name"/>
<basename property="instance.name" file="${project.dir}"/>
<available property="configuration.name.default" value="${instance.name}" file="${projects.dir}/${project.dir}/${classes.dir}/Configuration.xml"/>
<property name="ibistesttool.directory" value="${projects.dir}/${project.dir}/${tests.dir}"/>
<property name="context.path" value="ROOT"/>
<property name="maxmemory" value="1024M"/>
<property name="update.strategy" value="latest" unless:true="${maven}"/>
<condition property="update.strategy.is.latest"><equals arg1="${update.strategy}" arg2="latest"/></condition>
<tstamp><format property="get.metadata.tstamp" pattern="yyyyMMdd-HH"/></tstamp>
<condition property="get.metadata"><and><isset property="update.strategy.is.latest"/><not><resourceexists><file file="download/metadata/maven-metadata-${get.metadata.tstamp}.txt"/></resourceexists></not><not><isset property="ff.version"/></not></and></condition>
<property name="get.metadata.maxtime" value="10"/>
<property name="get.metadata.ignoreerrors" value="true"/>
<mkdir dir="download/metadata"/>
<get src="https://nexus.frankframework.org/repository/public/org/ibissource/ibis-adapterframework-webapp/maven-metadata.xml" dest="download/metadata/maven-metadata-tmp.xml" maxtime="${get.metadata.maxtime}" ignoreerrors="${get.metadata.ignoreerrors}" verbose="on" if:set="get.metadata"/>
<move file="download/metadata/maven-metadata-tmp.xml" tofile="download/metadata/maven-metadata.xml" failonerror="false" quiet="true"/>
<xmlproperty file="download/metadata/maven-metadata.xml" if:set="update.strategy.is.latest"/>
<echo file="download/metadata/maven-metadata-${get.metadata.tstamp}.txt" if:set="get.metadata">metadata.versioning.latest=${metadata.versioning.latest}</echo>
<property name="ff.version" value="${metadata.versioning.latest}" if:set="metadata.versioning.latest"/>
<condition property="os.windows"><os family="windows"/></condition>
<condition property="os.linux"><and><os family="unix"/><not><os family="mac"/></not></and></condition>
<condition property="os.mac"><and><os family="unix"/><os family="mac"/></and></condition>
<property name="jdk.version" value="8"/>
<property name="jdk.version.u" value="252"/>
<property name="jdk.version.b" value="09"/>
<property name="jdk.zip.win" value="OpenJDK${jdk.version}U-jdk_x64_windows_hotspot_${jdk.version}u${jdk.version.u}b${jdk.version.b}.zip"/>
<property name="jdk.tar.lin" value="OpenJDK${jdk.version}U-jdk_x64_linux_hotspot_${jdk.version}u${jdk.version.u}b${jdk.version.b}.tar"/>
<property name="jdk.zip.lin" value="${jdk.tar.lin}.gz"/>
<property name="jdk.tar.mac" value="OpenJDK${jdk.version}U-jdk_x64_mac_hotspot_${jdk.version}u${jdk.version.u}b${jdk.version.b}.tar"/>
<property name="jdk.zip.mac" value="${jdk.tar.mac}.gz"/>
<property name="jdk.zip" value="${jdk.zip.win}" if:true="${os.windows}"/>
<property name="jdk.tar" value="${jdk.tar.lin}" if:true="${os.linux}"/>
<property name="jdk.zip" value="${jdk.zip.lin}" if:true="${os.linux}"/>
<property name="jdk.tar" value="${jdk.tar.mac}" if:true="${os.mac}"/>
<property name="jdk.zip" value="${jdk.zip.mac}" if:true="${os.mac}"/>
<property name="jdk.url.win" value="https://github.com/AdoptOpenJDK/openjdk${jdk.version}-binaries/releases/download/jdk${jdk.version}u${jdk.version.u}-b${jdk.version.b}/${jdk.zip.win}"/>
<property name="jdk.url.lin" value="https://github.com/AdoptOpenJDK/openjdk${jdk.version}-binaries/releases/download/jdk${jdk.version}u${jdk.version.u}-b${jdk.version.b}/${jdk.zip.lin}"/>
<property name="jdk.url.mac" value="https://github.com/AdoptOpenJDK/openjdk${jdk.version}-binaries/releases/download/jdk${jdk.version}u${jdk.version.u}-b${jdk.version.b}/${jdk.zip.mac}"/>
<property name="jdk.dir" value="build/jdk${jdk.version}u${jdk.version.u}-b${jdk.version.b}"/>
<property name="ant.version." value="1.10.10"/><!-- extra . because ant.version is a build-in property -->
<property name="ant.zip" value="apache-ant-${ant.version.}-bin.zip" if:true="os.windows"/>
<property name="ant.tar" value="apache-ant-${ant.version.}-bin.tar" unless:true="os.windows"/>
<property name="ant.zip" value="${ant.tar}.gz" unless:true="os.windows"/>
<property name="ant.url" value="https://archive.apache.org/dist/ant/binaries/${ant.zip}"/>
<property name="ant.dir" value="build/apache-ant-${ant.version.}"/>
<property name="maven.version" value="3.6.3"/>
<property name="maven.zip" value="apache-maven-${maven.version}-bin.zip"/>
<property name="maven.url" value="https://archive.apache.org/dist/maven/maven-3/${maven.version}/binaries/${maven.zip}"/>
<property name="maven.dir" value="build/apache-maven-${maven.version}"/>
<property name="tomcat.version" value="9.0.39"/>
<property name="tomcat.zip" value="apache-tomcat-${tomcat.version}.zip"/>
<property name="tomcat.url" value="https://archive.apache.org/dist/tomcat/tomcat-9/v${tomcat.version}/bin/${tomcat.zip}"/>
<property name="tomcat.dir" value="build/apache-tomcat-${tomcat.version}"/>
<property name="tomcat.connector.port" value="80"/>
<property name="tomcat.server.port" value="8005"/>
<property name="winmerge.version" value="2.16.6"/>
<property name="winmerge.zip" value="winmerge-${winmerge.version}-exe.zip"/>
<property name="winmerge.url" value="https://github.com/WinMerge/winmerge/releases/download/${winmerge.version}/${winmerge.zip}"/>
<property name="winmerge.dir" value="build/winmerge-${winmerge.version}-x64-exe"/>
<property name="ff.version" value="7.6-20200501.172313"/>
<property name="ff.war" value="ibis-adapterframework-webapp-${ff.version}.war"/>
<property name="ff.url" value="https://nexus.frankframework.org/repository/public/org/ibissource/ibis-adapterframework-webapp/${ff.version}/${ff.war}"/>
<property name="ff.dir" value="${tomcat.dir}/webapps/${context.path}"/>
<property name="jms.version" value="1.1_spec-1.1"/>
<property name="jms.jar" value="geronimo-jms_${jms.version}.jar"/>
<property name="jms.url" value="https://repo1.maven.org/maven2/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1/${jms.jar}"/>
<property name="h2.version" value="1.4.200"/>
<property name="h2.jar" value="h2-${h2.version}.jar"/>
<property name="h2.url" value="https://repo1.maven.org/maven2/com/h2database/h2/${h2.version}/${h2.jar}"/>
<property name="h2.dir" value="${basedir}/build/h2"/>
<property name="ojdbc.version" value="8-19.3.0.0"/>
<property name="ojdbc.jar" value="ojdbc${ojdbc.version}.jar"/>
<property name="ojdbc.url" value="https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc8/19.3.0.0/${ojdbc.jar}"/>
<property name="mssql.version" value="7.4.1.jre8"/>
<property name="mssql.jar" value="mssql-jdbc-${mssql.version}.jar"/>
<property name="mssql.url" value="https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc/${mssql.version}/${mssql.jar}"/>
<available property="jdk.zip.available" file="download/${jdk.zip}"/>
<available property="jdk.dir.available" file="${jdk.dir}"/>
<available property="ant.zip.available" file="download/${ant.zip}"/>
<available property="ant.dir.available" file="${ant.dir}"/>
<available property="maven.zip.available" file="download/${maven.zip}"/>
<available property="maven.dir.available" file="${maven.dir}"/>
<available property="tomcat.zip.available" file="download/${tomcat.zip}"/>
<available property="tomcat.dir.available" file="${tomcat.dir}"/>
<available property="winmerge.zip.available" file="download/${winmerge.zip}"/>
<available property="winmerge.dir.available" file="${winmerge.dir}"/>
<available property="ff.war.available" file="download/${ff.war}"/>
<available property="ff.dir.available" file="${ff.dir}"/>
<available property="jms.jar.available" file="download/${jms.jar}"/>
<available property="h2.jar.available" file="download/${h2.jar}"/>
<available property="ojdbc.jar.available" file="download/${ojdbc.jar}"/>
<available property="mssql.jar.available" file="download/${mssql.jar}"/>
<property name="larva.windiff.command" value="${basedir}/${winmerge.dir}/WinMerge/WinMergeU.exe"/><!-- defined here and not at the beginning of this file where most properties are defined as it depends on ${winmerge.dir} -->
<propertyset id="system.properties.set">
<propertyref builtin="commandline"/>
<propertyref name="dtap.stage"/>
<propertyref name="otap.stage"/>
<propertyref name="instance.name"/>
<propertyref name="ibistesttool.directory"/>
<propertyref name="larva.windiff.command"/>
</propertyset>
<property name="system.properties.comma.separated" value="${toString:system.properties.set}"/>
<scriptdef language="javascript" name="systemproperties">
<attribute name="name"/>
<attribute name="commaseparated"/>
var commaSeparated = attributes.get("commaseparated").split(', ');
var value = '';
for (var i = 0; i < commaSeparated.length; i++) {
if (!commaSeparated[i].startsWith('ant.')) {
value += '\n' + commaSeparated[i].replace(/\\/g, "\\\\");
}
}
project.setProperty(attributes.get("name"), value);
</scriptdef>
<systemproperties name="system.properties" commaseparated="${system.properties.comma.separated}"/>
<property name="configurations.dirset.dir" value="${projects.dir}"/>
<property name="configurations.dir.abs" location="${configurations.dirset.dir}/${project.dir}/${configurations.dir}"/>
<property name="configurations.dir.rel" basedir="${configurations.dirset.dir}" value="${configurations.dir.abs}" relative="true"/>
<property name="configurations.dirset.includes" value="${project.dir}/${configurations.dir}/*,${project.dir}_*/src/main/configuration/*" if:set="war.pom.xml.available"/>
<property name="configurations.dirset.includes" value="${configurations.dir.rel}/*"/><!-- the use of configurations.dir.rel makes it possible to use ../.. in configurations.dir and still have the includes work (.abs removes the ../.. and .rel will make it relative again) -->
<dirset id="configurations.dirs.id" dir="${configurations.dirset.dir}" includes="${configurations.dirset.includes}"/>
<pathconvert property="configurations.dirs" refid="configurations.dirs.id" pathsep="|"/>
<pathconvert property="configurations.dirs.flat" refid="configurations.dirs.id" pathsep="|"><mapper type="flatten"/></pathconvert>
<scriptdef language="javascript" name="configurationsproperties">
<attribute name="name"/>
<attribute name="configurationsdirabs"/>
<attribute name="configurationnamedefault"/>
<attribute name="configurationsnames"/>
<attribute name="configurationsnamesds"/>
<attribute name="configurationsdirs"/>
<attribute name="configurationsdirsflat"/>
<attribute name="classloadertype"/>
var configurationsDirAbs = attributes.get("configurationsdirabs");
var configurationNameDefault = attributes.get("configurationnamedefault");
var configurationsNames = attributes.get("configurationsnames");
var configurationsNamesDs = attributes.get("configurationsnamesds");
var configurationsDirs = attributes.get("configurationsdirs").split('|');
var configurationsDirsFlat = attributes.get("configurationsdirsflat").split('|');
var classLoaderType = attributes.get("classloadertype");
var value = '';
value += '\n# Set configurations.directory based on Frank!Runner properties';
value += '\nconfigurations.directory=' + configurationsDirAbs.replace(/\\/g, "\\\\");
if (configurationsNames != '${configurations.names}') {
value += '\n# Set configurations.names to Frank!Runner property with the same name';
value += '\nconfigurations.names=' + configurationsNames.replace(/\\/g, "\\\\");
} else {
if (configurationsNamesDs == '${ds.properties.configurations.names}') {
value += '\n# Set configurations.names to the list of folders in configurations.directory';
if (configurationNameDefault != '${configuration.name.default}') {
value += ' (plus ' + configurationNameDefault + ' because a Configuration.xml is detected in classes.dir)';
value += '\nconfigurations.names=' + configurationNameDefault.replace(/\\/g, "\\\\") + ',';
} else {
value += '\nconfigurations.names=';
}
if (configurationsDirsFlat.toString().length() > 0) {
value += configurationsDirsFlat.toString().replace(/\\/g, "\\\\");
}
} else {
value += '\n# Don\'t set configurations.names as it is spedified in DeploymentSpecifics.properties';
}
}
if (configurationsDirsFlat.toString().length() > 0) {
value += '\n# Set .classLoaderType and .directory property for every folder in configurations.directory';
for (var i = 0; i < configurationsDirs.length; i++) {
value += '\nconfigurations.' + configurationsDirsFlat[i] + '.classLoaderType='+ classLoaderType;
value += '\nconfigurations.' + configurationsDirsFlat[i] + '.directory=' + configurationsDirs[i].substring(0, configurationsDirs[i].length() - configurationsDirsFlat[i].length() - 1).replace(/\\/g, "\\\\");
}
}
project.setProperty(attributes.get("name"), value);
</scriptdef>
<configurationsproperties name="configurations.properties" configurationsdirabs="${configurations.dir.abs}" configurationnamedefault="${configuration.name.default}" configurationsnames="${configurations.names}" configurationsnamesds="${ds.properties.configurations.names}" configurationsdirs="${configurations.dirs}" configurationsdirsflat="${configurations.dirs.flat}" classloadertype="${classloader.type}"/>
<property name="projects.dir.abs" location="${projects.dir}"/>
<property name="scenariosroot.default" basedir="${projects.dir}" location="${projects.dir}/${project.dir}_${sub.project}/${tests.dir}" relative="true" if:set="sub.project"/>
<property name="tests.dirset.dir" value="${projects.dir}"/>
<property name="tests.dir.abs" location="${tests.dirset.dir}/${project.dir}/${tests.dir}"/>
<property name="tests.dir.rel" basedir="${tests.dirset.dir}" value="${tests.dir.abs}" relative="true"/>
<property name="tests.dirset.includes" value="${project.dir}/${tests.dir},${project.dir}_*/src/test/testtool" if:set="war.pom.xml.available"/>
<property name="tests.dirset.includes" value="${tests.dir.rel}"/><!-- the use of tests.dir.rel makes it possible to use ../.. in tests.dir and still have the includes work (.abs removes the ../.. and .rel will make it relative again) -->
<dirset id="tests.dirs.id" dir="${tests.dirset.dir}" includes="${tests.dirset.includes}"/>
<pathconvert property="tests.dirs" refid="tests.dirs.id" pathsep="|"/>
<scriptdef language="javascript" name="testsproperties">
<attribute name="name"/>
<attribute name="projectsdirabs"/>
<attribute name="scenariosrootdefault"/>
<attribute name="testsdirs"/>
var projectsDirAbs = attributes.get("projectsdirabs");
var scenariosrootDefault = attributes.get("scenariosrootdefault");
var testsDirs = attributes.get("testsdirs").split('|');
var value = '';
if (scenariosrootDefault != '${scenariosroot.default}') {
value += '\nscenariosroot.default=' + scenariosrootDefault.replace(/\\/g, "\\\\");
}
for (var i = 0; i < testsDirs.length; i++) {
value += '\nscenariosroot' + (i + 1) + '.description='+ testsDirs[i].substring(projectsDirAbs.length() + 1).replace(/\\/g, "\\\\");
value += '\nscenariosroot' + (i + 1) + '.directory=' + testsDirs[i].replace(/\\/g, "\\\\");
}
project.setProperty(attributes.get("name"), value);
</scriptdef>
<testsproperties name="tests.properties" projectsdirabs="${projects.dir.abs}" scenariosrootdefault="${scenariosroot.default}" testsdirs="${tests.dirs}"/>
<loadresource property="jdk.dir.windows"><propertyresource name="jdk.dir"/><filterchain><tokenfilter><filetokenizer/><replacestring from="/" to="\"/></tokenfilter></filterchain></loadresource>
<loadresource property="ant.dir.windows"><propertyresource name="ant.dir"/><filterchain><tokenfilter><filetokenizer/><replacestring from="/" to="\"/></tokenfilter></filterchain></loadresource>
<loadresource property="maven.dir.windows"><propertyresource name="maven.dir"/><filterchain><tokenfilter><filetokenizer/><replacestring from="/" to="\"/></tokenfilter></filterchain></loadresource>
<loadresource property="tomcat.dir.windows"><propertyresource name="tomcat.dir"/><filterchain><tokenfilter><filetokenizer/><replacestring from="/" to="\"/></tokenfilter></filterchain></loadresource>
<tstamp><format property="get.build.tstamp" pattern="yyyyMMdd"/></tstamp>
<condition property="get.build"><not><resourceexists><file file="download/frank-runner/build-${get.build.tstamp}.txt"/></resourceexists></not></condition>
<property name="get.build.maxtime" value="10"/>
<property name="get.build.ignoreerrors" value="true"/>
<mkdir dir="download/frank-runner"/>
<get src="https://raw.githubusercontent.com/ibissource/frank-runner/master/build.xml" dest="download/frank-runner/build.xml" maxtime="${get.build.maxtime}" ignoreerrors="${get.build.ignoreerrors}" verbose="on" if:set="get.build"/>
<echo file="download/frank-runner/build-${get.build.tstamp}.txt" if:set="get.build"/>
<condition property="frank.runner.up.to.date"><or><filesmatch file1="build.xml" file2="download/frank-runner/build.xml" textfile="true"/><not><resourceexists><file file="download/frank-runner/build.xml"/></resourceexists></not></or></condition>
</target>
<target name="build" depends="init,get.java,get.ant,get.maven,get.tomcat,get.winmerge,get.ff,get.jms,get.h2,get.ojdbc,get.mssql">
<!-- jdk -->
<unzip src="download/${jdk.zip}" dest="build" unless:set="jdk.dir.available" if:true="os.windows">
<patternset>
<exclude name="**/demo"/>
<exclude name="**/sample"/>
<exclude name="**/src.zip"/>
</patternset>
</unzip>
<gunzip src="download/${jdk.zip}" dest="build" unless:set="jdk.dir.available" unless:true="os.windows"/>
<untar src="build/${jdk.tar}" dest="build" unless:set="jdk.dir.available" unless:true="os.windows">
<patternset>
<exclude name="**/demo"/>
<exclude name="**/sample"/>
<exclude name="**/src.zip"/>
</patternset>
</untar>
<delete file="build/${jdk.tar}" unless:set="jdk.dir.available" unless:true="os.windows"/>
<chmod file="${jdk.dir}/bin/java" perm="+x" unless:set="jdk.dir.available" unless:true="os.windows"/>
<!-- ant -->
<unzip src="download/${ant.zip}" dest="build" unless:set="ant.dir.available" if:true="os.windows">
<patternset>
<exclude name="**/manual"/>
</patternset>
</unzip>
<gunzip src="download/${ant.zip}" dest="build" unless:set="ant.dir.available" unless:true="os.windows"/>
<untar src="build/${ant.tar}" dest="build" unless:set="ant.dir.available" unless:true="os.windows">
<patternset>
<exclude name="**/manual"/>
</patternset>
</untar>
<delete file="build/${ant.tar}" unless:set="ant.dir.available" unless:true="os.windows"/>
<chmod file="${ant.dir}/bin/ant" perm="+x" unless:set="ant.dir.available" unless:true="os.windows"/>
<chmod file="${ant.dir}/bin/antRun" perm="+x" unless:set="ant.dir.available" unless:true="os.windows"/>
<!-- maven -->
<unzip src="download/${maven.zip}" dest="build" unless:set="maven.dir.available"/>
<chmod file="${maven.dir}/bin/mvn" perm="+x" unless:set="maven.dir.available" unless:true="os.windows"/>
<property name="webapp.dir" value="${ff.dir}" unless:true="${maven}"/>
<property name="webapp.dir" value="${projects.dir}/${project.dir}/war/src/main/webapp" if:set="war.pom.xml.available" if:true="${maven}"/>
<property name="webapp.dir" value="${projects.dir}/${project.dir}/src/main/webapp" if:set="pom.xml.available" if:true="${maven}"/>
<property name="webapp.gitignore" value="/iaf/ /images/ /js/ /jsp/ /larva/ /META-INF/maven/ /META-INF/MANIFEST.MF /WEB-INF/ /body.css /favicon.ico /ie4.css /ie55.css" if:true="${maven}"/>
<property name="webapp.clean" value=" iaf/** images/** js/** jsp/** larva/** META-INF/maven/** META-INF/MANIFEST.MF WEB-INF/** body.css favicon.ico ie4.css ie55.css" unless:true="${maven.skip.clean}"/>
<condition property="webapp.gitignore.add" unless:true="${webapp.gitignore.skip}" if:true="${maven}"><not><resourcecontains resource="${webapp.dir}/.gitignore" substring="${webapp.gitignore}"/></not></condition>
<condition property="webapp.gitignore.add.newline" if:true="${webapp.gitignore.add}"><length file="${webapp.dir}/.gitignore" when="greater" length="0"/></condition>
<echo file="${webapp.dir}/.gitignore" message=" " append="true" if:true="${webapp.gitignore.add.newline}"/>
<echo file="${webapp.dir}/.gitignore" message="${webapp.gitignore}" append="true" if:true="${webapp.gitignore.add}"/>
<property name="project.gitignore" value="/target/" if:true="${maven}"/>
<condition property="project.gitignore.add" unless:true="${project.gitignore.skip}" if:true="${maven}"><not><resourcecontains resource="${projects.dir}/${project.dir}/.gitignore" substring="${project.gitignore}"/></not></condition>
<condition property="project.gitignore.add.newline" if:true="${project.gitignore.add}"><length file="${projects.dir}/${project.dir}/.gitignore" when="greater" length="0"/></condition>
<echo file="${projects.dir}/${project.dir}/.gitignore" message=" " append="true" if:true="${project.gitignore.add.newline}"/>
<echo file="${projects.dir}/${project.dir}/.gitignore" message="${project.gitignore}" append="true" if:true="${project.gitignore.add}"/>
<delete includeEmptyDirs="true" verbose="${maven.verbose}" unless:true="${webapp.clean.skip}" if:true="${maven}"><fileset dir="${webapp.dir}" includes="${webapp.clean}" defaultexcludes="false"/></delete><!-- maven clean war:inplace doesn't clean the webapp (see also: https://stackoverflow.com/questions/12497081/maven-war-inplace-clean-classes-and-lib-folder) -->
<condition property="mvn.ext" value=".cmd" else=""><os family="windows"/></condition>
<exec executable="${basedir}\${maven.dir.windows}\bin\mvn${mvn.ext}" dir="${maven.exec.dir}" vmlauncher="false" failonerror="true" if:true="${maven}">
<env key="JAVA_HOME" value="${basedir}\${jdk.dir.windows}" if:true="os.windows"/>
<env key="JAVA_HOME" value="${basedir}/${jdk.dir}" if:true="os.linux"/>
<env key="JAVA_HOME" value="${basedir}/${jdk.dir}/Contents/Home" if:true="os.mac"/>
<arg value="--settings" if:set="maven.settings.xml"/>
<arg value="${maven.settings.xml}" if:set="maven.settings.xml"/>
<arg value="${maven.args}" if:set="maven.args"/>
<arg value="clean" unless:true="${maven.skip.clean}"/>
<arg value="${maven.phase}"/>
<arg value="war:inplace"/>
<arg value="--update-snapshots"/>
<arg value="--debug" if:true="${maven.verbose}"/>
<arg value="-Dmaven.test.skip=true" if:true="${maven.skip.tests}"/>
<arg value="-Dmaven.javadoc.skip=true" if:true="${maven.skip.javadoc}"/>
</exec>
<!-- tomcat -->
<unzip src="download/${tomcat.zip}" dest="build" unless:set="tomcat.dir.available"/>
<chmod dir="${tomcat.dir}/bin" perm="+x" includes="*.sh" unless:set="tomcat.dir.available"/>
<delete includeemptydirs="true" unless:set="tomcat.dir.available"><fileset dir="${tomcat.dir}/webapps" includes="**/*"/></delete>
<copy file="download/${jms.jar}" todir="${tomcat.dir}/lib"/>
<copy file="download/${h2.jar}" todir="${tomcat.dir}/lib"/>
<copy file="download/${ojdbc.jar}" todir="${tomcat.dir}/lib"/>
<copy file="download/${mssql.jar}" todir="${tomcat.dir}/lib"/>
<replaceregexp file="${tomcat.dir}/conf/server.xml" match="(Connector port=").*(" protocol="HTTP)" replace="\1${tomcat.connector.port}\2"/>
<replaceregexp file="${tomcat.dir}/conf/server.xml" match="(Server port=").*(" shutdown)" replace="\1${tomcat.server.port}\2"/>
<replace file="${tomcat.dir}/conf/catalina.properties" token="jarsToSkip=\" value="jarsToSkip=*" summary="true" unless:set="tomcat.dir.available"/><!-- speed up startup time -->
<replace file="${tomcat.dir}/conf/catalina.properties" token="jarsToScan=\" value="jarsToScan=frank-flow-*.jar,\" summary="true" unless:set="tomcat.dir.available"/>
<replaceregexp file="${tomcat.dir}/conf/catalina.properties" match="\# \<frank-runner\>.*\# \<\/frank-runner\>" replace="" flags="sg"/>
<concat destfile="${tomcat.dir}/conf/catalina.properties" append="true"># <frank-runner> ${system.properties} ${configurations.properties} ${tests.properties} # </frank-runner></concat>
<replaceregexp file="${tomcat.dir}/conf/logging.properties" match="^org\.apache\.catalina\.core.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers\ " replace="# org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers " flags="m"/><!-- some errors end up in localhost.<date>.log (e.g. when springIbisTestTool.xml is not correct), make them show up in the console -->
<delete><fileset dir="${tomcat.dir}/lib" includes="**-CUSTOM.jar"/></delete>
<available property="lib.server.dir.available" file="${projects.dir}/${project.dir}/${lib.server.dir}"/>
<copy todir="${tomcat.dir}/lib" if:set="lib.server.dir.available"><fileset dir="${projects.dir}/${project.dir}/${lib.server.dir}"/><globmapper from="*.jar" to="*-CUSTOM.jar"/></copy>
<!-- winmerge -->
<unzip src="download/${winmerge.zip}" dest="${winmerge.dir}" unless:set="winmerge.dir.available"/>
<!-- webapp -->
<property file="${webapp.dir}/META-INF/maven/org.ibissource/ibis-adapterframework-webapp/pom.properties" prefix="pom.properties."/>
<dirset id="contexts.dirs.id" dir="${tomcat.dir}/webapps" includes="*"/>
<pathconvert property="contexts.dirs" refid="contexts.dirs.id" dirsep="," pathsep=","><mapper type="flatten"/></pathconvert>
<condition property="maven.or.ff.version.changed.or.context.path.changed"><or><istrue value="${maven}"/><not><equals arg1="${ff.version}" arg2="${pom.properties.version}"/></not><not><equals arg1="${contexts.dirs}" arg2="${context.path}"/></not></or></condition>
<delete includeemptydirs="true" if:set="maven.or.ff.version.changed.or.context.path.changed"><fileset dir="${tomcat.dir}/webapps" includes="**/*"/></delete>
<unzip src="download/${ff.war}" dest="${webapp.dir}" if:set="maven.or.ff.version.changed.or.context.path.changed" unless:true="${maven}"/>
<delete><fileset dir="${webapp.dir}/WEB-INF/lib" includes="**-CUSTOM.jar"/></delete>
<available property="lib.webapp.dir.available" file="${projects.dir}/${project.dir}/${lib.webapp.dir}"/>
<copy todir="${webapp.dir}/WEB-INF/lib" if:set="lib.webapp.dir.available"><fileset dir="${projects.dir}/${project.dir}/${lib.webapp.dir}"/><globmapper from="*.jar" to="*-CUSTOM.jar"/></copy>
<fileset id="webapp.lib.jars.id" dir="${webapp.dir}/WEB-INF/lib" includes="*.jar"/>
<pathconvert property="webapp.lib.jars" refid="webapp.lib.jars.id" pathsep="|"><mapper type="flatten"/></pathconvert>
<doublejars jars="${webapp.lib.jars}"/>
<fail message="The following double jars are found: ${double.jars} ${webapp.dir}/WEB-INF/lib - When maven=true use maven.clean=true at least once - Check your pom.xml for dependencies that are being added that are already in the framework war (Maven doesn't check for duplicates against jar files in a war) - The framework war might contain a duplicate jar which should be reported as a bug (when an artifact changes it's groupid between versions Maven will not detect it to be a duplicat jar when one transitive dependency has the old one and another has the new one so one of them has to be excluded in the framework pom.xml) - As a workaround use ignore.double.jars=true" if:set="double.jars" unless:true="${ignore.double.jars}"/>
<!-- context.xml -->
<available property="context.xml.source" value="${projects.dir}/${project.dir}/${context.xml}" file="${projects.dir}/${project.dir}/${context.xml}"/>
<property name="context.xml.source" value="database/${database.type}/context.xml"/>
<property name="context.xml.target" value="${webapp.dir}/META-INF/context.xml" unless:true="${maven}"/>
<property name="context.xml.target" value="${tomcat.dir}/conf/Catalina/localhost/${context.path}.xml" if:true="${maven}"/>
<delete dir="${tomcat.dir}/conf/Catalina/localhost"/><!-- xml file could have a different name in previous run or in previous run maven could be true and in current run false -->
<delete file="${context.xml.target}"/><!-- in case ${context.xml.source} doesn't point to a file next copy will not clean ${context.xml.target} -->
<copy file="${context.xml.source}" tofile="${context.xml.target}"/>
<lower from="${instance.name}" to="instance.name.lc"/>
<replace file="${context.xml.target}" token="@instance.name.lc@" value="${instance.name.lc}" summary="true"/>
<replace file="${context.xml.target}" token="@h2.dir@" value="${h2.dir}" summary="true"/>
<replace file="${tomcat.dir}/conf/Catalina/localhost/${context.path}.xml" token="<Context>" value="<Context docBase="${webapp.dir}">" summary="true" if:true="${maven}"/>
<!-- classes -->
<delete dir="${webapp.dir}/WEB-INF/classes" unless:true="${maven}"/>
<mkdir dir="${webapp.dir}/WEB-INF/classes" unless:true="${maven}"/>
<available property="java.dir.available" file="${projects.dir}/${project.dir}/${java.dir}"/>
<javac srcdir="${projects.dir}/${project.dir}/${java.dir}" destdir="${webapp.dir}/WEB-INF/classes" includeantruntime="false" if:set="java.dir.available" unless:true="${maven}">
<classpath>
<fileset dir="${webapp.dir}/WEB-INF/lib"><include name="*.jar"/></fileset>
<fileset dir="${tomcat.dir}/lib"><include name="*.jar"/></fileset>
</classpath>
</javac>
<available property="classes.dir.available" file="${projects.dir}/${project.dir}/${classes.dir}"/>
<copy todir="${webapp.dir}/WEB-INF/classes" if:set="classes.dir.available" unless:true="${maven}">
<fileset dir="${projects.dir}/${project.dir}/${classes.dir}"/>
</copy>
<!-- scripts -->
<antcall target="generate.bat"><param name="filename" value="ant"/></antcall>
<antcall target="generate.bat"><param name="filename" value="mvn"/></antcall>
<antcall target="generate.bat"><param name="filename" value="start"/></antcall>
<antcall target="generate.bat"><param name="filename" value="stop"/></antcall>
<antcall target="generate.bat"><param name="filename" value="run"/></antcall>
<antcall target="generate.bat"><param name="filename" value="restart"/></antcall>
<antcall target="generate.bat"><param name="filename" value="rerun"/></antcall>
<antcall target="generate.sh"><param name="filename" value="ant"/></antcall>
<antcall target="generate.sh"><param name="filename" value="mvn"/></antcall>
<antcall target="generate.sh"><param name="filename" value="start"/></antcall>
<antcall target="generate.sh"><param name="filename" value="stop"/></antcall>
<antcall target="generate.sh"><param name="filename" value="run"/></antcall>
<antcall target="generate.sh"><param name="filename" value="restart"/></antcall>
<antcall target="generate.sh"><param name="filename" value="rerun"/></antcall>
</target>
<target name="start" depends="build">
<condition property="use.exec.windows"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.windows"/></and></condition>
<condition property="use.exec.linux"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.linux"/></and></condition>
<condition property="use.exec.mac"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.mac"/></and></condition>
<condition property="use.java"><equals arg1="${use}" arg2="java"/></condition>
<!-- with exec in windows a new window will be opened -->
<exec executable="${tomcat.dir.windows}\bin\catalina.bat" output="${tomcat.dir.windows}\logs\tomcat-start.txt" vmlauncher="false" failonerror="true" if:set="use.exec.windows">
<arg value="start"/>
<env key="JAVA_HOME" value="${jdk.dir.windows}"/>
<env key="CATALINA_HOME" value="${tomcat.dir.windows}"/>
<env key="JAVA_OPTS" value="-Xmx${maxmemory}"/>
</exec>
<exec executable="${tomcat.dir}/bin/catalina.sh" output="${tomcat.dir}/logs/tomcat-start.txt" vmlauncher="false" failonerror="true" if:set="use.exec.linux">
<arg value="start"/>
<env key="JAVA_HOME" value="${jdk.dir}"/>
<env key="CATALINA_HOME" value="${tomcat.dir}"/>
<env key="JAVA_OPTS" value="-Xmx${maxmemory}"/>
</exec>
<exec executable="${tomcat.dir}/bin/catalina.sh" output="${tomcat.dir}/logs/tomcat-start.txt" vmlauncher="false" failonerror="true" if:set="use.exec.mac">
<arg value="start"/>
<env key="JAVA_HOME" value="${jdk.dir}/Contents/Home"/>
<env key="CATALINA_HOME" value="${tomcat.dir}"/>
<env key="JAVA_OPTS" value="-Xmx${maxmemory}"/>
</exec>
<!-- with java in windows no new window will be opened -->
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true" maxmemory="${maxmemory}" if:set="use.java">
<jvmarg value="-Dcatalina.home=${tomcat.dir}"/>
<arg value="start"/>
<classpath>
<fileset dir="${tomcat.dir}/bin"><include name="*.jar"/></fileset>
<fileset dir="${tomcat.dir}/lib"><include name="*.jar"/></fileset>
</classpath>
</java>
<antcall target="splash"/>
</target>
<target name="run" depends="build">
<condition property="use.exec"><equals arg1="${use}" arg2="exec"/></condition>
<condition property="use.java"><not><equals arg1="${use}" arg2="exec"/></not></condition>
<antcall target="splash"/>
<echo message=" "/><!-- space instead of empty for eclipse -->
<echo message=" "/>
<!-- with exec in windows a ctrl-c will not kill tomcat -->
<exec executable="${tomcat.dir.windows}\bin\catalina.bat" vmlauncher="false" failonerror="true" if:set="use.exec">
<arg value="run"/>
<env key="JAVA_HOME" value="${jdk.dir.windows}"/>
<env key="CATALINA_HOME" value="${tomcat.dir.windows}"/>
<env key="JAVA_OPTS" value="-Xmx${maxmemory}"/>
</exec>
<!-- with java in windows a ctrl-c will kill tomcat -->
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" failonerror="true" maxmemory="${maxmemory}" if:set="use.java">
<jvmarg value="-Dcatalina.home=${tomcat.dir}"/>
<arg value="start"/>
<classpath>
<fileset dir="${tomcat.dir}/bin"><include name="*.jar"/></fileset>
<fileset dir="${tomcat.dir}/lib"><include name="*.jar"/></fileset>
</classpath>
</java>
</target>
<!-- don't add depends="build" because when tomcat is running resources may be locked which will result in "Unable to delete file" build failures -->
<target name="stop" depends="init">
<condition property="tomcat.running"><or><socket server="localhost" port="${tomcat.connector.port}"/><socket server="localhost" port="${tomcat.server.port}"/></or></condition>
<!-- prevent error in case another process in running on the tomcat port(s) and build.xml is running for the first time so catalina.bat is not present yet -->
<condition property="catalina.bat.not.present"><not><resourceexists><file file="${tomcat.dir.windows}\bin\catalina.bat"/></resourceexists></not></condition>
<condition property="use.exec.windows" if:set="tomcat.running" unless:set="catalina.bat.not.present"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.windows"/></and></condition>
<condition property="use.exec.linux" if:set="tomcat.running" unless:set="catalina.bat.not.present"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.linux"/></and></condition>
<condition property="use.exec.mac" if:set="tomcat.running" unless:set="catalina.bat.not.present"><and><not><equals arg1="${use}" arg2="java"/></not><isset property="os.mac"/></and></condition>
<condition property="use.java" if:set="tomcat.running" unless:set="catalina.bat.not.present"><equals arg1="${use}" arg2="java"/></condition>
<exec executable="${tomcat.dir.windows}\bin\catalina.bat" output="${tomcat.dir.windows}\logs\tomcat-stop.txt" vmlauncher="false" failonerror="true" if:set="use.exec.windows">
<arg value="stop"/>
<env key="JAVA_HOME" value="${jdk.dir.windows}"/>
<env key="CATALINA_HOME" value="${tomcat.dir.windows}"/>
</exec>
<exec executable="${tomcat.dir.windows}/bin/catalina.sh" output="${tomcat.dir.windows}/logs/tomcat-stop.txt" vmlauncher="false" failonerror="true" if:set="use.exec.linux">
<arg value="stop"/>
<env key="JAVA_HOME" value="${jdk.dir}"/>
<env key="CATALINA_HOME" value="${tomcat.dir}"/>
</exec>
<exec executable="${tomcat.dir.windows}/bin/catalina.sh" output="${tomcat.dir.windows}/logs/tomcat-stop.txt" vmlauncher="false" failonerror="true" if:set="use.exec.mac">
<arg value="stop"/>
<env key="JAVA_HOME" value="${jdk.dir}/Contents/Home"/>
<env key="CATALINA_HOME" value="${tomcat.dir}"/>
</exec>
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" failonerror="true" if:set="use.java">
<jvmarg value="-Dcatalina.home=${tomcat.dir}"/>
<arg value="stop"/>
<classpath>
<fileset dir="${tomcat.dir}/bin"><include name="*.jar"/></fileset>
<fileset dir="${tomcat.dir}/lib"><include name="*.jar"/></fileset>
</classpath>
</java>
<tstamp><format property="stop.begin" pattern="HH:mm:ss"/></tstamp>
<property name="stop.maxwait" value="300"/>
<property name="stop.maxwaitunit" value="second"/>
<condition property="waitfor.unless"><or><isset property="catalina.bat.not.present"/><equals arg1="${tomcat.skip.waitfor}" arg2="true"/></or></condition>
<echo message="${stop.begin} Wait max ${stop.maxwait} ${stop.maxwaitunit}s for Tomcat to stop" if:set="tomcat.running" unless:set="waitfor.unless"/>
<waitfor maxwait="${stop.maxwait}" maxwaitunit="${stop.maxwaitunit}" timeoutproperty="stop.failed" if:set="tomcat.running" unless:set="waitfor.unless">
<not><or><socket server="localhost" port="${tomcat.connector.port}"/><socket server="localhost" port="${tomcat.server.port}"/></or></not>
</waitfor>
<fail message="Tomcat (or another process) is still running on port ${tomcat.connector.port} and/or ${tomcat.server.port}. Please stop Tomcat manually or try again" if:set="stop.failed"/>
<tstamp><format property="stop.end" pattern="HH:mm:ss"/></tstamp>
<echo message="${stop.end} Done" if:set="tomcat.running" unless:set="waitfor.unless"/>
</target>
<target name="restart">
<antcall target="stop"/>
<antcall target="start"/>
</target>
<target name="rerun">
<antcall target="stop"/>
<antcall target="run"/>
</target>
<target name="get.java" unless="jdk.zip.available">
<get src="${jdk.url}" dest="download/${jdk.zip}" verbose="on"/>
</target>
<target name="get.ant" unless="ant.zip.available">
<get src="${ant.url}" dest="download/${ant.zip}" verbose="on"/>
</target>
<target name="get.maven" unless="maven.zip.available">
<get src="${maven.url}" dest="download/${maven.zip}" verbose="on"/>
</target>
<target name="get.tomcat" unless="tomcat.zip.available">
<get src="${tomcat.url}" dest="download/${tomcat.zip}" verbose="on"/>
</target>
<target name="get.winmerge" unless="winmerge.zip.available">
<get src="${winmerge.url}" dest="download/${winmerge.zip}" verbose="on"/>
</target>
<target name="get.ff" unless="ff.war.available">
<get src="${ff.url}" dest="download/${ff.war}" verbose="on"/>
</target>
<target name="get.jms" unless="jms.jar.available">
<get src="${jms.url}" dest="download/${jms.jar}" verbose="on"/>
</target>
<target name="get.h2" unless="h2.jar.available">
<get src="${h2.url}" dest="download/${h2.jar}" verbose="on"/>
</target>
<target name="get.ojdbc" unless="ojdbc.jar.available">
<get src="${ojdbc.url}" dest="download/${ojdbc.jar}" verbose="on"/>
</target>
<target name="get.mssql" unless="mssql.jar.available">
<get src="${mssql.url}" dest="download/${mssql.jar}" verbose="on"/>
</target>
<target name="generate.bat">
<condition property="ant"><equals arg1="${filename}" arg2="ant"/></condition>
<condition property="mvn"><equals arg1="${filename}" arg2="mvn"/></condition>
<condition property="ant.or.mvn"><or><isset property="ant"/><isset property="mvn"/></or></condition>
<echo file="${filename}.bat">:: This file is generated by build.xml
@echo off
setlocal enabledelayedexpansion
if not exist "%~dp0download\" (
mkdir "%~dp0download"
)
if not exist "%~dp0build\tmp\build\" (
mkdir "%~dp0build\tmp\build"
)</echo>
<antcall target="generate.bat.download.unzip"><param name="zip" value="${jdk.zip.win}"/><param name="url" value="${jdk.url.win}"/><param name="dir.windows" value="${jdk.dir.windows}"/></antcall>
<antcall target="generate.bat.download.unzip" unless:set="mvn"><param name="zip" value="${ant.zip}"/><param name="url" value="${ant.url}"/><param name="dir.windows" value="${ant.dir.windows}"/></antcall>
<antcall target="generate.bat.download.unzip" if:set="mvn"><param name="zip" value="${maven.zip}"/><param name="url" value="${maven.url}"/><param name="dir.windows" value="${maven.dir.windows}"/></antcall>
<echo file="${filename}.bat" append="true">
set JAVA_HOME=%~dp0${jdk.dir.windows}</echo>
<echo file="${filename}.bat" append="true" unless:set="mvn">
set ANT_HOME=%~dp0${ant.dir.windows}</echo><!-- prevent problems on systems with ant installed (e.g. when ANT_HOME point to an old ant version that version will be used which might not support all tasks and attributes) -->
<echo file="${filename}.bat" append="true">
call "%~dp0</echo>
<echo file="${filename}.bat" append="true" unless:set="mvn">${ant.dir.windows}\bin\ant" -emacs</echo><!-- -emacs will prevent prefix being added to every line of output -->
<echo file="${filename}.bat" append="true" if:set="mvn">${maven.dir.windows}\bin\mvn.cmd"</echo>
<echo file="${filename}.bat" append="true" unless:set="ant.or.mvn"> -buildfile "%~dp0build.xml"</echo>
<echo file="${filename}.bat" append="true"> %*</echo>
<echo file="${filename}.bat" append="true" unless:set="ant.or.mvn"> ${filename}</echo>
<echo file="${filename}.bat" append="true">
if %errorlevel% equ 0 goto end
:error
rem https://superuser.com/questions/527898/how-to-pause-only-if-executing-in-a-new-window
set arg0=%0
if [%arg0:~2,1%]==[:] if not [%TERM_PROGRAM%] == [vscode] pause
exit /b %errorlevel%<!-- this will make failonerror="true" work when the bat file is called from ant with the exec task -->
:end
</echo>
</target>
<target name="generate.sh">
<condition property="ant"><equals arg1="${filename}" arg2="ant"/></condition>
<condition property="mvn"><equals arg1="${filename}" arg2="mvn"/></condition>
<condition property="ant.or.mvn"><or><isset property="ant"/><isset property="mvn"/></or></condition>
<echo file="${filename}.sh">#!/bin/bash
# This file is generated by build.xml
FR_DIR="`pwd`/`dirname $0`/"
if [[ ! -d "${FR_DIR}download/" ]]; then
mkdir "${FR_DIR}download/"
fi
if [[ ! -d "${FR_DIR}build/tmp/build/" ]]; then
mkdir -p "${FR_DIR}build/tmp/build"
fi</echo>
<antcall target="generate.sh.download.unzip"><param name="zip" value="${jdk.zip.lin}"/><param name="url" value="${jdk.url.lin}"/><param name="dir" value="${jdk.dir}"/></antcall>
<antcall target="generate.sh.download.unzip" unless:set="mvn"><param name="zip" value="${ant.zip}"/><param name="url" value="${ant.url}"/><param name="dir" value="${ant.dir}"/></antcall>
<antcall target="generate.sh.download.unzip" if:set="mvn"><param name="zip" value="${maven.zip}"/><param name="url" value="${maven.url}"/><param name="dir" value="${maven.dir}"/></antcall>
<echo file="${filename}.sh" append="true">
export JAVA_HOME="${FR_DIR}${jdk.dir}"
if [[ "$OSTYPE" == "darwin"* ]]; then
export JAVA_HOME="${FR_DIR}${jdk.dir}/Contents/Home"
fi</echo>
<echo file="${filename}.sh" append="true" unless:set="mvn">
export ANT_HOME="${FR_DIR}${ant.dir}"</echo><!-- prevent problems on systems with ant installed (e.g. when ANT_HOME point to an old ant version that version will be used which might not support all tasks and attributes) -->
<echo file="${filename}.sh" append="true" unless:set="ant.or.mvn">
cd "${FR_DIR}"</echo><!-- Using -buildfile "${FR_DIR}build.xml" instead of cd "${FR_DIR}" doesn't work on Mac (double path in path to build.xml) -->
<echo file="${filename}.sh" append="true">
"${FR_DIR}</echo>
<echo file="${filename}.sh" append="true" unless:set="mvn">${ant.dir}/bin/ant" -emacs</echo><!-- -emacs will prevent prefix being added to every line of output -->
<echo file="${filename}.sh" append="true" if:set="mvn">${maven.dir}/bin/mvn"</echo>
<echo file="${filename}.sh" append="true"> "$@"</echo>
<echo file="${filename}.sh" append="true" unless:set="ant.or.mvn"> ${filename}</echo>
<chmod file="${filename}.sh" perm="+x"/>
</target>
<target name="generate.bat.download.unzip">
<echo file="${filename}.bat" append="true">
set DOWNLOAD_HELP=download ${url} manually, move it to %~dp0download and restart this script
if not exist "%~dp0download\${zip}" (
echo In case of errors %DOWNLOAD_HELP%
curl -f -o "%~dp0download\${zip}.tmp" -L ${url}<!-- -f will set errorlevel and prevent html being written to output file when for example html with an error message and http status code 404 is returned -->
if !errorlevel! neq 0 (<!-- cannot use %errorlevel% in a block statement: https://stackoverflow.com/questions/35164750/windows-batch-errorlevel-with-if -->
echo Please %DOWNLOAD_HELP%
goto error
)
move "%~dp0download\${zip}.tmp" "%~dp0download\${zip}"
)
if not exist "%~dp0${dir.windows}\" (
tar --exclude=*/demo --exclude=*/sample --exclude=*/manual --exclude=*/src.zip -xvf "%~dp0download\${zip}" -C "%~dp0build\tmp\build"
if !errorlevel! neq 0 (<!-- cannot use %errorlevel% in a block statement: https://stackoverflow.com/questions/35164750/windows-batch-errorlevel-with-if -->
echo Please %DOWNLOAD_HELP%
goto error
)
move "%~dp0build\tmp\${dir.windows}" "%~dp0${dir.windows}"
)</echo><!-- When a proxy replaces the content of the zip with an html page saying access is denied curl doesn't notice it, hence an error occurs when unzipping and the user also needs instruction to download manually when unzipping fails -->
</target>
<target name="generate.sh.download.unzip">
<echo file="${filename}.sh" append="true">
FR_DIR="`pwd`/`dirname $0`/"
ZIP=${zip}
URL=${url}
DIR=${dir}
if [[ "$OSTYPE" == "darwin"* ]]; then
ZIP=$${ZIP/linux/mac}
URL=$${URL/linux/mac}
fi
DOWNLOAD_HELP="download $${URL} manually, move it to $${FR_DIR}download and restart this script"
if [[ ! -f "$${FR_DIR}download/$${ZIP}" ]]; then
echo In case of errors $${DOWNLOAD_HELP}
curl -f -o "$${FR_DIR}download/$${ZIP}.tmp" -L $${URL}<!-- -f will return error 22 and prevent html being written to output file when for example html with an error message and http status code 404 is returned -->
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "Please $${DOWNLOAD_HELP}"
exit $retVal
fi
mv "$${FR_DIR}download/$${ZIP}.tmp" "$${FR_DIR}/download/$${ZIP}"
fi
if [[ ! -d "$${FR_DIR}$${DIR}/" ]]; then
tar --exclude=*/demo --exclude=*/sample --exclude=*/manual --exclude=*/src.zip -xzvf "$${FR_DIR}download/$${ZIP}" -C "$${FR_DIR}build/tmp/build"
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "Please $${DOWNLOAD_HELP}"
exit $retVal
fi
mv "$${FR_DIR}build/tmp/$${DIR}" "$${FR_DIR}$${DIR}"
fi</echo><!-- When a proxy replaces the content of the zip with an html page saying access is denied curl doesn't notice it, hence an error occurs when unzipping and the user also needs instruction to download manually when unzipping fails -->
</target>
<target name="splash">
<condition property="debug.true"><equals arg1="${debug}" arg2="true"/></condition>
<echo message="main.project: ${main.project}" if:set="debug.true"/>
<echo message="sub.project: ${sub.project}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/><!-- space instead of empty for eclipse -->
<echo message="projects.dir: ${projects.dir}" if:set="debug.true"/>
<echo message="project.dir: ${project.dir}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="war.pom.xml.available: ${war.pom.xml.available}" if:set="debug.true"/>
<echo message="pom.xml.available: ${pom.xml.available}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="classes.dir: ${classes.dir}" if:set="debug.true"/>
<echo message="configurations.dir: ${configurations.dir}" if:set="debug.true"/>
<echo message="java.dir: ${java.dir}" if:set="debug.true"/>
<echo message="tests.dir: ${tests.dir}" if:set="debug.true"/>
<echo message="context.xml: ${context.xml}" if:set="debug.true"/>
<echo message="maven.exec.dir: ${maven.exec.dir}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="maven: ${maven}" if:set="debug.true"/>
<echo message="maven.phase: ${maven.phase}" if:set="debug.true"/>
<echo message="maven.skip.clean: ${maven.skip.clean}" if:set="debug.true"/>
<echo message="maven.skip.tests: ${maven.skip.tests}" if:set="debug.true"/>
<echo message="maven.skip.javadoc: ${maven.skip.javadoc}" if:set="debug.true"/>
<echo message="maven.verbose: ${maven.verbose}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="classloader.type: ${classloader.type}" if:set="debug.true"/>
<echo message="lib.server.dir: ${lib.server.dir}" if:set="debug.true"/>
<echo message="lib.webapp.dir: ${lib.webapp.dir}" if:set="debug.true"/>
<echo message="database.type: ${database.type}" if:set="debug.true"/>
<echo message="dtap.stage: ${dtap.stage}" if:set="debug.true"/>
<echo message="otap.stage: ${otap.stage}" if:set="debug.true"/>
<echo message="ds.properties.instance.name: ${ds.properties.instance.name}" if:set="debug.true"/>
<echo message="ds.properties.configurations.names: ${ds.properties.configurations.names}" if:set="debug.true"/>
<echo message="instance.name: ${instance.name}" if:set="debug.true"/>
<echo message="ibistesttool.directory: ${ibistesttool.directory}" if:set="debug.true"/>
<echo message="scenariosroot1.directory: ${scenariosroot1.directory}" if:set="debug.true"/>
<echo message="scenariosroot1.description: ${scenariosroot1.description}" if:set="debug.true"/>
<echo message="larva.windiff.command: ${larva.windiff.command}" if:set="debug.true"/>
<echo message="context.path: ${context.path}" if:set="debug.true"/>
<echo message="maxmemory: ${maxmemory}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="update.strategy: ${update.strategy}" if:set="debug.true"/>
<echo message="ff.version: ${ff.version}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="webapp.dir: ${webapp.dir}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="system.properties:${system.properties}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="configurations.dirset.dir=${configurations.dirset.dir}" if:set="debug.true"/>
<echo message="configurations.dir.abs=${configurations.dir.abs}" if:set="debug.true"/>
<echo message="configurations.dir.rel=${configurations.dir.rel}" if:set="debug.true"/>
<echo message="configurations.dirset.includes=${configurations.dirset.includes}" if:set="debug.true"/>
<echo message="configurations.dirs.flat=${configurations.dirs.flat}" if:set="debug.true"/>
<echo message="configurations.properties:${configurations.properties}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message="projects.dir.abs=${projects.dir.abs}" if:set="debug.true"/>
<echo message="scenariosroot.default=${scenariosroot.default}" if:set="debug.true"/>
<echo message="tests.dirset.dir=${tests.dirset.dir}" if:set="debug.true"/>
<echo message="tests.dir.abs=${tests.dir.abs}" if:set="debug.true"/>
<echo message="tests.dir.rel=${tests.dir.rel}" if:set="debug.true"/>
<echo message="tests.dirset.includes=${tests.dirset.includes}" if:set="debug.true"/>
<echo message="tests.properties:${tests.properties}" if:set="debug.true"/>
<echo message=" " if:set="debug.true"/>
<echo message=" https://github.com/ibissource/frank-runner#frankrunner" if:set="debug.true"/>
<!-- http://www.network-science.de/ascii/ font standard -->
<echo message=" _____ _ _ ____"/>
<echo message=" | ___| __ __ _ _ __ | | _| | _ \ _ _ _ __ _ __ ___ _ __"/>
<echo message=" | |_ | '__/ _` | '_ \| |/ / | |_) | | | | '_ \| '_ \ / _ \ '__|"/>
<echo message=" | _|| | | (_| | | | | <|_| _ <| |_| | | | | | | | __/ |"/>
<echo message=" |_| |_| \__,_|_| |_|_|\_(_)_| \_\\__,_|_| |_|_| |_|\___|_|"/>
<echo message=" "/>
<condition property="splash.name" value="${instance.name}" else="${main.project}_${sub.project}"><not><isset property="sub.project"/></not></condition>
<condition property="splash.context" value="" else="${context.path}"><equals arg1="${context.path}" arg2="ROOT"/></condition>
<echo message=" ${splash.name} on http://localhost/${splash.context}"/>
<echo message=" " unless:set="frank.runner.up.to.date"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" unless:set="frank.runner.up.to.date"/>
<echo message=" !! Your Frank!Runner is out of date, please pull or download new version !!" unless:set="frank.runner.up.to.date"/>
<echo message=" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" unless:set="frank.runner.up.to.date"/>
</target>
<scriptdef language="javascript" name="lower">
<attribute name="from"/>
<attribute name="to"/>
project.setProperty(attributes.get("to"), attributes.get("from").toLowerCase());
</scriptdef>
<scriptdef language="javascript" name="doublejars">
<attribute name="jars"/>
var jars = attributes.get("jars").split('|');
var doubleJars = '';
var names = [];
for (var i = 0; i < jars.length; i++) {
var name = '';
var j = jars[i].indexOf('-');
while (j != -1) {
name = jars[i].substring(0, j);
if (jars[i].charAt(j + 1) >= '0' && jars[i].charAt(j + 1) <= '9') {
j = -1;
} else {
j = jars[i].indexOf('-', j + 1);
}
}
if (names.indexOf(name) != -1) {
if (doubleJars.length() == 0) {
doubleJars = name;
} else {
doubleJars += ', ' + name;
}
}
names.push(name);
}
if (doubleJars.length() > 0) {
project.setProperty('double.jars', doubleJars);
}
</scriptdef>
</project>