-
Notifications
You must be signed in to change notification settings - Fork 182
/
build.xml
3193 lines (2883 loc) · 170 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"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->
<project name="Scipio Main Build" default="build" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:sonar="antlib:org.sonar.ant:sonar"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<!--
SCIPIO MAIN BUILD
NOTES:
* macros.xml (legacy name) contains all early defs (including ofbiz.homedir),
defined for both main build invocations and component build subfolder ant invocations
* Main build properties that must be passed to iterated sub-builds must be declared in:
ofbiz.subbuild.props.pass
otherwise the defaults from macros.xml or common.xml will be used instead (if any)
* The framework/base/lib libraries are not automatically on the classpath; this is now (2017-02-02)
enforced; needed libs must be specified explicitly (<taskdef>), including for the <junit/> task.
-->
<!-- Local build properties file, ignored by version control - local developer/user settings -->
<property file="build.scp.local.properties"/><!-- standard filename -->
<property file="build.local.properties"/><!-- legacy filename -->
<!-- Default properties for your project - shared between developers/users -->
<property file="build.properties"/>
<!-- Contains reusable definitions to all builds and default compilation settings -->
<import file="macros.xml"/>
<!-- ================================================================== -->
<!-- SCIPIO: early-inclusion, new, original properties and tasks -->
<!-- ================================================================== -->
<!-- NOTE: Properties may also be defined in macros.xml (e.g. for standalone component task support) -->
<!-- IVY BYPASS: set this to true (or pass -Dlib.update.bypass=true) to prevent
automatic lib update check upon build and other target invocations
2017-02-03: Ivy now enabled by default (bypass false) -->
<property name="lib.update.bypass" value="false"/>
<!-- IVY AUTO MODE: set this to either "global" (runs all lib updates globally, before global build)
or "component" (runs per-component, before each component) -->
<property name="lib.update.hook.mode" value="component"/>
<property name="framework.dir" value="framework"/>
<property name="applications.dir" value="applications"/>
<property name="specialpurpose.dir" value="specialpurpose"/>
<property name="themes.dir" value="themes"/>
<property name="addons.dir" value="addons"/>
<property name="hotdeploy.dir" value="hot-deploy"/>
<!-- Top-level component directories, in their generally-expect build and load order
NOTE: 2017-01-31: build order is for now rectified to framework->themes->... in order for the build order
to be consistent with the component load order (as defined in stock ofbiz) -->
<property name="ofbiz.component.dirs" value="framework,themes,applications,specialpurpose,addons,hot-deploy"/>
<property file="${framework.dir}/base/config/scipiometainfo.properties" />
<!-- 2017-02-01: Names of properties (such as those defined above) that should always be passed
to sub-project builds by subant. mainly used by externalsubant and iterate in macros.xml -->
<propertyset id="ofbiz.subbuild.props.pass">
<propertyref name="ofbiz.home.dir"/>
<propertyref name="ofbiz.component.dirs"/>
<propertyref regex="scipio\.build\..*"/>
<propertyref regex="lib\.update\..*"/>
<propertyref regex="lib\.clean\..*"/>
<propertyref regex="lib\.entity\..*"/><!-- FIXME?: unfortunate exception... should have been lib.scpcfg.entity... too late -->
<propertyref regex="lib\.scpcfg\..*"/><!-- for custom lib properties for components; should be named: lib.scpcfg.[componentname].* -->
<propertyref regex="comp.scpcfg\..*"/><!-- for component-specific config properties; should be named: comp.scpcfg.[componentname].* -->
<propertyref regex="scpcfg\..*"/>
<propertyref name="ivy.settings.file"/>
<propertyref name="checkreqs.ran"/>
</propertyset>
<!-- Random seed, workaround for lockups on some systems -->
<property name="scipio.exec.os.linux.randseed" value="file:///dev/./urandom"/>
<!-- Dynamic early main build.xml additions. Allows any component or addon to include
a file named "build-main-early.xml" in its folder, which will be imported into
the main build, supporting plugin-like additions to root build.xml.
NOTE: ant does not support overriding existing tasks this way, but new tasks may be added. -->
<fileset id="framework.earlymainbuilds" dir="${framework.dir}">
<exclude name="disabled/**"/>
<include name="*/build-main-early.xml" />
</fileset>
<fileset id="applications.earlymainbuilds" dir="${applications.dir}">
<exclude name="disabled/**"/>
<include name="*/build-main-early.xml" />
</fileset>
<fileset id="specialpurpose.earlymainbuilds" dir="${specialpurpose.dir}">
<exclude name="disabled/**"/>
<include name="*/build-main-early.xml" />
</fileset>
<fileset id="addons.earlymainbuilds" dir="${addons.dir}">
<exclude name="disabled/**"/>
<include name="*/build-main-early.xml" />
</fileset>
<fileset id="hotdeploy.earlymainbuilds" dir="${hotdeploy.dir}">
<exclude name="disabled/**"/>
<include name="*/build-main-early.xml" />
</fileset>
<import optional="true">
<fileset file="tools/misc/build-dummy.xml" /><!-- at least one import required -->
<fileset refid="framework.earlymainbuilds" />
</import>
<import optional="true">
<fileset file="tools/misc/build-dummy.xml" /><!-- at least one import required -->
<fileset refid="applications.earlymainbuilds" />
</import>
<import optional="true">
<fileset file="tools/misc/build-dummy.xml" /><!-- at least one import required -->
<fileset refid="specialpurpose.earlymainbuilds" />
</import>
<import optional="true">
<fileset file="tools/misc/build-dummy.xml" /><!-- at least one import required -->
<fileset refid="addons.earlymainbuilds" />
</import>
<import optional="true">
<fileset file="tools/misc/build-dummy.xml" /><!-- at least one import required -->
<fileset refid="hotdeploy.earlymainbuilds" />
</import>
<!-- ================================================================== -->
<!-- SCIPIO: original (and modified) ofbiz properties -->
<!-- ================================================================== -->
<property name="site.dir" value="../site"/>
<property name="memory.initial.param" value="-Xms128M"/>
<property name="memory.max.param" value="-Xmx3512M"/>
<!-- SCIPIO: New properties -->
<!-- Solr properties -->
<property name="solr.home" value="applications/solr"/>
<property name="solr.log.dir" value="runtime/logs/solr"/><!-- added 2017-09-08 -->
<!-- Solr instance locking - see solrconfig.xml for details -->
<!-- 2017-09-12: FIXME?: Ideally we should use "native", but issues have been encountered with write.lock;
as workaround, use file-less "single" instance lock - there should no issues because running
two ofbiz instances always fails before webapps load, due to ports-in-use. -->
<!--<property name="solr.lock.type" value="native"/>-->
<property name="solr.lock.type" value="single"/>
<!-- Passing -Dscipio.solr.reindex.startup.force=true or uncommenting forces rebuildSolrIndex(Auto) on startup;
see also "[set|start|...]-reindex-solr" helper tasks. -->
<!--<property name="scipio.solr.reindex.startup.force" value="true"/>-->
<!-- Backward-compat for old property name -->
<!-- If set to "true", prevents editing Solr config through Solr webapp's config API -->
<property name="solr.disable.configEdit" value=""/><!-- added 2017-10-12 -->
<import file="framework/build.xml" optional="false"/>
<available file="applications/build.xml" property="applications.present"/>
<import file="applications/build.xml" optional="true"/>
<available file="specialpurpose/build.xml" property="specialpurpose.present"/>
<import file="specialpurpose/build.xml" optional="true"/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<target name="ofbiz-init" depends="dir-init,ivy-init">
<property environment="env"/>
</target>
<target name="dir-init">
<mkdir dir="runtime"/>
<mkdir dir="runtime/output"/>
<mkdir dir="runtime/logs"/>
<mkdir dir="runtime/logs/test-results"/>
<mkdir dir="runtime/logs/solr"/><!-- SCIPIO: for solr.log.dir, added 2017-09-08 -->
<mkdir dir="runtime/data"/>
<mkdir dir="runtime/data/derby"/>
<condition property="isMac">
<os family="mac"/>
</condition>
<antcall target="copy-derby-props" inheritall="true"/>
</target>
<target name="copy-derby-props" if="isMac">
<copy file="runtime/data/derby.properties" todir="runtime/data/derby"/>
</target>
<target name="sonar-init" depends="ivy-init">
<path id="sonar-ant-tasks.class.path">
<fileset dir="${ofbiz.home.dir}/framework/base/lib/ant-opt/sonar-ant-task" includes="*.jar"/>
</path>
<taskdef uri="antlib:org.sonar.ant:sonar" resource="org/sonar/ant/antlib.xml" classpathref="sonar-ant-tasks.class.path"/>
</target>
<!-- SCIPIO: solr flagging -->
<target name="set-reindex-solr">
<property name="scipio.solr.reindex.startup.force" value="true"/>
</target>
<target name="set-no-reindex-solr">
<property name="scipio.solr.reindex.startup.force" value="false"/>
</target>
<target name="set-bypass-crashed-reindex-solr">
<!-- NOTE: Escape dollar sign because interpreted by ant -->
<property name="scipio.job.crashed.ignore.filter" value="${job.serviceName=='rebuildSolrIndex'}"/>
</target>
<!-- ================================================================== -->
<!-- Removes all created files and directories -->
<!-- ================================================================== -->
<target name="refresh"
description="Clean all and rebuild">
<antcall target="clean-all"/>
<antcall target="build"/>
</target>
<target name="clean-all"
description="Clean DB (Derby), Catalina and caches data, logs, and runtime subdirectories and all specific files like .rej, .orig (NOTE: does NOT clear external DBs: postgres/mysql/etc.)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-all" />
<antcall target="clean-ivy"/>
<if><!-- SCIPIO: NOTE: 2017-04-11: we'll now clear out the deploy folders here by default, because the clean-downloads
call below which we just removed was already doing this, and it doesn't look like it was causing issues for anyone
<equals arg1="${lib.clean.deployed}" arg2="true"/>-->
<not><equals arg1="${lib.clean.deployed}" arg2="false"/></not>
<then>
<antcall target="lib-clean-deployed" inheritrefs="true"/>
</then>
</if>
<antcall target="clean-data"/>
<antcall target="clean-logs"/>
<antcall target="clean-output"/>
<antcall target="clean-xtra"/>
<antcall target="clean-catalina"/>
<antcall target="clean-cache"/>
<antcall target="clean-tempfiles"/>
<antcall target="clean-search-indexes"/>
<!-- SCIPIO: 2017-04-11: do NOT run clean-downloads on clean-all - you must run
clean-downloads explicitly to remove those - and they are currently do not represent
all supported JDBC drivers but only the legacy ofbiz download targets (TODO: clarify the legacy download targets)
<antcall target="clean-downloads"/>-->
<antcall target="clean-uploads"/>
<antcall target="clean-analysis"/><!-- SCIPIO: 2018-04-24: new -->
<antcall target="clean"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-all" />
</target>
<target name="clean-downloads"
description="Clean all downloaded files (NOTE: to avoid removing JDBC drivers, use lib-clean instead)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-downloads" />
<delete verbose="true" deleteonexit="true">
<fileset dir="framework/base/lib/ant-opt" includes="**/*.jar"/>
<!-- SCIPIO: 2017-04-11: for this to be consistent we have to remove all except derby
<fileset dir="framework/entity/lib/jdbc" includes="postgresql-*.jar"/>
<fileset dir="framework/entity/lib/jdbc" includes="mysql-*.jar"/>-->
<fileset dir="framework/entity/lib/jdbc" includes="*.jar" excludes="derby-*.jar"/>
</delete>
<antcall target="clean-ivy"/>
<if><!-- SCIPIO: NOTE: 2017-02-03: new -->
<not><equals arg1="${lib.clean.deployed}" arg2="false"/></not>
<then>
<antcall target="lib-clean-deployed" inheritrefs="true"/>
</then>
</if>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-downloads" />
</target>
<target name="clean-data"
description="Clean DB (Derby) data under runtime/data (NOTE: does NOT clear external DBs: postgres/mysql/etc.)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-data" />
<delete verbose="on" includeemptydirs="true">
<fileset dir="runtime/data" includes="**/*">
<exclude name="README"/>
<exclude name="derby.properties"/>
</fileset>
</delete>
<delete file="runtime/data.zip"/>
<delete file="runtime/test-list-build.xml"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-data" />
</target>
<target name="clean-logs"
description="Clean all logs in runtime/logs">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-logs" />
<delete verbose="on" includeemptydirs="true">
<fileset dir="runtime/logs" includes="**/*">
<exclude name="README"/>
</fileset>
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-logs" />
</target>
<target name="clean-output"
description="Clean runtime/output directory">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-output" />
<delete verbose="on" includeemptydirs="true">
<fileset dir="runtime/output" includes="**/*">
<exclude name="README"/>
</fileset>
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-output" />
</target>
<target name="clean-xtra"
description="Clean all other files like .rej, .orig, etc.">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-xtra" />
<delete verbose="on">
<fileset dir="." includes="**/.nbattrs,**/*~,**/.#*,**/.DS_Store,**/*.rej,**/*.orig"/>
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-xtra" />
</target>
<target name="clean-catalina"
description="Clean Catalina data in runtime/catalina/work">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-catalina" />
<delete dir="runtime/catalina/work"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-catalina" />
</target>
<target name="clean-cache"
description="Clean the UtilCache file if errors found with old objects in the cache (Java runtime error something like 'local class incompatible')">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-cache" />
<property file="framework/base/config/cache.properties"/>
<echo message="NOTICE: deleting ${cache.file.store}.db"/>
<delete file="${cache.file.store}.db" verbose="true"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-cache" />
</target>
<target name="clean-tempfiles"
description="Remove files located in runtime/tempfiles (captcha, etc...)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-tempfiles" />
<delete includeemptydirs="true">
<fileset dir="./runtime/tempfiles" includes="**/*">
<exclude name="README"/>
</fileset>
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-tempfiles" />
</target>
<target name="clean-search-indexes"
description="Remove (Solr) search indexes/data created under runtime/indexes and anywhere else">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-search-indexes" />
<delete includeemptydirs="true">
<fileset dir="./runtime/indexes" includes="**/*" erroronmissingdir="false" >
<exclude name="README"/>
</fileset>
</delete>
<!-- SCIPIO: the Solr data is now actually stored under applications/solr -->
<externalsubant target="clean-local-solr-indexes">
<fileset dir="${basedir}/applications/solr">
<include name="build.xml" />
</fileset>
</externalsubant>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-search-indexes" />
</target>
<target name="clean-uploads"
description="Remove uploaded files">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-uploads" />
<delete includeemptydirs="true">
<fileset dir="./runtime/uploads" includes="**/*" erroronmissingdir="false" />
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-uploads" />
</target>
<target name="clean-analysis" description="Remove code analysis results (Scipio)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-analysis" />
<delete includeemptydirs="true">
<fileset dir="./runtime/analysis" includes="**/*" erroronmissingdir="false" />
</delete>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-analysis" />
</target>
<target name="tests" depends="ofbiz-init">
<!-- SCIPIO: hooks -->
<invokehook target="pre-tests" />
<iterate target="tests" filelist="test-builds"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-tests" />
</target>
<target name="clean" depends="ivy-init,check-build-requisites,build-scipio-build-tools">
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean" />
<hotdeployant target="clean"/>
<!-- SCIPIO: addons dir -->
<addonsant target="clean"/>
<antcall target="clean-specialpurpose"/>
<antcall target="clean-applications"/>
<!-- SCIPIO: 2017-01-19: added clean task for themes (not invoked stock ofbiz); 2017-01-31: rectified build order -->
<dep-subant dir="${basedir}/themes" target="clean"/>
<antcall target="clean-framework"/>
<delete file="ofbiz.jar"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean" />
<echo message="[clean] ========== Done Cleaning =========="/>
</target>
<target name="clean-framework">
<iterate target="clean" filelist="framework-builds"/>
</target>
<target name="clean-applications" if="${applications.present}">
<iterate target="clean" filelist="application-builds"/>
</target>
<target name="clean-specialpurpose" if="${specialpurpose.present}">
<iterate target="clean" filelist="specialpurpose-builds"/>
</target>
<target name="svninfo"
description="Update the Release-revision info in the footer. Note that you need a valid Internet connection and Subversion connected to the Scipio repository for that ">
<echo message="Creating svninfo..."/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-svninfo" />
<exec executable="svn" dir="." output="runtime/svninfo_tmp.xml">
<arg value="info"/>
<arg value="--xml"/>
</exec>
<xmlproperty file="runtime/svninfo_tmp.xml"/>
<echo message="Rev:${info.entry.commit(revision)}"/>
<basename property="releasePath" file="${info.entry.url}"/>
<tstamp>
<format property="dateTime" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<echo message=" - Release-revision : ${releasePath}-r${info.entry.commit(revision)}, ${uiLabelMap.CommonBuiltOn} ${dateTime}" file="runtime/svninfo.ftl"/>
<delete file="runtime/svninfo_tmp.xml"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-svninfo" />
<echo message="Done!"/>
</target>
<target name="clean-svninfo">
<echo message="Resetting svninfo..."/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-svninfo" />
<echo message=" " file="runtime/svninfo.ftl"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-svninfo" />
<echo message="Done!"/>
</target>
<target name="gitinfo"
description="Update the Git Branch-revision info in the footer.">
<echo message="Creating gitinfo..."/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-gitinfo" />
<exec executable="git" outputproperty="branch">
<arg value="rev-parse"/>
<arg value="--abbrev-ref"/>
<arg value="HEAD"/>
</exec>
<exec executable="git" outputproperty="revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<tstamp>
<format property="dateTime" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<echo message="Found Branch-revision: ${branch}-${revision}"/>
<echo message=" - Branch-revision: ${branch}-${revision}, ${uiLabelMap.CommonBuiltOn} ${dateTime}" file="runtime/gitinfo.ftl"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-gitinfo" />
<echo message="Done!"/>
</target>
<target name="clean-gitinfo">
<echo message="Resetting gitinfo..."/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-clean-gitinfo" />
<echo message=" " file="runtime/gitinfo.ftl"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-clean-gitinfo" />
<echo message="Done!"/>
</target>
<!-- ================================================================== -->
<!-- Apply patches where needed -->
<!-- ================================================================== -->
<target name="build-dev"
description="Patch sources in a dev environment if patch files are present in runtime/patches.">
<!-- SCIPIO: hooks -->
<invokehook target="pre-build-dev" />
<!-- Ant patch task can't handle a fileset => create a global patch -->
<concat destfile="${basedir}/runtime/patches/dev.patch" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="${basedir}/runtime/patches" casesensitive="no">
<exclude name="dev.patch"/> <!-- exclude the patch itself in case it's still there -->
<include name="*.patch"/>
</fileset>
</concat>
<if>
<available file="${basedir}/runtime/patches/dev.patch"/>
<then>
<antcall target="patch">
<param name="dir-name" value="${basedir}"/>
<param name="diff-file" value="${basedir}/runtime/patches/dev.patch"/>
</antcall>
<delete file="${basedir}/runtime/patches/dev.patch"/>
</then>
</if>
<!-- SCIPIO: hooks -->
<invokehook target="post-build-dev" />
</target>
<!-- Following allow to use "svn patch" and fallback on "patch" if necessary -->
<target name="calculate-svn-patch-available">
<mkdir dir="build/svn-check"/>
<exec dir="build/svn-check" output="build/svn-check/svn.output" executable="svn" failonerror="true">
<arg value="--version" />
</exec>
<loadfile property="svn-output" srcFile="build/svn-check/svn.output"/>
<condition property="svn-version-ok">
<!-- On Linux prefer patch because "svn patch" needs "ant exec and you can't check patching errors -->
<and>
<os family="windows"/>
<or>
<!-- This might also depend on the format of the working copy -->
<contains string="${svn-output}" substring="1.7."/>
<contains string="${svn-output}" substring="1.8."/>
<contains string="${svn-output}" substring="1.9."/>
<contains string="${svn-output}" substring="1.10."/>
<contains string="${svn-output}" substring="1.11."/>
</or>
</and>
</condition>
<delete dir="build/svn-check"/>
</target>
<target name="calculate-patch-available" depends="calculate-svn-patch-available" unless="svn-version-ok">
<condition property="patch-ok">
<os family="unix"/>
</condition>
</target>
<target name="check-svn-patch-available" depends="calculate-svn-patch-available" unless="svn-version-ok">
<echo message="You need svn version 1.7 or higher - attempting patch instead."/>
</target>
<target name="check-patch-available" depends="calculate-patch-available" unless="patch-ok"/>
<target name="patch-via-svn" depends="check-svn-patch-available" if="svn-version-ok">
<exec dir="${basedir}" executable="svn" failonerror="true">
<arg value="patch" />
<arg value="${diff-file}" />
<arg value="${dir-name}" />
</exec>
</target>
<target name="patch-via-patch" depends="check-patch-available" if="patch-ok">
<exec dir="${basedir}" executable="patch" input="${diff-file}" failonerror="true">
<arg value="--binary" /><!-- To prevent EOL issues which comes when using mixed development platforms (ie Unix and Win) -->
<arg value="-p0" />
</exec>
</target>
<target name="patch" depends="patch-via-svn,patch-via-patch"/>
<target name="revert-dev"
description="Revert patch files present in runtime/patches applied by build-dev.">
<!-- SCIPIO: hooks -->
<invokehook target="pre-revert-dev" />
<!-- Ant patch task can't handle a fileset => create a global patch -->
<concat destfile="${basedir}/runtime/patches/dev.patch" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="${basedir}/runtime/patches" casesensitive="no">
<exclude name="dev.patch"/> <!-- exclude the patch itself in case it's still there -->
<include name="*.patch"/>
</fileset>
</concat>
<if>
<available file="${basedir}/runtime/patches/dev.patch"/>
<then>
<antcall target="revert-patch">
<param name="dir-name" value="${basedir}"/>
<param name="diff-file" value="${basedir}/runtime/patches/dev.patch"/>
</antcall>
<delete file="${basedir}/runtime/patches/dev.patch"/>
</then>
</if>
<!-- SCIPIO: hooks -->
<invokehook target="post-revert-dev" />
</target>
<target name="revert-via-svn" depends="check-svn-patch-available" if="svn-version-ok">
<exec dir="${basedir}" executable="svn" failonerror="true">
<arg value="patch" />
<arg value="${diff-file}" />
<arg value="${dir-name}" />
<arg value="--reverse-diff" />
</exec>
</target>
<target name="revert-via-patch" depends="check-patch-available" if="patch-ok">
<exec dir="${basedir}" executable="patch" input="${diff-file}" failonerror="true">
<arg value="--binary" /><!-- To prevent EOL issues which comes when using mixed development platforms (ie Unix and Win) -->
<arg value="-p0" />
<arg value="-R" />
</exec>
</target>
<target name="revert-patch" depends="revert-via-svn,revert-via-patch"/>
<target name="build-test"
description="Patch and build all sources for use in a test environment. On Windows you need to have patch.exe in the path and patch files must all be in dos format (CR+LF)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-build-test" />
<subant inheritall="false" target="prepare-to-build-test" failonerror="true">
<propertyset refid="ofbiz.subbuild.props.pass"/><!-- SCIPIO: new 2017-02-01 -->
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<exclude name="disabled/**"/>
<include name="*/build.xml"/>
</fileset>
</subant>
<!--antcall target="build"/--><!-- you can chain if you don't use build-dev see MVP-256-->
<!-- SCIPIO: hooks -->
<invokehook target="post-build-test" />
</target>
<target name="build-qa"
description="Patch and build all sources for use in a qa environment. On Windows you need to have patch.exe in the path and patch files must all be in dos format (CR+LF)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-build-qa" />
<subant inheritall="false" target="prepare-to-build-qa" failonerror="true">
<propertyset refid="ofbiz.subbuild.props.pass"/><!-- SCIPIO: new 2017-02-01 -->
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<exclude name="disabled/**"/>
<include name="*/build.xml"/>
</fileset>
</subant>
<!--antcall target="build"/--><!-- you can chain if you don't use build-dev see MVP-256-->
<!-- SCIPIO: hooks -->
<invokehook target="post-build-qa" />
</target>
<target name="build-production"
description="Patch and build all sources for use in a live environment. On Windows you need to have patch.exe in the path and patch files must all be in dos format (CR+LF)">
<!-- SCIPIO: hooks -->
<invokehook target="pre-build-production" />
<subant inheritall="false" target="prepare-to-build-production" failonerror="true">
<propertyset refid="ofbiz.subbuild.props.pass"/><!-- SCIPIO: new 2017-02-01 -->
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<exclude name="disabled/**"/>
<include name="*/build.xml"/>
</fileset>
</subant>
<!--antcall target="build"/--><!-- you can chain if you don't use build-dev see MVP-256-->
<!-- SCIPIO: hooks -->
<invokehook target="post-build-production" />
</target>
<!-- SCIPIO: new 2018-03-23 -->
<target name="build-withlibsrc" description="build plus download ivy lib JAR sources (implied -Dlib.update.sources=true)">
<property name="build.lib.update.sources" value="true"/>
<antcall target="build"/>
</target>
<!-- ================================================================== -->
<!-- Build Components -->
<!-- ================================================================== -->
<target name="build" depends="ofbiz-init,check-build-requisites,build-scipio-build-tools,check-lib-update">
<!-- SCIPIO: 2018-11-14: Can bypass actual build using flag: -Dscipio.target.build=false
FIXME?: using big if here is ugly -->
<if>
<equals arg1="${scipio.target.build}" arg2="false"/>
<then>
<echo message="[build] (bypassed)"/>
</then>
<else>
<echo message="[build] ========== Start Building (Compile) =========="/>
<!-- SCIPIO: special property to only target build command with lib.update.sources -->
<property name="lib.update.sources" value="${build.lib.update.sources}" if:set="build.lib.update.sources"/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-build" />
<antcall target="build-dev"/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-build-framework" />
<antcall target="build-framework"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-build-framework" />
<!-- SCIPIO: 2017-01-17: support dependency resolution for themes as well
<externalsubant>
<fileset dir="${basedir}/themes">
<include name="*/build.xml" />
</fileset>
</externalsubant>-->
<!-- SCIPIO: 2017-01-31: rectified build order, framework->themes->..., to match component load order -->
<dep-subant dir="${basedir}/themes"/>
<antcall target="build-applications"/>
<antcall target="build-specialpurpose"/>
<!-- SCIPIO: addons dir -->
<addonsant/>
<hotdeployant/>
<antcall target="clean-svninfo"/>
<antcall target="clean-gitinfo"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-build" />
<echo message="[build] ========== Done Building (Compile) =========="/>
</else>
</if>
</target>
<target name="build-framework">
<iterate target="jar" filelist="framework-builds"/>
</target>
<target name="build-applications" if="${applications.present}">
<iterate target="jar" filelist="application-builds"/>
</target>
<target name="build-specialpurpose" if="${specialpurpose.present}">
<iterate target="jar" filelist="specialpurpose-builds"/>
</target>
<macrodef name="hotdeployant">
<attribute name="target" default=""/>
<sequential>
<!-- a check is done, if no build.xml file is present in hot-deploy dir,
then the build.xml files - if present - in hot-deploy sub-dirs will be used.
So the previous, simpler, behaviour is kept as long as you don't need
to build hot-deploy components in a specific order. -->
<if>
<available file="hot-deploy/build.xml" property="useHotDeployBuild"/>
<then>
<externalsubant target="@{target}">
<filelist dir="." files="hot-deploy/build.xml"/>
</externalsubant>
</then>
<else>
<dep-subant dir="${basedir}/hot-deploy" target="@{target}" />
</else>
</if>
</sequential>
</macrodef>
<!-- ================================================================== -->
<!-- Build JavaDocs -->
<!-- ================================================================== -->
<target name="docs" depends="ofbiz-init,check-build-requisites">
<echo message="[docs] ========== Start Building (JavaDoc) =========="/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-docs" />
<antcall target="docs-framework"/>
<antcall target="docs-applications"/>
<antcall target="docs-specialpurpose"/>
<!-- SCIPIO: addons dir -->
<addonsant target="docs"/>
<hotdeployant target="docs"/>
<!-- SCIPIO: hooks -->
<invokehook target="post-docs" />
<echo message="[docs] ========== Done Building (JavaDocs) =========="/>
</target>
<target name="docs-framework">
<iterate target="docs" filelist="framework-builds"/>
</target>
<target name="docs-applications" if="${applications.present}">
<iterate target="docs" filelist="application-builds"/>
</target>
<target name="docs-specialpurpose" if="${specialpurpose.present}">
<iterate target="docs" filelist="specialpurpose-builds"/>
</target>
<target name="docs-all" depends="build,ofbiz-init"
description="For committers : Build all javadoc into one tree for easier viewing by the community">
<echo message="[docs-all] ========== Start Building (JavaDoc) =========="/>
<!-- SCIPIO: hooks -->
<invokehook target="pre-docs-all" />
<mkdir dir="${site.dir}/javadocs"/>
<path id="local.class.path">
<fileset dir="${ofbiz.home.dir}/framework/base/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/catalina/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/service/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/testtools/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/webapp/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/webapp/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/birt/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/ebaystore/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/googlecheckout/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/ldap/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/pos/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/specialpurpose/jetty/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/content/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/applications/product/lib" includes="*.jar"/>
</path>
<property name="desc" value="API"/>
<property name="build.dir" value="${site.dir}"/>
<default-javadoc/>
<!-- SCIPIO: hooks -->
<invokehook target="post-docs-all" />
<echo message="[docs-all] ========== Done Building (JavaDocs) =========="/>
</target>
<!-- SCIPIO: Main FTL lib doc build. Currently requires a "build" on the main project to compile the compiler.
NOTE: 2016-10-27: The output of this is no longer committed to repo. -->
<target name="docs-ftl-scipio" depends="build">
<antcall target="docs-ftl-scipio-ftlonly"/>
</target>
<!-- SCIPIO: FIXME?: This is currently standard-Scipio-specific and quite hardcoded. May even belong in a separate project.
Or could also integrate this better with other "docs" builds in future (delegate to component build.xml).
NOTE: 2016-10-27: The output of this is no longer committed to repo. -->
<target name="docs-ftl-scipio-ftlonly">
<echo message="[docs-ftl-scipio] ========== Start Building (FTL docs) =========="/>
<echo message="[docs-ftl-scipio] Building Scipio template-writer-friendly FTL lib docs..."/>
<java classname="com.ilscipio.scipio.ce.webapp.ftl.doc.FtlDocCompiler" fork="true">
<arg value="scipio-lib"/> <!-- lib format -->
<arg value="templating"/> <!-- doc purpose -->
<arg value="framework/common/webcommon/includes/scipio/lib"/> <!-- base source folder -->
<arg value="doc/scipio/templating/ftl/lib"/> <!-- base output folder -->
<arg value=".html"/> <!-- output file extension -->
<arg value="framework/common/webcommon/includes/scipio/doc/ftlDocTemplate.ftl"/> <!-- doc template -->
<!-- source files to process -->
<arg value="utilities.ftl"/>
<arg value="standard/htmlContent.ftl"/>
<arg value="standard/htmlForm.ftl"/>
<arg value="standard/htmlInfo.ftl"/>
<arg value="standard/htmlNav.ftl"/>
<arg value="standard/htmlScript.ftl"/>
<arg value="standard/htmlStructure.ftl"/>
<arg value="standard/htmlTemplate.ftl"/>
<classpath>
<path location="framework/webapp/build/lib/ofbiz-webapp.jar"/> <!-- the compiler class currently lives in here -->
<path location="framework/base/lib/*"/> <!-- includes Freemarker (and some others: log4j) -->
</classpath>
</java>
<!-- TODO?: same as above but for docPurpose "theming"... currently I don't see the need,
theme creators need to look at the FTL files in depth anyway, even with markup separation -->
<echo message="[docs-ftl-scipio] ========== Done Building (FTL docs) =========="/>
</target>
<!-- SCIPIO: Website FTL lib doc build. Currently requires a "build" on the main project to compile the compiler. -->
<target name="docs-ftl-scipio-website" depends="build">
<antcall target="docs-ftl-scipio-website-ftlonly"/>
</target>
<target name="docs-ftl-scipio-website-ftlonly">
<echo message="[docs-ftl-scipio-website] ========== Start Building (FTL docs) =========="/>
<echo message="[docs-ftl-scipio-website] Building Scipio template-writer-friendly FTL lib docs..."/>
<java classname="com.ilscipio.scipio.ce.webapp.ftl.doc.FtlDocCompiler" fork="true">
<arg value="scipio-lib"/> <!-- lib format -->
<arg value="templating"/> <!-- doc purpose -->
<arg value="framework/common/webcommon/includes/scipio/lib"/> <!-- base source folder -->
<arg value="doc/scipio-website/templating/ftl/lib"/> <!-- base output folder -->
<arg value="_NONE_"/> <!-- output file extension -->
<arg value="framework/common/webcommon/includes/scipio/doc/ftlDocTemplateWebsite.ftl"/> <!-- doc template -->
<!-- source files to process -->
<arg value="utilities.ftl"/>
<arg value="standard/htmlContent.ftl"/>
<arg value="standard/htmlForm.ftl"/>
<arg value="standard/htmlInfo.ftl"/>
<arg value="standard/htmlNav.ftl"/>
<arg value="standard/htmlScript.ftl"/>
<arg value="standard/htmlStructure.ftl"/>
<arg value="standard/htmlTemplate.ftl"/>