forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build-dist.xml
3267 lines (2786 loc) · 90.1 KB
/
build-dist.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"?>
<project basedir="." default="dist" name="portal-dist" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build.xml" />
<macrodef name="build-dist-tomcat-bare">
<sequential>
<if>
<equals arg1="${tomcat.keep.app.server.properties}" arg2="true" />
<then>
<antcall inheritAll="false" target="unzip-tomcat" />
</then>
<else>
<app-server-properties-update>
app.server.type=tomcat
</app-server-properties-update>
<antcall target="unzip-tomcat" />
</else>
</if>
<delete dir="${project.dir}/portal-web/classes" />
</sequential>
</macrodef>
<macrodef name="replace-multilines">
<attribute name="file" />
<element name="replace-elements" />
<sequential>
<if>
<os family="windows" />
<then>
<fixcrlf eol="dos" file="@{file}" fixlast="false" />
</then>
</if>
<replace
file="@{file}"
>
<replace-elements />
</replace>
</sequential>
</macrodef>
<macrodef name="set-weblogic-log-levels">
<sequential>
<replace
file="${app.server.weblogic.instance.dir}/config/config.xml"
>
<replacetoken><![CDATA[<name>AdminServer</name>]]></replacetoken>
<replacevalue><![CDATA[<name>AdminServer</name>
<log>
<date-format-pattern>MMM d, yyyy h:mm:ss,SSS a z</date-format-pattern>
<file-name>logs/AdminServer.log</file-name>
<rotation-type>bySize</rotation-type>
<number-of-files-limited>true</number-of-files-limited>
<file-count>7</file-count>
<file-min-size>500</file-min-size>
<rotate-log-on-startup>true</rotate-log-on-startup>
<buffer-size-kb>8</buffer-size-kb>
<logger-severity>Warning</logger-severity>
<log-file-severity>Trace</log-file-severity>
<stdout-severity>Error</stdout-severity>
<stdout-format>standard</stdout-format>
<stdout-log-stack>true</stdout-log-stack>
<stacktrace-depth>5</stacktrace-depth>
<domain-log-broadcast-severity>Notice</domain-log-broadcast-severity>
<redirect-stdout-to-server-log-enabled>false</redirect-stdout-to-server-log-enabled>
<redirect-stderr-to-server-log-enabled>true</redirect-stderr-to-server-log-enabled>
<domain-log-broadcaster-buffer-size>1</domain-log-broadcaster-buffer-size>
<log-monitoring-enabled>true</log-monitoring-enabled>
<log-monitoring-interval-secs>30</log-monitoring-interval-secs>
<log-monitoring-throttle-threshold>1500</log-monitoring-throttle-threshold>
<log-monitoring-throttle-message-length>50</log-monitoring-throttle-message-length>
<log-monitoring-max-throttle-message-signature-count>1000</log-monitoring-max-throttle-message-signature-count>
</log>]]></replacevalue>
</replace>
</sequential>
</macrodef>
<macrodef name="update-plugins-includes-plugin">
<attribute name="plugins.includes.plugin.bundle" />
<attribute name="plugins.includes.plugin.dependent-apps" />
<attribute name="plugins.includes.plugin.marketplace" />
<attribute name="plugins.includes.plugin.name" />
<attribute name="plugins.includes.plugin.public" />
<sequential>
<if>
<and>
<or>
<and>
<equals arg1="${lp.release.type}" arg2="CE" />
<equals arg1="@{plugins.includes.plugin.public}" arg2="true" />
</and>
<equals arg1="${lp.release.type}" arg2="EE" />
</or>
<or>
<and>
<equals arg1="${plugins.includes.bundle.required}" arg2="true" />
<equals arg1="@{plugins.includes.plugin.bundle}" arg2="true" />
</and>
<and>
<equals arg1="${plugins.includes.marketplace.required}" arg2="true" />
<equals arg1="@{plugins.includes.plugin.marketplace}" arg2="true" />
</and>
</or>
</and>
<then>
<echo append="true" file="${lp.plugins.dir}/build.${user.name}.properties">@{plugins.includes.plugin.dependent-apps},@{plugins.includes.plugin.name},</echo>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="update-websphere-java-opts">
<sequential>
<replace
file="${app.server.websphere.instance.dir}/config/cells/liferay-cell/nodes/liferay-node/servers/server1/server.xml"
>
<replacefilter
token="maximumHeapSize="1024""
value="initialHeapSize="6144" maximumHeapSize="6144""
/>
</replace>
<replace
file="${app.server.websphere.instance.dir}/config/cells/liferay-cell/nodes/liferay-node/servers/server1/server.xml"
>
<replacefilter
token="-Xquickstart -Dfile.encoding=UTF-8 -Duser.timezone=GMT"
value="${app.server.websphere.jdk.java.options} ${app.server.websphere.jvm.args} -Xquickstart ${app.server.websphere.jvm.mem}"
/>
</replace>
</sequential>
</macrodef>
<target name="build-dist-jboss">
<app-server-properties-update>
app.server.type=jboss
</app-server-properties-update>
<antcall inheritAll="false" target="unzip-jboss" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<app-server-properties-reset />
</target>
<target name="build-dist-language-hook">
<if>
<available file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" />
<then>
<delete dir="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" />
</then>
</if>
<exec dir="${lp.plugins.dir}/hooks" executable="cmd.exe">
<arg line="/c create.bat liferay-language-${locale.current} "Liferay Portal Language Pack ${locale.current}"" />
</exec>
<echo file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/liferay-hook.xml"><![CDATA[<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 7.4.0//EN" "http://www.liferay.com/dtd/liferay-hook_7_4_0.dtd">
<hook>
<language-properties>content/Language-ext_${locale.current}.properties</language-properties>
</hook>]]></echo>
<copy
file="portal-impl/src/content/Language_${locale.current}.properties"
tofile="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/src/content/Language-ext_${locale.current}.properties"
/>
<if>
<not>
<equals arg1="${lp.plugins.minor.version}" arg2="1" />
</not>
<then>
<replace
file="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook/docroot/WEB-INF/liferay-plugin-package.properties"
>
<replacefilter
token="module-incremental-version=1"
value="module-incremental-version=${lp.plugins.minor.version}"
/>
</replace>
</then>
</if>
<ant dir="${lp.plugins.dir}/hooks/liferay-language-${locale.current}-hook" inheritAll="false" target="war" />
</target>
<target name="build-dist-language-hooks">
<exec executable="cmd">
<arg line="/c dir /b ${project.dir}\portal-impl\src\content\ > ${project.dir}\output.txt" />
</exec>
<loadfile
property="output.txt.content"
srcFile="${project.dir}\output.txt"
/>
<delete file="output.txt" />
<beanshell>
String outputTxtContent = project.getProperty("output.txt.content");
if (outputTxtContent.contains("File Not Found")) {
outputTxtContent = "";
}
String locales = outputTxtContent.replaceAll("\r\n", ",");
locales = locales.replaceAll("Language.properties,", "");
locales = locales.replaceAll("Language_", "");
locales = locales.replaceAll(".properties", "");
if (locales.endsWith(",")) {
locales = locales.substring(0, locales.length() - 1);
}
project.setProperty("locale.list", locales);
</beanshell>
<for list="${locale.list}" param="locale.current">
<sequential>
<antcall target="build-dist-language-hook">
<param name="locale.current" value="@{locale.current}" />
</antcall>
</sequential>
</for>
</target>
<target name="build-dist-plugins">
<antcall inheritAll="false" target="update-plugins-includes">
<param name="plugins.includes.bundle.required" value="true" />
</antcall>
<ant dir="${lp.plugins.dir}" inheritAll="false" target="all" />
</target>
<target name="build-dist-sql-oracle">
<ant dir="sql" inheritAll="false" target="rebuild-oracle" />
<ant dir="sql" inheritAll="false" target="export-oracle" />
<move
file="sql/lportal.dmp"
tofile="dist/liferay-portal-sql-oracle-${lp.version}.dmp"
/>
</target>
<target name="build-dist-tomcat">
<build-dist-tomcat-bare />
<ant inheritAll="false" target="deploy" />
<if>
<not>
<equals arg1="${tomcat.keep.app.server.properties}" arg2="true" />
</not>
<then>
<app-server-properties-reset />
</then>
</if>
</target>
<target name="build-dist-tomcat-bare">
<build-dist-tomcat-bare />
</target>
<target name="build-dist-weblogic">
<app-server-properties-update>
app.server.type=weblogic
</app-server-properties-update>
<if>
<or>
<equals arg1="${app.server.weblogic.version}" arg2="12.2.1" />
<equals arg1="${app.server.weblogic.version}" arg2="14.1.1" />
</or>
<then>
<antcall target="unzip-weblogic-custom" />
</then>
<else>
<antcall target="unzip-weblogic" />
</else>
</if>
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<app-server-properties-reset />
</target>
<target name="build-dist-websphere">
<app-server-properties-update>
app.server.type=websphere
</app-server-properties-update>
<antcall inheritAll="false" target="unzip-websphere" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<app-server-properties-reset />
</target>
<target name="build-dist-wildfly">
<app-server-properties-update>
app.server.type=wildfly
</app-server-properties-update>
<antcall target="unzip-wildfly" />
<delete dir="${project.dir}/portal-web/classes" />
<ant inheritAll="false" target="deploy" />
<app-server-properties-reset />
</target>
<target name="create-weblogic-domain">
<property name="app.server.weblogic.template.dir" value="${app.server.weblogic.wlserver.dir}/common/templates/wls" />
<echo file="${app.server.weblogic.dir}/remove-domain.sh">
#/bin/sh
if [ -d "${app.server.weblogic.instance.dir}" ]; then
rm -r ${app.server.weblogic.instance.dir}
fi
</echo>
<exec executable="/bin/bash">
<arg value="${app.server.weblogic.dir}/remove-domain.sh" />
</exec>
<echo file="${app.server.weblogic.dir}/create-weblogic-domain.py"><![CDATA[
readTemplate('${app.server.weblogic.template.dir}/wls.jar')
set('Name', '${app.server.weblogic.instance.name}')
cd('/Security/%s/User/%s' % ('${app.server.weblogic.instance.name}', 'weblogic'))
set('UserPassword', 'testing123')
cd('/Servers/AdminServer')
set('ListenAddress', '')
set('ListenPort', 8080)
writeDomain('${app.server.weblogic.instance.dir}')
closeTemplate()
]]></echo>
<var name="source.command" value="source" />
<echo file="${app.server.weblogic.dir}/create-weblogic-domain.sh">
<![CDATA[
#!/bin/sh
export JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS ${app.server.weblogic.jdk.java.options}"
export MW_HOME="${app.server.weblogic.dir}"
export USER_MEM_ARGS="${app.server.weblogic.jvm.mem}"
export WL_HOME="${app.server.weblogic.wlserver.dir}"
${source.command} ${MW_HOME}/oracle/oracle_common/common/bin/commEnv.sh
export CLASSPATH=${FMWCONFIG_CLASSPATH}
${env.JAVA_HOME}/bin/java weblogic.WLST create-weblogic-domain.py
echo finished executing create-weblogic-domain.py..
]]>
</echo>
<chmod
file="${app.server.weblogic.dir}/create-weblogic-domain.sh"
perm="744"
/>
<exec dir="${app.server.weblogic.dir}" executable="sh">
<arg value="create-weblogic-domain.sh" />
</exec>
</target>
<target name="dist">
<if>
<available file="${patching.tool.source.dir}" type="dir" />
<then>
<ant dir="${patching.tool.source.dir}" inheritAll="false" target="all" />
</then>
</if>
<exec dir="${project.dir}" executable="cmd.exe" os="${os.windows}">
<arg line="/c svn --username ${svn.username} --password ${svn.password} update -r ${svn.revision}" />
</exec>
<exec dir="${lp.source.dir}" executable="cmd.exe" os="${os.windows}">
<arg line="/c svn --username ${svn.username} --password ${svn.password} update -r ${svn.revision}" />
</exec>
<exec dir="${lp.plugins.dir}" executable="cmd.exe" os="${os.windows}">
<arg line="/c svn --username ${svn.username} --password ${svn.password} update -r ${svn.revision}" />
</exec>
<antcall target="all" />
<delete dir="${lp.plugins.dir}/dist" />
<delete dir="${liferay.home}/data" />
<delete dir="${liferay.home}/deploy" />
<delete dir="${liferay.home}/logs" />
<antcall target="doc" />
<remake-dir dir="dist" />
<antcall target="zip-portal-war" />
<antcall target="build-dist-plugins" />
<antcall target="build-dist-jboss" />
<antcall target="build-dist-tomcat" />
<antcall target="build-dist-wildfly" />
<antcall target="zip-jboss" />
<antcall target="zip-patching-tool" />
<antcall target="zip-portal-dependencies" />
<antcall target="zip-sql" />
<antcall target="zip-src" />
<antcall target="zip-tomcat" />
<antcall target="zip-wildfly" />
<ant antfile="build-maven.xml" inheritAll="false" target="zip-maven" />
<!--<antcall target="build-dist-sql-oracle" />-->
<ant dir="${lp.plugins.dir}" inheritAll="false" target="extract-plugins-sdk" />
<move
file="${lp.plugins.dir}/dist/liferay-plugins-sdk-${lp.version}.zip"
tofile="dist/liferay-plugins-sdk-${lp.version}.zip"
/>
<antcall target="update-plugins-includes">
<param name="plugins.includes.marketplace.required" value="true" />
</antcall>
<ant dir="${lp.plugins.dir}" inheritAll="false" target="all" />
<if>
<isset property="dist.username" />
<then>
<scp todir="${dist.username}:${dist.password}@${dist.host}:/home/${dist.username}" trust="yes">
<fileset
dir="dist"
/>
</scp>
</then>
</if>
<echo>Manually run "ant -buildfile build-maven.xml deploy-release-artifacts" if the
release was successful.</echo>
</target>
<target name="exec-patching-tool">
<if>
<os family="unix" />
<then>
<exec dir="${patching.tool.dir}" executable="sh">
<arg line="patching-tool.sh ${patching.tool.arg.line}" />
</exec>
</then>
<else>
<exec dir="${patching.tool.dir}" executable="cmd.exe">
<arg line="/c patching-tool.bat ${patching.tool.arg.line}" />
</exec>
</else>
</if>
</target>
<target name="generate-startup-files">
<!--
Remove this target the reference to this target is removed from the
release tool
-->
</target>
<target name="generate-tomcat-setenv">
<echo file="tools/servers/tomcat/bin/setenv.sh">CATALINA_OPTS="$CATALINA_OPTS ${app.server.tomcat.jvm.args} ${app.server.tomcat.jvm.mem}"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS ${app.server.tomcat.jdk.java.options}"</echo>
<chmod
file="tools/servers/tomcat/bin/setenv.sh"
perm="a+x"
/>
<echo file="tools/servers/tomcat/bin/setenv.bat">set "CATALINA_OPTS=%CATALINA_OPTS% ${app.server.tomcat.jvm.args} ${app.server.tomcat.jvm.mem}"
set "JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% ${app.server.tomcat.jdk.java.options}"</echo>
</target>
<target name="install-weblogic14-setup-files">
<echo file="${app.server.weblogic.dir}/oraInst.loc">
inventory_loc=${app.server.weblogic.dir}/oraInventory
inst_group=appserver
</echo>
<echo file="${app.server.weblogic.dir}/create_swap.sh">
<![CDATA[
#!/bin/sh
swapsize=1024
grep -q "swapfile" /etc/fstab
if [ $? -ne 0 ]
then
echo "Adding swapfile."
fallocate -l ${swapsize}M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
fi
cat /proc/swaps
cat /proc/meminfo | grep Swap
]]>
</echo>
<echo file="${app.server.weblogic.dir}/create_user.sh">
<![CDATA[
#!/bin/bash
if ! id appserver &>/dev/null
then
echo "Adding user appserver."
sudo useradd appserver
echo -e "liferay123\nliferay123" | sudo passwd appserver
fi
]]>
</echo>
<echo file="${app.server.weblogic.dir}/install_weblogic.sh">
<![CDATA[
#!/bin/bash
export JAVA_HOME=/opt/java/jdk8-x64
export PATH=$JAVA_HOME/bin:$PATH
java -jar ${app.server.weblogic.dir}/${app.server.weblogic.jar.name} -ignoreSysPrereqs -silent ORACLE_BASE=${app.server.weblogic.dir} ORACLE_HOME=${app.server.weblogic.dir}/oracle JAVA_HOME=/opt/java/jdk8-x64 INVENTORY_LOCATION=${app.server.weblogic.dir}/oraInventory INSTALL_TYPE='Complete with Examples' -invPtrLoc ${app.server.weblogic.dir}/oraInst.loc
]]>
</echo>
<exec executable="/bin/bash">
<arg value="${app.server.weblogic.dir}/create_swap.sh" />
</exec>
<exec executable="/bin/bash">
<arg value="${app.server.weblogic.dir}/create_user.sh" />
</exec>
<execute dir="${app.server.weblogic.dir}">
<![CDATA[
rm -fr ${app.server.weblogic.dir}/oraInventory
mkdir ${app.server.weblogic.dir}/oraInventory
rm -fr ${app.server.weblogic.dir}/oracle
mkdir ${app.server.weblogic.dir}/oracle
sudo chown -R appserver: ${app.server.weblogic.dir}
su appserver -c "/bin/sh install_weblogic.sh"
]]>
</execute>
</target>
<target name="prepare-generated-files">
<antcall target="clean" />
<antcall target="start" />
<record action="start" name="prepare-generated-files.txt" />
<ant dir="portal-impl" inheritAll="false" target="build-iw" />
<ant dir="portal-impl" inheritAll="false" target="build-lib-versions" />
<ant dir="portal-impl" inheritAll="false" target="build-services" />
<delete file="portal-impl/classes/META-INF/javadocs-all.xml" />
<delete file="portal-impl/classes/META-INF/javadocs-rt.xml" />
<delete file="portal-impl/src/META-INF/javadocs-all.xml" />
<delete file="portal-impl/src/META-INF/javadocs-rt.xml" />
<ant dir="portal-impl" inheritall="false" target="compile-test" />
<ant inheritall="false" target="format-javadoc">
<property name="generate.xml" value="true" />
</ant>
<delete>
<fileset
dir="${lp.plugins.dir}"
includes="**/javadocs-all.xml,**/javadocs-rt.xml"
/>
</delete>
<antcall target="deploy" />
<ant dir="${lp.plugins.dir}" inheritall="false" target="clean" />
<ant dir="${lp.plugins.dir}" inheritall="false" target="compile" />
<ant dir="${lp.plugins.dir}" inheritall="false" target="format-javadoc">
<property name="generate.xml" value="true" />
</ant>
<parallel>
<if>
<os family="windows" />
<then>
<exec executable="cmd">
<arg line="/c ${app.server.tomcat.bin.dir}/catalina run" />
</exec>
</then>
<else>
<exec executable="${app.server.tomcat.bin.dir}/catalina.sh">
<arg line="run" />
</exec>
</else>
</if>
<sequential>
<waitfor>
<http url="http://localhost:8080" />
</waitfor>
<if>
<os family="windows" />
<then>
<exec executable="cmd">
<arg line="/c ${app.server.tomcat.bin.dir}/shutdown.bat" />
</exec>
</then>
<else>
<exec executable="${app.server.tomcat.bin.dir}/shutdown.sh" />
</else>
</if>
</sequential>
</parallel>
<beanshell>
project.setProperty("prepare-generated-files.tstamp", String.valueOf(System.currentTimeMillis()));
</beanshell>
<record action="stop" name="prepare-generated-files.txt" />
<if>
<resourcecontains
resource="prepare-generated-files.txt"
substring="java.lang.RuntimeException"
/>
<then>
<delete file="prepare-generated-files.txt" />
<fail>Aborting due to Java exception.</fail>
</then>
</if>
<delete file="prepare-generated-files.txt" />
<echo file="prepare-generated-files.tstamp">${prepare-generated-files.tstamp}</echo>
</target>
<target name="unzip-glowroot">
<delete dir="${app.server.parent.dir}/glowroot" />
<if>
<not>
<available file="${app.server.parent.dir}/${glowroot.zip.name}" />
</not>
<then>
<mkdir dir="${app.server.parent.dir}" />
<mirrors-get
dest="${app.server.parent.dir}/${glowroot.zip.name}"
src="${glowroot.zip.url}"
verbose="true"
/>
</then>
</if>
<unzip
dest="${app.server.parent.dir}"
src="${app.server.parent.dir}/${glowroot.zip.name}"
/>
<var name="glowroot.agent" value="-javaagent:${CATALINA_HOME}/../glowroot/glowroot.jar" />
<if>
<not>
<resourcecontains
resource="${app.server.tomcat.dir}/bin/setenv.sh"
substring="${glowroot.agent}"
/>
</not>
<then>
<echo append="true" file="${app.server.tomcat.dir}/bin/setenv.sh">
<![CDATA[
if [ "$1" = "glowroot" ]
then
GLOWROOT_OPTS="${glowroot.agent} -Dglowroot.enabled=true"
CATALINA_OPTS="${CATALINA_OPTS} ${GLOWROOT_OPTS}"
shift
fi
if [ "$GLOWROOT_ENABLED" = "true" ]
then
GLOWROOT_OPTS="${glowroot.agent} -Dglowroot.enabled=true"
CATALINA_OPTS="${CATALINA_OPTS} ${GLOWROOT_OPTS}"
fi
]]>
</echo>
</then>
</if>
<echo file="${liferay.home}/glowroot/admin.json"><![CDATA[{
"roles": [
{
"name": "Administrator",
"permissions": [
"admin",
"agent:config",
"agent:error",
"agent:incident",
"agent:jvm",
"agent:transaction"
]
}
],
"storage": {
"fullQueryTextExpirationHours": 336,
"rollupCappedDatabaseSizesMb": [
500,
500,
500,
500
],
"rollupExpirationHours": [
72,
336,
2160,
2160
],
"traceCappedDatabaseSizeMb": 500,
"traceExpirationHours": 336
},
"users": [
{
"roles": [
"Administrator"
],
"username": "anonymous"
}
],
"web": {
"bindAddress": "127.0.0.1",
"contextPath": "/o/glowroot",
"port": 4000,
"sessionCookieName": "GLOWROOT_SESSION_ID",
"sessionTimeoutMinutes": 30
}
}]]></echo>
</target>
<target name="unzip-jboss">
<delete dir="${app.server.jboss.dir}" />
<if>
<not>
<available file="${app.server.parent.dir}/${app.server.jboss.zip.name}" />
</not>
<then>
<mkdir dir="${app.server.parent.dir}" />
<trycatch>
<try>
<mirrors-get
dest="${app.server.parent.dir}/${app.server.jboss.zip.name}"
src="${app.server.jboss.zip.url}"
verbose="true"
/>
</try>
<catch>
<fail>
.
Please download the JBoss zip file from ${app.server.jboss.zip.url} and
place it here: ${app.server.parent.dir}/${app.server.jboss.zip.name}. Then rerun
this task.
</fail>
</catch>
</trycatch>
</then>
</if>
<unzip
dest="${app.server.parent.dir}"
src="${app.server.parent.dir}/${app.server.jboss.zip.name}"
>
<mapper
from="(jboss-eap-)\d\.\d[\.]?[\d]?(/.*)"
to="\1${app.server.jboss.version}\2"
type="regexp"
/>
</unzip>
<property name="app.server.jboss.module.file" value="${app.server.jboss.dir}/modules/system/layers/base/sun/jdk/main/module.xml" />
<replace
file="${app.server.jboss.module.file}"
>
<replacetoken><![CDATA[<paths>]]></replacetoken>
<replacevalue>
<![CDATA[
<paths>
<path name="com/sun/crypto" />
<path name="com/sun/crypto/provider" />
<path name="com/sun/image/codec/jpeg" />
<path name="com/sun/org/apache/xml/internal/resolver" />
<path name="com/sun/org/apache/xml/internal/resolver/tools" />
]]>
</replacevalue>
</replace>
<replace
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replacetoken><![CDATA[</extensions>]]></replacetoken>
<replacevalue>
<![CDATA[
</extensions>
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8" />
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true" />
</system-properties>
]]>
</replacevalue>
</replace>
<replace
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replacetoken><![CDATA[<deployment-scanner ]]></replacetoken>
<replacevalue><![CDATA[<deployment-scanner deployment-timeout="360" ]]></replacevalue>
</replace>
<replace-multilines
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replace-elements>
<replacetoken><![CDATA[<formatter>
<named-formatter name="COLOR-PATTERN"]]></replacetoken>
<replacevalue><![CDATA[<filter-spec value="not(any(match("WFLYSRV0059"),match("WFLYEE0007")))" />
<formatter>
<named-formatter name="COLOR-PATTERN"]]></replacevalue>
</replace-elements>
</replace-multilines>
<replace
file="${app.server.jboss.bin.dir}/standalone.conf"
>
<replacetoken><![CDATA[JAVA_OPTS="-Xms1303m -Xmx1303m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m ]]></replacetoken>
<replacevalue><![CDATA[JAVA_OPTS="]]></replacevalue>
</replace>
<replace
file="${app.server.jboss.instance.dir}/configuration/standalone.xml"
>
<replacetoken><![CDATA[<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>]]></replacetoken>
<replacevalue><![CDATA[<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>
<security-domain name="PortalRealm">
<authentication>
<login-module code="com.liferay.portal.security.jaas.PortalLoginModule" flag="required" />
</authentication>
</security-domain>]]>
</replacevalue>
</replace>
<replace
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replacetoken><![CDATA[<location name="/" handler="welcome-content"/>]]></replacetoken>
<replacevalue><![CDATA[<!--<location name="/" handler="welcome-content"/>-->]]></replacevalue>
</replace>
<replace
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replacetoken><![CDATA[<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>]]></replacetoken>
<replacevalue><![CDATA[<!--<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>-->]]></replacevalue>
</replace>
<replace
file="${app.server.jboss.dir}/standalone/configuration/standalone.xml"
>
<replacetoken><![CDATA[<jsp-config />]]></replacetoken>
<replacevalue>
<![CDATA[<jsp-config development="true" source-vm="1.8" target-vm="1.8" />]]>
</replacevalue>
</replace>
<echo append="true" file="${app.server.jboss.bin.dir}/standalone.conf">
<![CDATA[${line.separator}JAVA_OPTS="$JAVA_OPTS ${app.server.jboss.jvm.args} ${app.server.jboss.jvm.mem}"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS ${app.server.jboss.jdk.java.options}"
export JDK_JAVA_OPTIONS]]>
</echo>
<replace
file="${app.server.jboss.bin.dir}/standalone.conf.bat"
>
<replacetoken><![CDATA[set "JAVA_OPTS=-Xms1G -Xmx1G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m"]]></replacetoken>
<replacevalue></replacevalue>
</replace>
<replace
file="${app.server.jboss.bin.dir}/standalone.conf.bat"
>
<replacetoken><![CDATA[:JAVA_OPTS_SET]]></replacetoken>
<replacevalue expandProperties="true"><![CDATA[set "JAVA_OPTS=%JAVA_OPTS% ${app.server.jboss.jvm.args} ${app.server.jboss.jvm.mem}":JAVA_OPTS_SET]]></replacevalue>
</replace>
<chmod
perm="a+x"
>
<fileset
dir="${app.server.jboss.bin.dir}"
>
<include name="*.sh" />
</fileset>
</chmod>
</target>
<target name="unzip-tomcat">
<delete dir="${app.server.tomcat.dir}" />
<if>
<not>
<available file="${app.server.parent.dir}/${app.server.tomcat.zip.name}" />
</not>
<then>
<mkdir dir="${app.server.parent.dir}" />
<mirrors-get
dest="${app.server.parent.dir}/${app.server.tomcat.zip.name}"
src="${app.server.tomcat.zip.url}"
verbose="true"
/>
</then>
</if>
<basename file="${app.server.tomcat.dir}" property="app.server.tomcat.dir.name" />
<unzip
dest="${app.server.parent.dir}"
src="${app.server.parent.dir}/${app.server.tomcat.zip.name}"
>
<patternset
excludes="apache-tomcat-${app.server.tomcat.version}/temp/**,apache-tomcat-${app.server.tomcat.version}/webapps/**"
/>
<mapper
from="apache-tomcat-${app.server.tomcat.version}/*"
to="${app.server.tomcat.dir.name}/*"
type="glob"
/>
</unzip>
<mkdir dir="${app.server.tomcat.dir}/webapps" />