forked from bippo/openbravo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1146 lines (976 loc) · 45.2 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" ?>
<!--
*************************************************************************
* The contents of this file are subject to the Openbravo Public License
* Version 1.1 (the "License"), being the Mozilla Public License
* Version 1.1 with a permitted attribution clause; you may not use this
* file except in compliance with the License. You may obtain a copy of
* the License at http://www.openbravo.com/legal/license.html
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2001-2012 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
-->
<!--
List of targets:
init: checks if exists the JAVA_HOME var.
compile.complete: refer to compile.complete target of src.
compile: refer to compile target of src.
compile.complete.development: refer to compile.complete.development target of src.
compile.development: refer to compile.development target of src.
compile.web: refer to compile.web: target of src.
compile.web.development: refer to compile.web.development: target of src.
eclipse.compile: refer to eclipse.compile target of src.
eclipse.compile.complete: refer to eclipse.compile.complete target of src.
compile.src: refer to compile.src target of src.
war: refer to build.war target of src.
core.docs: refer to doc target of src-core.
core.lib: refer to build target of src-core.
eclipse.wad.lib: refer to sqlc target of src-wad.
wad.docs: refer to doc target of src-wad.
wad.lib: refer to build target of src-wad.
eclipse.trl.lib: refer to sqlc target of src-trl.
trl.docs: refer to doc target of src-trl.
trl.lib: refer to build target of src-trl.
database.lib: refer to jar target of src-db.
clean: refer to clean target of src.
trl.clean: refer to trl.clean target of src.
translate: refer to translate target of src.
installWebService: refer to installWebService target of src.
uninstallWebService: refer to uninstallWebService target of src.
deploy.context: deploy the context into Tomcat using the manager
install.source: install the ERP from sources (from subversion).
eclipse.install.source: install the ERP from sources for eclipse (from Mercurial).
create.database: refer to create.database target of database.
update.database: refer to update.database target of database.
create.database.script: refer to create.database.script target of database.
update.database.script: refer to update.database.script target of database.
export.database: exports database structure and data to xml files.
-->
<project name="openbravo" default="compile.complete" basedir=".">
<property environment="env" />
<property name="base.config" location="config" />
<property file="${base.config}/Openbravo.properties" />
<property file="${base.config}/checksums" />
<property name="base.config" location="config" />
<property name="base.src" location="src" />
<property name="base.src.test" location="src-test" />
<property name="base.src.core" location="src-core" />
<property name="base.src.db" location="src-db" />
<property name="base.src.trl" location="src-trl" />
<property name="base.src.wad" location="src-wad" />
<property name="base.src.gen" location="src-gen" />
<property name="base.db" location="src-db/database" />
<property name="base.web" location="web" />
<property name="base.context" location="WebContent" />
<property name="base.design" location="${base.context}/src-loc" />
<property name="base.lib" location="lib" />
<property name="base.modules" location="modules" />
<property name="build" location="build/classes" />
<property name="build.apply.module" location="build.apply/classes" />
<property name="build.AD" location="srcAD" />
<property name="build.sqlc" location="build/javasqlc" />
<property name="build.core.lib" location="src-core/lib" />
<property name="build.trl.lib" location="src-trl/lib" />
<property name="build.wad.lib" location="src-wad/lib" />
<property name="build.docs" location="docs/api" />
<property name="jakarta.home" location="${env.CATALINA_HOME}" />
<property name="module" value="%" />
<property name="apply.on.create" value="false" />
<property name="apply.on.update" value="true" />
<property name="obx.export.RD" value="false" />
<property name="obx.export.DB" value="false" />
<property name="obx.export.CS" value="false" />
<property name="chekPerms" value="false" />
<property name="force" value="false" />
<property name="strict.template.application" value="false" />
<property name="rd" value="false" />
<property name="local" value="true" />
<property name="apply.modules.complete.compilation" value="false" />
<property name="calculate.core.revision" value="true"/>
<property name="stopOnWadError" value="false"/>
<property name="friendlyWarnings" value="false"/>
<property name="checkTranslationConsistency" value="true"/>
<property name="buildValidation" value="true"/>
<property name="disableCheckReferencedOrganizations" value="false"/>
<available file=".hg" property="is.hg" />
<condition property="calculate.core.rev">
<istrue value="${calculate.core.revision}"/>
</condition>
<condition property="xml.core.rev">
<isfalse value="${calculate.core.revision}"/>
</condition>
<condition property="deploy.mode" value="class">
<not>
<isset property="${deploy.mode}" />
</not>
</condition>
<condition property="mode.war">
<equals arg1="war" arg2="${deploy.mode}" />
</condition>
<condition property="mode.class">
<equals arg1="class" arg2="${deploy.mode}" />
</condition>
<condition property="apply.modules.on.create">
<or>
<equals arg1="yes" arg2="${apply.on.create}" />
<equals arg1="true" arg2="${apply.on.create}" />
</or>
</condition>
<condition property="apply.modules.on.update">
<or>
<equals arg1="yes" arg2="${apply.on.update}" />
<equals arg1="true" arg2="${apply.on.update}" />
</or>
</condition>
<condition property="obx.exp.DB">
<or>
<equals arg1="yes" arg2="${obx.export.DB}" />
<equals arg1="true" arg2="${obx.export.DB}" />
</or>
</condition>
<condition property="obx.exp.CS">
<or>
<equals arg1="yes" arg2="${obx.export.CS}" />
<equals arg1="true" arg2="${obx.export.CS}" />
</or>
</condition>
<condition property="timestamp">
<or>
<equals arg1="no" arg2="${execute.update.build.timestamp}" />
<equals arg1="false" arg2="${execute.update.build.timestamp}" />
</or>
</condition>
<condition property="jakarta.base" value="${env.CATALINA_BASE}" else="${jakarta.home}">
<and>
<isset property="env.CATALINA_BASE" />
</and>
</condition>
<property name="log.path" location="${jakarta.base}/logs" />
<property name="lib" location="${jakarta.home}/common" />
<property name="jakarta.context" location="${jakarta.base}/webapps/${context.name}" />
<condition property="build.maxmemory" value="1024M" else="512M">
<or>
<equals arg1="${os.arch}" arg2="amd64" />
<equals arg1="${os.arch}" arg2="x86_64" />
<equals arg1="${os.arch}" arg2="ia64" />
</or>
</condition>
<condition property="allow.root.user" value="true" else="false">
<or>
<equals arg1="yes" arg2="${allow.root}" />
<equals arg1="true" arg2="${allow.root}" />
</or>
</condition>
<condition property="no.java.home" value="true">
<not>
<isset property="env.JAVA_HOME" />
</not>
</condition>
<condition property="bbdd.owner.url" value="${bbdd.url}/${bbdd.sid}" else="${bbdd.url}">
<and>
<equals arg1="${bbdd.rdbms}" arg2="POSTGRE" />
</and>
</condition>
<condition property="root.user">
<and>
<equals arg1="${user.name}" arg2="root" />
<not>
<contains string="${os.name}" substring="Windows" />
</not>
<equals arg1="false" arg2="${allow.root.user}" />
</and>
</condition>
<!-- Minimal classpath used for executing Wad at compile time -->
<path id="wad.class.path">
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${build.core.lib}">
<include name="openbravo-core.jar" />
</fileset>
<fileset dir="${build.wad.lib}">
<include name="openbravo-wad.jar" />
</fileset>
</path>
<path id="project.class.path">
<dirset dir="${base.modules}">
<include name="*/build/classes/" />
</dirset>
<pathelement path="${basedir}/src-util/modulescript/build/classes/" />
<pathelement path="${build}" />
<pathelement path="${base.src}" />
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${build.core.lib}">
<include name="openbravo-core.jar" />
</fileset>
<fileset dir="${build.trl.lib}">
<include name="openbravo-trl.jar" />
</fileset>
<fileset dir="${build.wad.lib}">
<include name="openbravo-wad.jar" />
</fileset>
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.db}/lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.modules}">
<include name="*/lib/**" />
</fileset>
</path>
<!-- This classpath is needed only for the compile.apply.module task-->
<path id="apply.module.compile.classpath">
<dirset dir="${base.modules}">
<include name="*/build/classes/" />
</dirset>
<pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
<pathelement path="${build.apply.module}" />
<pathelement path="${base.src}" />
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${build.core.lib}">
<include name="openbravo-core.jar" />
</fileset>
<fileset dir="${build.trl.lib}">
<include name="openbravo-trl.jar" />
</fileset>
<fileset dir="${build.wad.lib}">
<include name="openbravo-wad.jar" />
</fileset>
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.db}/lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.modules}">
<include name="*/lib/**" />
</fileset>
</path>
<!-- This classpath is needed only for the apply.module task-->
<path id="apply.module.runtime.classpath">
<dirset dir="${base.modules}">
<include name="*/build/classes/" />
</dirset>
<pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
<pathelement path="${build.apply.module}" />
<pathelement path="${build}" />
<pathelement path="${base.src}" />
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${build.core.lib}">
<include name="openbravo-core.jar" />
</fileset>
<fileset dir="${build.trl.lib}">
<include name="openbravo-trl.jar" />
</fileset>
<fileset dir="${build.wad.lib}">
<include name="openbravo-wad.jar" />
</fileset>
<fileset dir="${base.lib}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.db}/lib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="${base.modules}">
<include name="*/lib/**" />
</fileset>
</path>
<macrodef name="updatesystemstatus">
<attribute name="v" default="NOT SET"/>
<sequential>
<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
<classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
<transaction> UPDATE ad_system_info SET system_status='@{v}' ;
DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
</transaction>
</sql>
</sequential>
</macrodef>
<taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
<target name="init" depends="code.rev">
<fail if="root.user" message="Don't run ant tasks with the root user" />
<fail if="no.java.home" message="The environment variable JAVA_HOME is not set." />
</target>
<target name="code.rev" depends="set.code.rev">
<condition property="code.revision" value="${hg.id}" else="0">
<isset property="hg.id" />
</condition>
</target>
<target name="set.code.rev" if="is.hg">
<exec executable="hg" outputproperty="hg.id" failifexecutionfails="false">
<arg value="id"/>
<arg value="-i"/>
</exec>
</target>
<target name="compile.complete" depends="init">
<ant dir="${base.src}" target="compile.complete" inheritAll="true" inheritRefs="true" />
</target>
<target name="smartbuild" depends="init">
<property name="smart.mode" value="true" />
<property name="onlyIfModified" value="true" />
<antcall target="core.lib" />
<condition property="no.local">
<not>
<istrue value="${local}" />
</not>
</condition>
<antcall target="update.database.if.no.local" />
<antcall target="wad.lib" />
<taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
<classpath refid="project.class.path" />
</taskdef>
<CheckSumCondition obDir="${basedir}"
type="md5.wad"
property="test.md5.wad"/>
<condition property="new.wad">
<istrue value="${test.md5.wad}"/>
</condition>
<antcall target="trl.lib" />
<antcall inheritall="true" inheritrefs="true" target="generate.entities.quick" />
<ant dir="${base.src}" target="smartbuild" inheritAll="true" inheritRefs="true" />
<antcall inheritall="true" inheritrefs="true" target="apply.module" />
<ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
<antcall target="build.deploy" />
<updatesystemstatus v="RB51"/>
<!-- only restart tomcat if the restart prop was set to true -->
<condition property="dorestart">
<istrue value="${restart}" />
</condition>
<antcall target="if.restart.tomcat" />
</target>
<target name="update.database.if.no.local" if="no.local">
<antcall target="update.database" />
</target>
<target name="build.deploy">
<antcall target="build.deploy.war" />
<antcall target="build.deploy.class" />
</target>
<target name="build.deploy.class" if="mode.class">
<ant dir="${base.src}" target="copy.files" inheritAll="true" inheritRefs="true" />
<mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
<copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8" />
</target>
<!-- Only needed in special cases. See issue 15709 for details.
This task (if deploy.mode=class) does sync jar-files from WebContent -> deployed webapp (& delete orphan jars)
-->
<target name="copy.files.jarsync" depends="init" if="mode.class">
<ant dir="${base.src}" target="copy.files.jarsync.do" inheritAll="true" inheritRefs="true" />
</target>
<target name="build.deploy.war" if="mode.war">
<antcall target="war" />
</target>
<target name="if.restart.tomcat" if="dorestart">
<antcall target="tomcat.restart" />
</target>
<target name="compile" depends="init">
<ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
</target>
<target name="buildvalidation" depends="init, core.lib">
<updatesystemstatus v="RB11"/>
<condition property="buildValidation.var">
<istrue value="${buildValidation}" />
</condition>
<ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.buildvalidation" depends="init, core.lib">
<ant dir="src-util/buildvalidation" target="compile" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.modulescript" depends="init, core.lib">
<ant dir="src-util/modulescript" target="compile" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war">
<!-- Calculate wad checksum to enable smartbuild-->
<taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
<classpath refid="project.class.path" />
</taskdef>
<CheckSumCondition obDir="${basedir}"
type="md5.wad"
property="test.md5.wad"/>
</target>
<target name="compile.complete.development" depends="init" unless="mode.war">
<updatesystemstatus v="RB43"/>
<ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.complete.war" depends="init" if="mode.war">
<updatesystemstatus v="RB43"/>
<antcall target="compile.complete" />
<antcall target="war" />
</target>
<target name="compile.deploy" depends="compile.war, compile.development">
<updatesystemstatus v="RB51"/>
</target>
<target name="compile.development" depends="init" unless="mode.war">
<ant dir="${base.src}" target="compile.development" inheritAll="true" inheritRefs="true" />
</target>
<target name="validate.database">
<ant dir="${base.src}" target="validate.database" inheritAll="true" inheritRefs="true" />
</target>
<target name="validate.modules">
<ant dir="${base.src}" target="validate.modules" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.war" if="mode.war">
<antcall target="generate.entities" />
<antcall target="compile" />
<antcall target="war" />
</target>
<target name="compile.web" depends="init">
<ant dir="${base.src}" target="compile.web" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.web.development" depends="init">
<ant dir="${base.src}" target="compile.web.development" inheritAll="true" inheritRefs="true" />
</target>
<target name="eclipse.compile" depends="init">
<fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
<ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src}" target="eclipse.compile" inheritAll="true" inheritRefs="true" />
<echo message="Refreshing project..." level="info" />
<eclipse.refreshLocal resource="openbravo" depth="infinite" />
<echo message="Building project..." level="info" />
<eclipse.incrementalBuild project="openbravo" kind="incremental" />
</target>
<target name="eclipse.compile.complete" depends="init">
<fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
<ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
<ant dir="${base.src}" target="eclipse.compile.complete" inheritAll="true" inheritRefs="true" />
<echo message="Refreshing project..." level="info" />
<eclipse.refreshLocal resource="openbravo" depth="infinite" />
<echo message="Building project..." level="info" />
<eclipse.incrementalBuild project="openbravo" kind="full" />
</target>
<target name="compile.src.gen" depends="init">
<ant dir="${base.src}" target="compile.src.gen" inheritAll="true" inheritRefs="true" />
</target>
<target name="generate.java.doc">
<javadoc sourcepath="${base.src}:${base.src.test}:${build.AD}:${base.src.core}/src:${base.src.gen}:build/javasqlc/src/:build/javasqlc/srcAD" Windowtitle="${title}" access="protected" Header="${header}" Footer="${footer}" destdir="${build.docs}" linksource="no" maxmemory="1024M">
<excludepackage name="org.openbravo.erpWindows.*"/>
<classpath>
<path refid="project.class.path"/>
<pathelement path="lib/build/js.jar" />
</classpath>
<link href="http://java.sun.com/javase/6/docs/api/"/>
</javadoc>
</target>
<target name="generate.entities">
<ant dir="${base.src}" target="generate.entities" inheritAll="true" inheritRefs="true" />
</target>
<target name="generate.entities.quick">
<ant dir="${base.src}" target="generate.entities.quick" inheritAll="true" inheritRefs="true" />
</target>
<!-- build-internal forking helper -->
<target name="generate.entities.quick.forked">
<ant dir="${base.src}" target="generate.entities.quick.forked" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.tests" depends="init">
<ant dir="${base.src}" target="run.tests" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.all.tests" depends="init">
<ant dir="${base.src}" target="run.all.tests" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.webservice.tests" depends="init">
<ant dir="${base.src}" target="run.webservice.tests" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.quick.tests" depends="init">
<ant dir="${base.src}" target="run.quick.tests" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.api.test.javascript">
<ant dir="${base.src}" target="run.api.test.javascript" inheritAll="true" inheritRefs="true" />
</target>
<target name="run.api.test.model"
description="Checks current xml db model and dictionary API for not-allowed changes. Requires stableDBdir parameter">
<taskdef name="checkAPI" classname="org.openbravo.ddlutils.task.CheckAPIDistribution">
<classpath refid="project.class.path" />
</taskdef>
<checkAPI driver="${bbdd.driver}"
url="${bbdd.owner.url}"
user="${bbdd.user}"
password="${bbdd.password}"
stableDBdir="${stableDBdir}"
testDBdir="${basedir}"
verbosity="${bbdd.verbosity}"
/>
</target>
<target name="export.sample.data" depends="code.rev">
<ant dir="${base.src}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
</target>
<target name="import.sample.data" depends="code.rev">
<ant dir="${base.src}" target="import.sample.data" inheritAll="true" inheritRefs="true" />
</target>
<target name="compile.src" depends="init">
<ant dir="${base.src}" target="compile.src" inheritAll="true" inheritRefs="true" />
</target>
<target name="war" depends="init">
<ant dir="${base.src}" target="build.war" inheritAll="true" inheritRefs="true" />
</target>
<target name="core.docs" depends="init">
<ant dir="${base.src.core}" target="doc" inheritAll="true" inheritRefs="true" />
</target>
<target name="core.lib" depends="init">
<ant dir="${base.src.core}" target="build" inheritAll="true" inheritRefs="true" />
<antcall target="copy.core.lib" />
</target>
<target name="copy.core.lib">
<copy file="${base.src.core}/lib/openbravo-core.jar" todir="${base.lib}/runtime" failonerror="false" />
</target>
<target name="eclipse.wad.lib" depends="init">
<ant dir="${base.src.wad}" target="sqlc" inheritAll="true" inheritRefs="true" />
<eclipse.refreshLocal resource="OpenbravoWAD" depth="infinite" />
<eclipse.incrementalBuild project="OpenbravoWAD" kind="full" />
</target>
<target name="wad.docs" depends="init">
<ant dir="${base.src.wad}" target="doc" inheritAll="true" inheritRefs="true" />
</target>
<target name="wad.lib" depends="init">
<ant dir="${base.src.wad}" target="build" inheritAll="true" inheritRefs="true" />
</target>
<target name="eclipse.trl.lib" depends="init">
<ant dir="${base.src.trl}" target="sqlc" inheritAll="true" inheritRefs="true" />
<eclipse.refreshLocal resource="OpenbravoTrl" depth="infinite" />
<eclipse.incrementalBuild project="OpenbravoTrl" kind="full" />
</target>
<target name="trl.docs" depends="init">
<ant dir="${base.src.trl}" target="doc" inheritAll="true" inheritRefs="true" />
</target>
<target name="trl.lib" depends="init">
<ant dir="${base.src.trl}" target="build" inheritAll="true" inheritRefs="true" />
</target>
<target name="database.lib" depends="init">
<ant dir="${base.src.db}" target="jar" inheritAll="true" inheritRefs="true" />
<copy file="${base.src.db}/build/lib/dbmanager.jar" todir="${base.db}/lib" failonerror="false" />
</target>
<target name="clean" depends="init">
<ant dir="${base.src}" target="clean" inheritAll="true" inheritRefs="true" />
</target>
<target name="trl.clean" depends="init">
<ant dir="${base.src}" target="trl.clean" inheritAll="true" inheritRefs="true" />
</target>
<target name="trl.remove.unused" depends="init">
<ant dir="${base.src}" target="trl.remove.unused" inheritAll="true" inheritRefs="true" />
</target>
<target name="translate" depends="init">
<ant dir="${base.src}" target="translate" inheritAll="true" inheritRefs="true" />
</target>
<target name="translate.modules" depends="init">
<ant dir="${base.src}" target="translate.modules" inheritAll="true" inheritRefs="true" />
</target>
<target name="installWebService" depends="init">
<ant dir="${base.src}" target="installWebService" inheritAll="true" inheritRefs="true">
<property name="wsdd" value="1" />
</ant>
</target>
<target name="uninstallWebService" depends="init">
<ant dir="${base.src}" target="uninstallWebService" inheritAll="true" inheritRefs="true" />
</target>
<target name="install.source" depends="init, cleanSubfolders, create.database, wad.lib, trl.lib, compile.complete.deploy">
<echo message="applying modules" />
<antcall inheritall="true" inheritrefs="true" target="apply.module" />
<antcall target="import.sample.data" />
<antcall target="load.logoimages" />
<updatesystemstatus v="RB51"/>
<ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
<!--
<antcall target="validate.database" />
<antcall target="validate.modules" />
-->
</target>
<target name="eclipse.install.source" depends="init, cleanSubfolders, create.database">
<fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
<echo message="Building OpenbravoCore project..." level="info" />
<eclipse.incrementalBuild project="OpenbravoCore" kind="full"/>
<antcall target="eclipse.wad.lib"/>
<antcall target="eclipse.trl.lib"/>
<antcall target="eclipse.compile.complete"/>
<echo message="applying modules" />
<antcall inheritall="true" inheritrefs="true" target="apply.module" />
<antcall target="import.sample.data" />
<updatesystemstatus v="RB51"/>
<ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
</target>
<target name="create.database" depends="init, core.lib, database.lib">
<ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
<antcall target="db.apply.modules.sampledata" />
</target>
<target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
<updatesystemstatus v="RB12"/>
<ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
<antcall target="generate.entities.quick" />
<antcall target="apply.module" />
</target>
<target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
<updatesystemstatus v="RB12"/>
<ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
<antcall target="generate.entities.quick" />
<antcall target="apply.module" />
</target>
<target name="create.database.script" depends="init, core.lib">
<ant dir="${base.db}" target="create.database.script" inheritAll="true" inheritRefs="true" />
</target>
<target name="update.database.script" depends="init, core.lib">
<ant dir="${base.db}" target="update.database.script" inheritAll="true" inheritRefs="true" />
</target>
<target name="export.database" depends="init, core.lib, database.lib, generate.entities.quick">
<ant dir="${base.db}" target="export.database.structure" inheritAll="true" inheritRefs="true" />
</target>
<target name="export.config.script" depends="init, core.lib">
<ant dir="${base.db}" target="export.config.script" inheritAll="true" inheritRefs="true" />
</target>
<target name="db.apply.modules" if="apply.modules.on.update">
<antcall inheritall="true" inheritrefs="true" target="apply.module" />
</target>
<target name="db.apply.modules.sampledata" if="apply.modules.on.create">
<antcall target="generate.entities" />
<antcall inheritall="true" inheritrefs="true" target="apply.module" />
<antcall target="import.sample.data" />
<antcall target="load.logoimages" />
</target>
<target name="apply.modules">
<condition property="apply.modules.complete.compilation.var">
<istrue value="${apply.modules.complete.compilation}" />
</condition>
<condition property="apply.modules.simple.compilation.var">
<isfalse value="${apply.modules.complete.compilation.var}" />
</condition>
<updatesystemstatus v="RB43"/>
<antcall target="apply.modules.compile"/>
<ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
</target>
<target name="apply.module.forked">
<!--
Note: set reinitializeModel to false because otherwise the dal is re-initialized with classes and a model
which are not in sync (see issue: https://issues.openbravo.com/view.php?id=9376)
Note: applyModule can also be moved to a java task to fork it (to prevent this from occuring)
but then no output is visible for the user.
-->
<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
<classpath refid="project.class.path" />
</taskdef>
<applyModule userId="0" adminMode="true" forceRefData="${forceRefData}" propertiesFile="${base.config}/Openbravo.properties"/>
</target>
<target name="compile.apply.module" depends="init">
<updatesystemstatus v="RB31"/>
<ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
</target>
<!--
This task uses a special classpath.
This classpath is equivalent to the normal project.class.path, except for the fact that that the normal build folder
is replaced by the apply.module.build folder, in which the ApplyModule task related classes will be compiled.
This is done to workaround the fact that the javac task needs to compile all the related classes when upgrading openbravo
and if the normal build folder is included, none of them are recompiled by default unless the whole build directory is specified.
-->
<target name="apply.module" depends="compile.apply.module">
<java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
<arg line="'${base.src}' '${friendlyWarnings}' '${forceRefData}'" />
<classpath refid="apply.module.runtime.classpath" />
</java>
<delete includeEmptyDirs="true" dir="${build.apply.module}" />
</target>
<target name="apply.modules.compile" depends="wad.lib">
<antcall target="apply.modules.compile.simple"/>
<antcall target="apply.modules.compile.complete"/>
</target>
<target name="apply.modules.compile.simple" if="apply.modules.simple.compilation.var">
<antcall target="compile.deploy" />
</target>
<target name="apply.modules.compile.complete" if="apply.modules.complete.compilation.var">
<antcall target="compile.complete.deploy" />
</target>
<!--
apparently this does not overwrite the default catalina_opts, only
if it is not set will it be set to the value below
-->
<property name="env.CATALINA_OPTS" value="-XX:MaxPermSize=128M" />
<!--
This task is called from the Openbravo ui, it spawns a java call which again
calls the restart.tomcat.do task as a spawned task.
-->
<target name="tomcat.restart" description="Restart the tomcat server process">
<echo message="Restarting tomcat..." />
<java classname="org.openbravo.service.system.RestartTomcat" spawn="true" fork="true" maxmemory="${build.maxmemory}">
<arg line="${base.src}" />
<classpath refid="project.class.path" />
</java>
</target>
<!--
Is called by the org.openbravo.service.system.RestartTomcat class.
-->
<target name="tomcat.restart.do" description="Restart the tomcat server process">
<echo message="Restarting Tomcat at ${env.CATALINA_HOME}" />
<java classname="org.apache.catalina.startup.Bootstrap" fork="true">
<classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
<jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
<jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
<arg line="stop" />
</java>
<sleep description="Wait to give tomcat time to stop" seconds="20" />
<!-- if deploy.mode=class this will sync (& delete orphan) jarfiles from WebContent -> tomcat-->
<antcall target="copy.files.jarsync"/>
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true">
<classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
<!-- note because CATALINA_OPTS can be multi argument the line attribute has to be used! -->
<jvmarg line="${env.CATALINA_OPTS}" />
<jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" />
<jvmarg value="-Djava.util.logging.config.file=${env.CATALINA_BASE}/conf/logging.properties" />
<jvmarg value="-Djava.endorsed.dirs=${env.CATALINA_HOME}/endorsed" />
<jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
<jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
<jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
<arg line="start" />
</java>
</target>
<!--
This task is called from the Openbravo ui, it spawns a java call which again
calls the tomcat.reload.do task as a spawned task.
-->
<target name="tomcat.reload" description="Reload the Openbravo context">
<echo message="Reloading webapp..." />
<java classname="org.openbravo.service.system.ReloadContext" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" spawn="true" fork="true">
<arg line="${base.src}" />
<classpath refid="project.class.path" />
</java>
</target>
<target name="tomcat.reload.do">
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="project.class.path" />
</taskdef>
<reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
</target>
<target name="tomcat.list">
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="project.class.path" />
</taskdef>
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
</target>
<target name="deploy.context">
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
<classpath refid="project.class.path" />
</taskdef>
<taskdef name="deploy.tomcat" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="project.class.path" />
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath refid="project.class.path" />
</taskdef>
<undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" failonerror="false" />
<deploy.tomcat url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" war="file:${base.lib}/${context.name}.war" />
<start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
</target>
<target name="generate-wsdd">
<ant dir="${base.src}" target="generate-wsdd" inheritAll="true" inheritRefs="true" />
</target>
<target name="obx.export.database" if="obx.exp.DB">
<antcall target="export.database" />
</target>
<target name="obx.export.config.script" if="obx.exp.CS">
<antcall target="export.config.script" />
</target>
<target name="package.module">
<taskdef name="extractModule" classname="org.openbravo.erpCommon.modules.ExtractModuleTask">
<classpath refid="project.class.path" />
</taskdef>
<taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">
<classpath refid="project.class.path" />
</taskdef>
<taskdef name="WADValidation" classname="org.openbravo.wad.validation.WADValidatorTask">
<classpath refid="project.class.path" />
</taskdef>
<echo message="Validating Module..." />
<WADValidation propertiesFile="${base.config}/Openbravo.properties"
modules="${module}"
stoponerror="true"/>
<validateModules moduleJavaPackage="${module}" failOnError="true" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
<antcall target="obx.export.database" />
<antcall target="obx.export.config.script" />
<extractModule moduleName="${module}" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" exportRD="${obx.export.RD}" />
</target>
<target name="diagnostic">
<ant dir="src-util/diagnostic" antfile="build-create.xml" target="build" />
<ant dir="src-util/diagnostic" target="check.all" />
</target>
<target name="setup.check.os">
<condition property="osname" value="linux">
<equals arg1="${os.name}" arg2="Linux" />
</condition>
<condition property="osname" value="freebsd6">
<equals arg1="${os.name}" arg2="FreeBSD" />
</condition>
<condition property="osname" value="windows">
<contains string="${os.name}" substring="Windows" />
</condition>
<condition property="osname" value="osx">
<contains string="${os.name}" substring="OS X" />
</condition>
<condition property="osname" value="solaris">
<or>
<contains string="${os.name}" substring="Solaris" />
<contains string="${os.name}" substring="SunOS" />
</or>
</condition>
<condition property="osname" value="openbsd">
<equals arg1="${os.name}" arg2="OpenBSD" />
</condition>
<condition property="osname" value="aix">
<equals arg1="${os.name}" arg2="AIX" />
</condition>
<condition property="osname" value="hpux">
<equals arg1="${os.name}" arg2="HPUX" />
</condition>
</target>
<target name="setup.check.arch">
<condition property="osarch" value="">
<or>
<equals arg1="${os.arch}" arg2="x86" />
<equals arg1="${os.arch}" arg2="i386" />
<contains string="${os.name}" substring="Windows" />
<contains string="${os.name}" substring="OS X" />
</or>
</condition>
<condition property="osarch" value="-x64">
<or>
<equals arg1="${os.arch}" arg2="amd64" />
<equals arg1="${os.arch}" arg2="x86_64" />
<not>
<contains string="${os.name}" substring="Windows" />
</not>
<not>
<contains string="${os.name}" substring="OS X" />
</not>
</or>
</condition>