-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.xml
1006 lines (907 loc) · 46.7 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"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project name="OFBiz Main Build" default="build" basedir=".">
<import file="macros.xml"/>
<property file="build.properties" />
<property name="site.dir" value="../site"/>
<available file="applications/build.xml" property="applications.present"/>
<available file="specialpurpose/build.xml" property="specialpurpose.present"/>
<!-- ================================================================== -->
<!-- Initialization of all property settings -->
<!-- ================================================================== -->
<target name="ofbiz-init">
<property environment="env"/>
</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="refresh-server">
<antcall target="clean"/>
<antcall target="server"/>
</target>
<target name="clean-all"
description="Clean all DB, Catalina and caches data, logs, and runtime subdirectories and all specific files like .rej, .orig">
<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-gwt"/>
<antcall target="clean-indexes"/>
<antcall target="clean"/>
</target>
<target name="clean-data"
description="Clean all DB data (Derby and HSQL) under runtime/data">
<subant target="clean-data">
<filelist dir="." files="framework/build.xml"/>
</subant>
<delete file="runtime/data.zip"/>
<delete file="runtime/test-list-build.xml"/>
</target>
<target name="clean-logs"
description="Clean all logs in runtime/logs">
<subant target="clean-logs">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-output"
description="Clean runtime/output directory">
<subant target="clean-output">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-xtra"
description="Clean all other files like .rej, .orig, etc.">
<delete verbose="on">
<fileset dir="." includes="**/.nbattrs,**/*~,**/.#*,**/.DS_Store,**/*.rej,**/*.orig"/>
</delete>
</target>
<target name="clean-catalina"
description="Clean Catalina data in runtime/catalina/work">
<subant target="clean-catalina">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean-indexes" description="Remove indexes for full text search">
<delete verbose="on" dir="runtime/lucene"/>
</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')">
<property file="framework/base/config/cache.properties"/>
<echo message="NOTICE: deleting ${cache.file.store}.db"/>
<delete file="${cache.file.store}.db" verbose="true"/>
</target>
<target name="clean-tempfiles"
description="Remove files located in runtime/tempfiles (captcha, etc...)">
<subant target="clean-tempfiles">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="download-selenium"
description="Download the selenium files">
<subant target="install-seleniumxml">
<filelist dir="." files="framework/testtools/build.xml"/>
</subant>
</target>
<target name="download-PG-JDBC"
description="Download the PostgreSQL JDBC driver file">
<subant target="install-PG-JDBC">
<filelist dir="." files="framework/entity/build.xml"/>
</subant>
</target>
<target name="tests" depends="ofbiz-init">
<subant target="tests">
<filelist dir="." files="framework/build.xml"/>
</subant>
</target>
<target name="clean">
<subant target="clean">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<include name="*/build.xml"/>
</fileset>
</subant>
<subant target="clean">
<filelist dir="." files="opentaps/build.xml"/>
</subant>
<subant target="clean" failonerror="${specialpurpose.present}" description="Use failonerror=false in case the specialpurpose directory is not there">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant target="clean" failonerror="${applications.present}"
description="Use failonerror=false in case the applications directory is not there">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant target="clean">
<filelist dir="." files="framework/build.xml"/>
</subant>
<delete file="ofbiz.jar"/>
<echo message="[clean] ========== Done Cleaning =========="/>
</target>
<target name="refresh-gwt">
<antcall target="clean-gwt"/>
<antcall target="gwt"/>
</target>
<target name="clean-gwt" depends="">
<subant inheritall="false" target="clean-gwt">
<filelist dir="." files="opentaps/build.xml"/>
</subant>
</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 OFBiz repository for that ">
<echo message="Creating 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}"/>
<echo message=" - Release-revision : ${releasePath}-${info.entry.commit(revision)}" file="runtime/svninfo.ftl"/>
<delete file="runtime/svninfo_tmp.xml"/>
<echo message="Done!"/>
</target>
<target name="clean-svninfo">
<echo message="Resetting svninfo..."/>
<echo message=" " file="runtime/svninfo.ftl"/>
<echo message="Done!"/>
</target>
<!-- ================================================================== -->
<!-- Build GWT Modules -->
<!-- ================================================================== -->
<target name="gwt" depends="gwt-code"/>
<target name="gwt-code">
<subant target="gwt-code">
<filelist dir="." files="opentaps-build.xml"/>
</subant>
</target>
<target name="gwt-labels" depends="prebuild">
<subant target="gwt-labels">
<filelist dir="." files="opentaps-build.xml"/>
</subant>
</target>
<!-- ================================================================== -->
<!-- Build Components -->
<!-- ================================================================== -->
<target name="prebuild">
<subant inheritall="false">
<filelist dir="." files="framework/build.xml"/>
</subant>
<subant inheritall="false">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant inheritall="false">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant target="prebuild">
<filelist dir="." files="opentaps/opentaps-common/build.xml"/>
</subant>
</target>
<target name="server" depends="ofbiz-init">
<echo message="[build] ========== Start Building (Compile) =========="/>
<subant inheritall="false">
<filelist dir="." files="framework/build.xml"/>
</subant>
<subant inheritall="false" failonerror="${applications.present}">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant inheritall="false" failonerror="${specialpurpose.present}">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant inheritall="false">
<filelist dir="." files="opentaps/build.xml"/>
</subant>
<subant inheritall="false" failonerror="true">
<filelist dir="." files="opentaps/opentaps-common/build-aspects.xml"/>
</subant>
<subant inheritall="false" failonerror="true">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<include name="*/build.xml"/>
</fileset>
</subant>
<antcall target="clean-svninfo"></antcall>
<echo message="[build] ========== Done Building (Compile) =========="/>
</target>
<target name="build" depends="server, gwt" />
<!-- ================================================================== -->
<!-- Build JavaDocs -->
<!-- ================================================================== -->
<target name="docs" depends="ofbiz-init">
<echo message="[docs] ========== Start Building (JavaDoc) =========="/>
<subant target="docs">
<filelist dir="." files="framework/build.xml"/>
</subant>
<subant target="docs" failonerror="${applications.present}">
<filelist dir="." files="applications/build.xml"/>
</subant>
<subant target="docs" failonerror="${specialpurpose.present}">
<filelist dir="." files="specialpurpose/build.xml"/>
</subant>
<subant target="docs">
<fileset dir="${basedir}/opentaps" casesensitive="no">
<include name="**/build.xml"/>
</fileset>
</subant>
<subant target="docs">
<fileset dir="${basedir}/hot-deploy" casesensitive="no">
<include name="*/build.xml"/>
</fileset>
</subant>
<echo message="[docs] ========== Done Building (JavaDocs) =========="/>
</target>
<target name="docs-all" depends="build,ofbiz-init"
description="For committers : Build all javadoc into one tree for easier viewing by the community">
</target>
<target name="docs-framework" depends="build"
description="Build ofbiz framework javadoc into two trees for easier viewing by the community">
<echo message="[docs-split] ========== Start Building Framework JavaDoc =========="/>
<mkdir dir="${site.dir}/javadocs/framework"/>
<default-javadoc packagenames="org.ofbiz.*"
destdir="${site.dir}/javadocs"
maxmemory="256M"
windowtitle="Open for Business - API"
useexternalfile="yes">
<fileset dir="${basedir}" defaultexcludes="yes">
<include name="**/*.java"/>
<exclude name="**/ControlApplet.java"/>
<exclude name="**/ShipmentScaleApplet.java"/>
<exclude name="**/test/"/>
</fileset>
</default-javadoc>
<echo message="[docs-all] ========== Done Building (JavaDocs) =========="/>
</target>
<target name="docs-applications" depends="build"
description="Build ofbiz applications javadoc into two trees for easier viewing by the community">
<echo message="[docs-split] ========== Start Building Applications JavaDoc =========="/>
<mkdir dir="${site.dir}/javadocs/applications"/>
<javadoc packagenames="org.ofbiz.*"
destdir="${site.dir}/javadocs/applications"
maxmemory="${javadoc.maxmemory}"
windowtitle="Opentaps - Ofbiz Applications - API"
useexternalfile="yes">
<fileset dir="${basedir}" defaultexcludes="yes">
<include name="applications/**/*.java"/>
<include name="specialpurpose/**/*.java"/>
<exclude name="**/ControlApplet.java"/>
<exclude name="**/ShipmentScaleApplet.java"/>
<exclude name="**/test/"/>
</fileset>
</javadoc>
</target>
<target name="docs-hotdeploy" depends="build"
description="Build hot-deploy components javadoc into a separate for easier viewing by the community">
<echo message="[docs-split] ========== Start Building Hot-Deploy JavaDoc =========="/>
<mkdir dir="${site.dir}/javadocs/hotdeploy"/>
<javadoc packagenames="org.ofbiz.*"
destdir="${site.dir}/javadocs/hotdeploy"
maxmemory="${javadoc.maxmemory}"
windowtitle="Opentaps - Ofbiz Hot-Deploy - API"
useexternalfile="yes">
<fileset dir="${basedir}/hot-deploy" defaultexcludes="yes">
<include name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target name="docs-opentaps" depends="build"
description="Build opentaps javadoc into two trees for easier viewing by the community">
<echo message="[docs-split] ========== Start Building Opentaps JavaDoc =========="/>
<mkdir dir="${site.dir}/javadocs/opentaps"/>
<path id="opentaps.class.path">
<fileset dir="opentaps/opentaps-common/lib/" includes="*.jar"/>
<fileset dir="opentaps/opentaps-common/lib/hibernate" includes="*.jar"/>
<fileset dir="opentaps/opentaps-common/lib/aspectwerkz" includes="*.jar"/>
<fileset dir="framework/base/lib" includes="*.jar"/>
<fileset dir="framework/base/lib/commons" includes="*.jar"/>
<fileset dir="framework/base/lib/scripting" includes="*.jar"/>
<fileset dir="framework/base/lib/j2eespecs" includes="*.jar"/>
<fileset dir="framework/base/lib/etl" includes="*.jar"/>
<fileset dir="framework/base/build/lib" includes="*.jar"/>
<fileset dir="framework/entity/lib" includes="*.jar"/>
<fileset dir="framework/entity/build/lib" includes="*.jar"/>
<fileset dir="framework/datafile/build/lib" includes="*.jar"/>
<fileset dir="framework/security/build/lib" includes="*.jar"/>
<fileset dir="framework/service/lib" includes="*.jar"/>
<fileset dir="framework/service/build/lib" includes="*.jar"/>
<fileset dir="framework/minilang/build/lib" includes="*.jar"/>
<fileset dir="framework/webapp/lib" includes="*.jar"/>
<fileset dir="framework/webapp/build/lib" includes="*.jar"/>
<fileset dir="framework/common/build/lib" includes="*.jar"/>
<fileset dir="framework/widget/build/lib" includes="*.jar"/>
<fileset dir="applications/accounting/build/lib" includes="*.jar"/>
<fileset dir="applications/order/build/lib" includes="*.jar"/>
<fileset dir="applications/content/build/lib" includes="*.jar"/>
<fileset dir="applications/party/build/lib" includes="*.jar"/>
<fileset dir="applications/product/build/lib" includes="*.jar"/>
<fileset dir="applications/manufacturing/build/lib" includes="*.jar"/>
</path>
<javadoc packagenames="*"
destdir="${site.dir}/javadocs/opentaps"
maxmemory="${javadoc.maxmemory}"
windowtitle="Opentaps - API"
useexternalfile="yes"
classpathref="opentaps.class.path">
<fileset dir="${basedir}/opentaps" defaultexcludes="yes">
<include name="**/*.java"/>
<exclude name="**/test/"/>
<exclude name="**/org/opentaps/base/entities/"/>
<exclude name="**/org/opentaps/base/services/"/>
</fileset>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- Contrib Targets -->
<!-- ================================================================== -->
<target name="copy-contrib">
<copy todir="${basedir}" overwrite="true" verbose="true">
<fileset dir="${basedir}/contrib" excludes="contrib/**,**/*.class"/>
</copy>
</target>
<target name="build-contrib" depends="copy-contrib,refresh"/>
<!-- ================================================================== -->
<!-- WebSite Targets -->
<!-- ================================================================== -->
<target name="build-website"
description="For committers : Update dtds and JavaDoc from OFBiz intance to site">
<antcall target="copy-dtds"/>
<antcall target="docs"/>
<antcall target="copy-apis"/>
</target>
<target name="copy-apis">
<mkdir dir="${site.dir}/api"/>
<mkdir dir="${site.dir}/api/framework"/>
<mkdir dir="${site.dir}/api/applications"/>
<mkdir dir="${site.dir}/api/specialpurpose"/>
<copy todir="${site.dir}/api/framework">
<fileset dir="${basedir}/framework" includes="*/build/javadocs/**"/>
</copy>
<copy todir="${site.dir}/api/applications">
<fileset dir="${basedir}/applications" includes="*/build/javadocs/**"/>
</copy>
<copy todir="${site.dir}/api/specialpurpose">
<fileset dir="${basedir}/specialpurpose" includes="*/build/javadocs/**"/>
</copy>
</target>
<target name="copy-dtds"
description="For committers : Copy all dtds from OFBiz instance to website">
<mkdir dir="${site.dir}/dtds"/>
<copy todir="${site.dir}/dtds" flatten="true" overwrite="true">
<fileset dir="${basedir}" includes="**/*.dtd"/>
<fileset dir="${basedir}" defaultexcludes="yes"> <!-- all but oagis and external in general -->
<include name="**/*.xsd"/>
<exclude name="**/002*.xsd"/>
<exclude name="**/068*.xsd"/>
<exclude name="**/161*.xsd"/>
<exclude name="**/196*.xsd"/>
<exclude name="**/197*.xsd"/>
</fileset>
</copy>
</target>
<!-- ================================================================== -->
<!-- Script Targets -->
<!-- ================================================================== -->
<target name="scriptfix">
<fixcrlf srcdir="${basedir}" eol="lf" eof="remove" includes="**/*.sh"/>
<fixcrlf srcdir="${basedir}" eol="crlf" includes="**/*.bat"/>
</target>
<!-- ================================================================== -->
<!-- Start OFBiz -->
<!-- ================================================================== -->
<target name="run"
description="This will start OFBiz">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
</java>
</target>
<target name="run-pos"
description="Start the POS (Point of sale) system">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${pos.memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="pos"/>
</java>
</target>
<target name="run-pos-debug" >
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091"/>
<arg value="pos"/>
</java>
</target>
<target name="run-install" depends="refresh-hibernatecfg,server"
description="This loads all configured data; meant for generic OFBiz development, testing, demonstration, etc purposes">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${memory.maxpermsize.param}"/>
<arg value="install"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-multitenant" depends="build"
description="This loads all data needed for the multi-tenancy demonstration. Caution: this creates three databases, with each one loaded with all demo data.">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${memory.maxpermsize.param}"/>
<arg value="install"/>
</java>
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${memory.maxpermsize.param}"/>
<arg value="install"/>
<arg value="delegator=default#DEMO1"/>
</java>
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${memory.maxpermsize.param}"/>
<arg value="install"/>
<arg value="delegator=default#DEMO2"/>
</java>
</target>
<target name="run-install-noext" depends="refresh-hibernatecfg,server"
description="This loads all configured data but does not load the ext files in opentaps/mycompany ">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed,seed-initial,demo"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-seed" depends="refresh-hibernatecfg,server"
description="This loads ONLY the seed data (not seed-initial, demo, ext* or anything else); meant for use after an update of the code to reload the seed data as it is generally maintained along with the code and needs to be in sync for operation">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-extseed" depends="refresh-hibernatecfg,server"
description="This loads seed, seed-initial and ext data; meant for manual/generic testing, development, or going into production with a derived system based on stock OFBiz where the ext data basically replaces the demo data">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed,seed-initial,ext"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-exttest" depends="refresh-hibernatecfg,server"
description="This loads seed, seed-initial, ext and ext-test data; meant for automated testing with a derived system based on stock OFBiz">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="readers=seed,seed-initial,ext,ext-test"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-readers" depends="refresh-hibernatecfg,server"
description="This loads data using the command line argument 'data-readers' that takes a comma separated list of readers (seed, seed-initial, demo, ext, ext-test, ext-demo)">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="readers=${data-readers}"/>
<arg value="failonerror"/>
</java>
</target>
<target name="run-install-file" depends="refresh-hibernatecfg,server"
description="This loads data using the command line argument 'file' to load data from a given file">
<java jar="ofbiz.jar" fork="true" failonerror="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="install"/>
<arg value="delegator=default"/>
<arg value="file=${data-file}"/>
<arg value="failonerror"/>
</java>
</target>
<target name="load-admin-user-login"
description="Creates a user login with admin privileges and a temporary password equal to 'ofbiz'; after a succesful login the user will be prompted for a new password. Example command for the userLogin 'admin': ./ant load-admin-user-login -DuserLoginId=admin">
<fail message="userLoginId parameter is required. To add the parameter to the command for user admin: -DuserLoginId=admin">
<condition>
<not><isset property="userLoginId"/></not>
</condition>
</fail>
<copy file="${basedir}/framework/resources/templates/AdminUserLoginData.xml" tofile="runtime/tmp/tmpUserLogin.xml">
<filterset>
<filter token="userLoginId" value="${userLoginId}"/>
</filterset>
</copy>
<antcall target="run-install-file">
<param name="data-file" value="runtime/tmp/tmpUserLogin.xml"/>
</antcall>
<delete file="runtime/tmp/tmpUserLogin.xml"/>
</target>
<target name="create-admin-user-login"
description="Prompts for a user name, then creates a user login with admin privileges and a temporary password equal to 'ofbiz'. After a succesful login the user will be prompted for a new password.">
<input addproperty="userLoginId" message="Enter user name (log in with the temporary password 'ofbiz'):"/>
<antcall target="load-admin-user-login"/>
</target>
<target name="run-debug" depends="build"
description="Starts OFBiz in debugging mode">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8091"/>
</java>
</target>
<target name="run-tests" depends="server"
description="Run OFBiz default tests, execute ant run-install before and see results in runtime/logs/test-results/html/all-tests.html">
<java jar="ofbiz.jar" fork="true" resultproperty="test.result">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="test"/>
</java>
<mkdir dir="runtime/logs/test-results/html"/>
<junitreport todir="runtime/logs/test-results">
<fileset dir="runtime/logs/test-results/">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="runtime/logs/test-results/html"/>
</junitreport>
<fail message="Test run was unsuccessful">
<condition>
<not>
<equals arg1="${test.result}" arg2="0"/>
</not>
</condition>
</fail>
</target>
<target name="test-html-report">
<junitreport todir="./runtime/logs">
<fileset dir="./runtime/logs/test-results/">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="./runtime/tests"/>
</junitreport>
</target>
<target name="_check-separated-tests-already-setup">
<available file="runtime/test-list-build.xml" property="_separated-tests-already-setup"/>
</target>
<target name="_setup-separated-test-run" depends="_check-separated-tests-already-setup" unless="_separated-tests-already-setup">
<java jar="ofbiz.jar" fork="true">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="testlist"/>
<arg file="runtime/test-list-build.xml"/>
<arg value="-ant"/>
</java>
</target>
<target name="run-single-test" depends="build"
description="Run a single test, eg: ant run-single-test -Dtest.component=opentaps-tests -Dtest.case=financials-tests">
<java jar="ofbiz.jar" fork="true" resultproperty="test.result">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="test"/>
<arg value="-component=${test.component}"/>
<arg value="-case=${test.case}"/>
</java>
<delete dir="runtime/logs/test-results/${test.component}-${test.case}"/>
<mkdir dir="runtime/logs/test-results/${test.component}-${test.case}"/>
<move todir="runtime/logs/test-results/${test.component}-${test.case}">
<fileset dir="runtime/logs/test-results" includes="*.xml"/>
</move>
<fail message="Test run was unsuccessful">
<condition>
<not>
<equals arg1="${test.result}" arg2="0"/>
</not>
</condition>
</fail>
</target>
<target name="run-single-test-suite" depends="build"
description="Run a single test suite, eg: ant run-single-test-suite -Dtest.component=accounting -Dtest.suiteName=accountingtests">
<java jar="ofbiz.jar" fork="true" resultproperty="test.result">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
<jvmarg value="${permmemory.max.param}"/>
<arg value="test"/>
<arg value="-component=${test.component}"/>
<arg value="-suitename=${test.suiteName}"/>
</java>
<fail message="Test run was unsuccessful">
<condition>
<not>
<equals arg1="${test.result}" arg2="0"/>
</not>
</condition>
</fail>
</target>
<target name="run-test-list" depends="_setup-separated-test-run"
description="Run all configured tests, stopping/starting ofbiz between each test">
<delete dir="runtime/logs/test-results"/>
<ant antfile="runtime/test-list-build.xml" target="all-tests"/>
</target>
<target name="cobertura-report">
<delete dir="runtime/logs/cobertura-report"/>
<mkdir dir="runtime/logs/cobertura-report"/>
<taskdef resource="tasks.properties">
<classpath>
<fileset dir="framework/base/lib">
<include name="cobertura-1.9.3.jar" />
<include name="log4j-1.2.15.jar" />
<include name="scripting/asm*.jar" />
</fileset>
</classpath>
</taskdef>
<cobertura-report datafile="runtime/logs/cobertura.dat" destdir="runtime/logs/cobertura-report">
<dirset dir=".">
<include name="*/*/src"/>
</dirset>
<include name="**/*.java"/>
</cobertura-report>
</target>
<!-- ================================================================== -->
<!-- Create New Component. This target will create basic directory structure for an OFBiz component in hot-deploy directory. -->
<!-- ================================================================== -->
<target name="create-component"
description="Creates the layout of an OFBiz component in the hot-deploy folder.">
<input addproperty="component-name" message="Component name: (e.g. mycomponent) [Mandatory]"/>
<input addproperty="component-resource-name" message="Component resource name: (e.g. MyComponent) [Mandatory]"/>
<input addproperty="webapp-name" message="Webapp name: (e.g. mycomponent) [Mandatory]"/>
<input addproperty="base-permission" message="Base permission: (e.g. MYCOMPONENT) [Mandatory]"/>
<echo>The following hot-deploy component will be created:
Name: ${component-name}
Resource Name: ${component-resource-name}
Webapp Name: ${webapp-name}
Base permission: ${base-permission}
Folder: ${basedir}/hot-deploy/${component-name}
</echo>
<input addproperty="confirm-component-creation" message="Confirm: " defaultvalue="N" validargs="Y,N,y,n"/>
<fail message="Component creation cancelled by the user.">
<condition>
<equals arg1="${confirm-component-creation}" arg2="N" casesensitive="false"/>
</condition>
</fail>
<fail message="Component name is mandatory">
<condition>
<equals arg1="${component-name}" arg2="" casesensitive="false" trim="yes"/>
</condition>
</fail>
<fail message="Resource name is mandatory">
<condition>
<equals arg1="${component-resource-name}" arg2="" casesensitive="false" trim="yes"/>
</condition>
</fail>
<fail message="Webapp name is mandatory">
<condition>
<equals arg1="${webapp-name}" arg2="" casesensitive="false" trim="yes"/>
</condition>
</fail>
<fail message="Base permission is mandatory">
<condition>
<equals arg1="${base-permission}" arg2="" casesensitive="false" trim="yes"/>
</condition>
</fail>
<filterset id="replacePlaceholders">
<filter token="component-name" value="${component-name}"/>
<filter token="component-resource-name" value="${component-resource-name}"/>
<filter token="base-permission" value="${base-permission}"/>
<filter token="webapp-name" value="${webapp-name}"/>
</filterset>
<mkdir dir="${basedir}/hot-deploy/${component-name}"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/config"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/data"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/dtd"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/entitydef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/lib"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/patches"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/script"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/servicedef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/src"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/testdef"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/error"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/actions"/>
<mkdir dir="${basedir}/hot-deploy/${component-name}/widget/"/>
<copy file="${basedir}/framework/resources/templates/ofbiz-component.xml" tofile="${basedir}/hot-deploy/${component-name}/ofbiz-component.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/build.xml" tofile="${basedir}/hot-deploy/${component-name}/build.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/TypeData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}TypeData.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/SecurityData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}SecurityData.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/DemoData.xml" tofile="${basedir}/hot-deploy/${component-name}/data/${component-resource-name}DemoData.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/entitymodel.xml" tofile="${basedir}/hot-deploy/${component-name}/entitydef/entitymodel.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/services.xml" tofile="${basedir}/hot-deploy/${component-name}/servicedef/services.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Tests.xml" tofile="${basedir}/hot-deploy/${component-name}/testdef/${component-resource-name}Tests.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/UiLabels.xml" tofile="${basedir}/hot-deploy/${component-name}/config/${component-resource-name}UiLabels.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/index.jsp" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/index.jsp" encoding="iso-8859-1">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/error.jsp" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/error/error.jsp" encoding="iso-8859-1">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/controller.xml" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/controller.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/web.xml" tofile="${basedir}/hot-deploy/${component-name}/webapp/${webapp-name}/WEB-INF/web.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/CommonScreens.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/CommonScreens.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Screens.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Screens.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Menus.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Menus.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<copy file="${basedir}/framework/resources/templates/Forms.xml" tofile="${basedir}/hot-deploy/${component-name}/widget/${component-resource-name}Forms.xml" encoding="utf-8">
<filterset refid="replacePlaceholders"/>
</copy>
<echo>Component successfully created in folder ${basedir}/hot-deploy/${component-name}.
Restart OFBiz and then visit the URL: http://localhost:8080/${webapp-name}
</echo>
</target>
<target name="make-constants" depends="prebuild">
<subant target="make-constants">
<filelist dir="." files="opentaps-build.xml"/>
</subant>
</target>
<target name="make-base-entities" depends="prebuild">
<subant target="make-base-entities">
<filelist dir="." files="opentaps-build.xml"/>
</subant>
</target>
<target name="refresh-hibernatecfg" depends="prebuild">
<subant target="refresh-hibernatecfg">
<filelist dir="." files="opentaps-build.xml"/>
</subant>
</target>
<!-- ================================================================== -->
<!-- Configuration deployment -->
<!-- ================================================================== -->
<!--
The name of the properties file used for token substitutions during the copy.
-->
<target name="prepare-deployconf-from">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="./opentaps/opentaps-common/lib/ant-contrib.jar"/>
</classpath>
</taskdef>
<!-- remove a trailing slash -->
<propertyregex property="deployconf.from"
input="${from}"
regexp="^(.*?)[/\\]?$"
select="\1"/>
</target>
<target name="test-deployconf-from-notempty">
<condition property="deployconf-from-notempty">
<and>
<isset property="from"/>
<not>
<equals arg1="${deployconf.from}" arg2="" trim="true"/>
</not>
</and>
</condition>
</target>
<target name="test-deployconf-from-exists">
<available property="deployconf-base-ok" file="${deployconf.from}" />
<condition property="deployconf-from-exists">
<istrue value="${deployconf-base-ok}"/>
</condition>
</target>
<!--
A basic validity test to avoid copying the wrong directory, or
copying the opentaps directory into itself.
-->
<target name="test-deployconf-from-valid">
<dirname property="deployconf-fromdir" file="${deployconf.from}"/>
<dirname property="deployconf-todir" file="${basedir}"/>
<available property="deployconf-has-framework" file="${from}/framework" />
<available property="deployconf-has-opentaps" file="${from}/opentaps" />
<available property="deployconf-has-hotdeploy" file="${from}/hot-deploy" />
<condition property="deployconf-from-valid">
<and>
<or>
<istrue value="${deployconf-has-framework}"/>
<istrue value="${deployconf-has-opentaps}"/>
<istrue value="${deployconf-has-hotdeploy}"/>
</or>
<not>
<equals arg1="${deployconf-fromdir}" arg2="${deployconf-todir}" trim="true"/>
</not>
</and>
</condition>
</target>
<target name="deployconf-exists" depends="test-deployconf-from-exists" unless="deployconf-from-exists">
<fail message="Directory ${basedir}/${deployconf.from} does not exist."/>
</target>
<target name="deployconf-valid" depends="test-deployconf-from-valid" unless="deployconf-from-valid">
<fail message="Directory ${basedir}/${deployconf.from} is not a valid source. It must contain a `framework` and/or `hot-deploy` and/or `opentaps` subdirectories."/>
</target>
<target name="deployconf-empty" depends="test-deployconf-from-notempty" unless="deployconf-from-notempty">
<fail message="No from parameter found: for example -Dfrom=<mycomponent>/base-configs/<default> and make sure it points to the directory containing the configuration files in a tree similar to the base direcotry (should have for example subdirectories framework/entity/config or hot-deploy/ or opentaps/)."/>
</target>
<target name="check-deployconf-substitution">
<available property="deployconf-has-substitutions" file="${deployconf.from}.properties" />
<condition property="deployconf.substitution.file" value="${deployconf.from}.properties">
<istrue value="${deployconf-has-substitutions}"/>
</condition>
</target>
<!-- in order, check if the from parameter was given, if it points to a valid directory, and if there is substitution properties file to be used -->
<target name="deployconf-validation" depends="prepare-deployconf-from,deployconf-empty,deployconf-exists,deployconf-valid,check-deployconf-substitution"/>
<target name="deploy-config-nosub" depends="deployconf-validation" unless="deployconf-has-substitutions">
<echo message="Deploy files from ${basedir}/${deployconf.from} without substitutions" />
<copy todir="${basedir}" overwrite="true" verbose="true">
<fileset dir="${deployconf.from}"/>
</copy>
</target>
<target name="deploy-config-sub" depends="deployconf-validation" if="deployconf-has-substitutions">
<echo message="Deploy files from ${basedir}/${deployconf.from} with substitutions" />
<copy todir="${basedir}" overwrite="true" verbose="true">
<fileset dir="${deployconf.from}"/>
<filterset>
<filtersfile file="${deployconf.substitution.file}"/>
</filterset>
</copy>
</target>