forked from Liferay-Patchers-Community/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
649 lines (521 loc) · 18.1 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
<?xml version="1.0"?>
<project name="portal" basedir="." default="compile" xmlns:antelope="antlib:ise.antelope.tasks">
<property name="project.dir" value="." />
<import file="build-common.xml" />
<target name="all">
<antcall target="clean" />
<antcall target="start" />
<antcall target="deploy" />
</target>
<target name="clean">
<ant dir="classes" target="clean" inheritAll="false" />
<ant dir="portal-service" target="clean" inheritAll="false" />
<ant dir="util-bridges" target="clean" inheritAll="false" />
<ant dir="util-java" target="clean" inheritAll="false" />
<ant dir="util-taglib" target="clean" inheritAll="false" />
<ant dir="portal-impl" target="clean" inheritAll="false" />
<ant dir="portal-web" target="clean" inheritAll="false" />
<ant dir="sql" target="clean" inheritAll="false" />
<delete dir="${doc.dir}" />
<delete>
<fileset dir="." includes="*.ear,*.jar,*.war,*.zip" />
</delete>
<delete includeemptydirs="true" failonerror="false">
<fileset
dir="${app.server.bin.dir}"
includes="*.log*"
/>
</delete>
<delete failonerror="false">
<fileset
dir="${liferay.home}/data/hsql"
includes="${database.name}.*"
/>
</delete>
<if>
<equals arg1="${app.server.type}" arg2="glassfish" />
<then>
<delete dir="${app.server.instance.dir}/applications/liferay-portal" />
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="tomcat" />
<then>
<delete failonerror="false">
<fileset
dir="${app.server.dir}/conf/Catalina/localhost"
includes="*-hook.xml,*-portlet.xml"
/>
</delete>
<ant dir="support-tomcat" target="clean" inheritAll="false" />
</then>
</if>
<delete failonerror="false">
<fileset
dir="${app.server.classes.portal.dir}"
includes="portal-*.properties,system-*.properties"
/>
</delete>
<delete includeemptydirs="true" failonerror="false">
<fileset
dir="${app.server.deploy.dir}"
includes="*-ext/**,*-ext.war/**,*-hook/**,*-hook.war/**,*-layouttpl/**,*-layouttpl.war/**,*-portlet/**,*-portlet.war/**,*-theme/**,*-theme.war/**,*-web/**,*-web.war/**"
/>
</delete>
<delete failonerror="false">
<fileset
dir="${app.server.lib.global.dir}"
excludes="${jdbc.drivers}"
/>
</delete>
<delete failonerror="false">
<fileset
dir="${app.server.lib.portal.dir}"
excludes="${jdbc.drivers}"
/>
</delete>
<if>
<equals arg1="${clean.log.dir}" arg2="true" />
<then>
<delete dir="${app.server.log.dir}" />
</then>
</if>
<if>
<not>
<and>
<equals arg1="${app.server.type}" arg2="tomcat" />
<antelope:endswith string="${app.server.portal.dir}" with="/portal-web/docroot" />
</and>
</not>
<then>
<delete dir="${app.server.portal.dir}" />
<delete file="${app.server.portal.dir}" />
</then>
</if>
<if>
<equals arg1="${clean.temp.dir}" arg2="true" />
<then>
<delete dir="${app.server.temp.dir}" />
</then>
</if>
<if>
<equals arg1="${clean.work.dir}" arg2="true" />
<then>
<delete dir="${app.server.work.dir}" />
</then>
</if>
<antcall target="print-current-time" />
</target>
<target name="compile">
<ant dir="portal-service" target="compile" inheritAll="false" />
<ant dir="util-bridges" target="compile" inheritAll="false" />
<ant dir="util-java" target="compile" inheritAll="false" />
<ant dir="util-taglib" target="compile" inheritAll="false" />
<ant dir="portal-impl" target="compile" inheritAll="false" />
</target>
<target name="deploy">
<if>
<or>
<equals arg1="${app.server.type}" arg2="glassfish" />
<equals arg1="${app.server.type}" arg2="websphere" />
</or>
<then>
<delete dir="${app.server.portal.dir}" />
<delete file="${app.server.portal.dir}" />
</then>
</if>
<if>
<and>
<equals arg1="${app.server.type}" arg2="tomcat" />
<not>
<available file="${app.server.tomcat.classes.global.dir}/catalina.jar" />
</not>
</and>
<then>
<fail>
.
Tomcat is not installed in ${app.server.tomcat.dir}. If you already have Tomcat
installed, make sure the property "$${app.server.tomcat.dir}" points to your
Tomcat installation. If you wish to automatically install Tomcat into
${app.server.tomcat.dir}, then run "ant -buildfile build-dist.xml unzip-tomcat".
</fail>
</then>
</if>
<ant dir="portal-service" target="deploy" inheritAll="false" />
<ant dir="util-bridges" target="deploy" inheritAll="false" />
<ant dir="util-java" target="deploy" inheritAll="false" />
<ant dir="util-taglib" target="deploy" inheritAll="false" />
<ant dir="portal-impl" target="deploy" inheritAll="false" />
<ant dir="portal-web" target="deploy" inheritAll="false" />
<copy todir="${liferay.home}/data/hsql">
<fileset dir="sql">
<include name="${database.name}.properties" />
<include name="${database.name}.script" />
</fileset>
</copy>
<antcall target="deploy-properties" />
<copy todir="${app.server.lib.global.dir}">
<fileset dir="lib/development" includes="hsql.jar,jtds.jar,mysql.jar,postgresql.jar" />
<fileset dir="lib/global" />
</copy>
<if>
<isset property="jdbc.drivers.optional.dir" />
<then>
<copy todir="${app.server.lib.global.dir}">
<fileset
dir="${jdbc.drivers.optional.dir}"
includes="*.jar"
/>
</copy>
</then>
</if>
<copy todir="${app.server.lib.portal.dir}">
<fileset dir="lib/portal" />
</copy>
<if>
<equals arg1="${app.server.type}" arg2="jboss" />
<then>
<if>
<not>
<available file="${app.server.lib.global.dir}/module.xml" />
</not>
<then>
<copy
file="tools/servers/jboss/modules/module.xml"
tofile="${app.server.lib.global.dir}/module.xml"
/>
</then>
</if>
<delete>
<fileset
dir="${app.server.lib.portal.dir}"
includes="eclipselink.jar"
/>
</delete>
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="jetty" />
<then>
<if>
<not>
<available file="${app.server.dir}/contexts/root.xml" />
</not>
<then>
<copy
file="tools/servers/jetty/contexts/root.xml"
tofile="${app.server.dir}/contexts/root.xml"
/>
</then>
</if>
<copy todir="${app.server.lib.global.dir}">
<fileset
dir="lib/development"
includes="activation.jar,jta.jar,mail.jar,persistence.jar"
/>
</copy>
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="jonas" />
<then>
<delete>
<fileset
dir="${app.server.lib.portal.dir}"
includes="equinox.jar,osgi.core.jar,xalan.jar,xercesImpl.jar,xml-apis.jar"
/>
</delete>
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="resin" />
<then>
<copy todir="${app.server.lib.global.dir}">
<fileset
dir="lib/development"
includes="saxpath.jar"
/>
</copy>
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="tomcat" />
<then>
<if>
<not>
<available file="${app.server.dir}/conf/Catalina/localhost/${app.server.tomcat.portal.context}.xml" />
</not>
<then>
<copy
file="tools/servers/tomcat/conf/Catalina/localhost/ROOT.xml"
tofile="${app.server.dir}/conf/Catalina/localhost/${app.server.tomcat.portal.context}.xml"
overwrite="true"
/>
</then>
</if>
<ant dir="support-tomcat" target="deploy" inheritAll="false" />
<copy todir="${app.server.lib.endorsed.dir}" flatten="true">
<fileset
dir="lib"
includes="${endorsed.libraries}"
/>
</copy>
<if>
<not>
<equals arg1="${app.server.tomcat.lib.portal.dir}" arg2="${app.server.tomcat.lib.global.dir}" />
</not>
<then>
<delete failonerror="false">
<fileset
dir="${app.server.lib.portal.dir}"
includes="ccpp.jar"
/>
</delete>
</then>
</if>
<copy todir="${app.server.lib.global.dir}">
<fileset
dir="lib/development"
includes="activation.jar,jms.jar,jta.jar,mail.jar,persistence.jar"
/>
</copy>
<copy todir="${app.server.temp.dir}/liferay/com/liferay/portal/deploy/dependencies">
<fileset
dir="lib/development"
includes="resin.jar,script-10.jar"
/>
</copy>
<delete>
<fileset
dir="${app.server.lib.portal.dir}"
includes="tomcat-juli.jar"
/>
</delete>
</then>
</if>
<mkdir dir="${app.server.log.dir}" />
<mkdir dir="${app.server.temp.dir}" />
<mkdir dir="${app.server.work.dir}" />
<if>
<or>
<equals arg1="${app.server.type}" arg2="glassfish" />
<equals arg1="${app.server.type}" arg2="websphere" />
</or>
<then>
<tstamp>
<format property="tstamp.value" pattern="yyyyMMddkkmmssSSS" />
</tstamp>
<jar
basedir="${app.server.portal.dir}"
jarfile="${tstamp.value}"
/>
<delete dir="${app.server.portal.dir}" />
<move file="${tstamp.value}" tofile="${app.server.portal.dir}" />
</then>
</if>
<if>
<equals arg1="${app.server.type}" arg2="websphere" />
<then>
<exec dir="${app.server.websphere.bin.dir}" executable="cmd.exe">
<arg line="/c startServer.bat server1" />
</exec>
<echo>Installing liferay-portal.war.</echo>
<echo file="wsadmin.py">
def isAppInstalled(appName):
appNames = AdminApp.list()
if len(appNames) > 0:
for curAppName in appNames.split('\n'):
curAppName = curAppName.rstrip()
if curAppName.find(appName) >= 0:
return 1
return 0
if isAppInstalled('DefaultApplication'):
print AdminApp.uninstall('DefaultApplication')
print AdminConfig.save()
appManager = AdminControl.queryNames('type=ApplicationManager,process=server1,*')
if isAppInstalled('liferay-portal'):
print AdminControl.invoke(appManager, 'stopApplication', 'liferay-portal')
print AdminApp.update('liferay-portal', 'app', '[-contents ${app.server.websphere.instance.dir}/wsadmin-deploy/liferay-portal.war -contextroot / -operation update]')
else:
print AdminApp.install('${app.server.websphere.instance.dir}/wsadmin-deploy/liferay-portal.war', '[-appname liferay-portal -contextroot /]')
print AdminConfig.save()
print AdminControl.invoke(appManager, 'startApplication', 'liferay-portal')
</echo>
<exec dir="${app.server.websphere.bin.dir}" executable="cmd.exe">
<arg line="/c wsadmin.bat -f ${basedir}\wsadmin.py" />
</exec>
<delete file="wsadmin.py" />
<exec dir="${app.server.websphere.bin.dir}" executable="cmd.exe">
<arg line="/c stopServer.bat server1" />
</exec>
</then>
</if>
<antcall target="print-current-time" />
</target>
<target name="deploy-properties">
<copy todir="${app.server.classes.portal.dir}" overwrite="true">
<fileset dir="portal-impl/src" includes="portal-*.properties,system-*.properties" />
</copy>
</target>
<target name="dist">
<ant antfile="build-dist.xml" target="dist" inheritAll="false" />
</target>
<target name="doc">
<antcall target="dtddoc" />
<antcall target="javadoc" />
<antcall target="javadoc-all" />
<ant dir="util-taglib" target="taglibdoc" inheritAll="false" />
</target>
<target name="dtddoc">
<taskdef classname="DTDDoc.DTDDocTask" classpathref="lib.classpath" name="DTDDoc" />
<!--<antelope:stringutil string="${lp.version}" property="lp.version.dtd">
<replace regex="\." replacement="_" />
</antelope:stringutil>-->
<property name="doc.definitions.dir" value="${doc.dir}/definitions" />
<DTDDoc
destDir="${doc.definitions.dir}"
docTitle = "Liferay ${lp.version} Definitions"
showFixmeTags="false"
showHiddenTags="false"
sourceDir="${definitions.dir}"
>
<include name="liferay-*${lp.version.dtd}.dtd" />
</DTDDoc>
</target>
<target name="jar">
<ant dir="portal-service" target="jar" inheritAll="false" />
<ant dir="util-bridges" target="jar" inheritAll="false" />
<ant dir="util-java" target="jar" inheritAll="false" />
<ant dir="util-taglib" target="jar" inheritAll="false" />
<ant dir="portal-impl" target="jar" inheritAll="false" />
<ant dir="portal-web" target="war" inheritAll="false" />
<ant dir="support-tomcat" target="jar" inheritAll="false" />
</target>
<target name="javadoc">
<property name="doc.java.dir" value="${doc.dir}/javadocs" />
<mkdir dir="${doc.java.dir}" />
<javadoc
breakiterator="yes"
classpathref="project.classpath"
destdir="${doc.java.dir}"
doctitle="Liferay ${lp.version} Public API Documentation"
header="<b>Liferay ${lp.version}</b>"
maxmemory="1024m"
noqualifier="java.*"
overview="portal-service/src/portal-service-overview.html"
stylesheetfile="${project.dir}/tools/javadoc.css"
useexternalfile="yes"
use="yes"
windowtitle="Liferay ${lp.version} API"
>
<doclet name="com.liferay.tools.doclets.standard.Standard" path="${project.dir}/lib/development/liferay-doclet.jar">
<param name="-linksource" />
</doclet>
<group title="Portal Services" packages="com.liferay.portal*:com.liferay.counter*:com.liferay.documentlibrary*:com.liferay.mail*" />
<group title="Portal Kernel" packages="com.liferay.portal.kernel*" />
<group title="Portlet Services" packages="com.liferay.portlet*" />
<group title="Portlet Bridges" packages="com.liferay.util.bridges*" />
<link href="http://docs.liferay.com/portlet-api/2.0/javadocs" />
<link href="http://java.sun.com/javase/6/docs/api" />
<link href="http://docs.liferay.com/portal/${lp.version.major}/javadocs" />
<packageset dir="portal-service/src" />
<packageset dir="util-bridges/src" />
<packageset dir="util-java/src" />
<tag name="generated" description="" />
</javadoc>
</target>
<target name="javadoc-all">
<property name="doc.java.dir" value="${doc.dir}/javadocs-all" />
<mkdir dir="${doc.java.dir}" />
<javadoc
breakiterator="yes"
classpathref="project.classpath"
destdir="${doc.java.dir}"
doctitle="Liferay ${lp.version} Internal API Documentation"
header="<b>Liferay ${lp.version}</b>"
maxmemory="1024m"
noqualifier="java.*"
overview="portal-impl/src/portal-impl-overview.html"
stylesheetfile="${project.dir}/tools/javadoc.css"
useexternalfile="yes"
use="yes"
windowtitle="Liferay ${lp.version} Internal API"
>
<doclet name="com.liferay.tools.doclets.standard.Standard" path="${project.dir}/lib/development/liferay-doclet.jar">
<param name="-linksource" />
</doclet>
<group title="Portal Services" packages="com.liferay.portal.service*" />
<group title="Portlet Services" packages="com.liferay.portlet*" />
<link href="http://docs.liferay.com/portlet-api/2.0/javadocs" />
<link href="http://java.sun.com/javase/6/docs/api" />
<packageset dir="portal-impl/src" />
<packageset dir="portal-service/src" />
<packageset dir="util-bridges/src" />
<packageset dir="util-java/src" />
<packageset dir="util-taglib/src" />
<tag name="generated" description="ServiceBuilder generated this class. Modifications in this class will be overwritten the next time it is generated." />
</javadoc>
</target>
<target name="prepare-generated-files">
<ant antfile="build-dist.xml" target="prepare-generated-files" inheritAll="false" />
</target>
<target name="record-svn-revision">
<exec dir="${project.dir}" executable="cmd.exe" os="${os.windows}" outputproperty="svn.info.output">
<arg line="/c svn info" />
</exec>
<script classpathref="project.classpath" language="beanshell">
String svnInfoOutput = project.getProperty("svn.info.output");
int x = svnInfoOutput.indexOf("Revision: ");
x = svnInfoOutput.indexOf(" ", x);
int y = svnInfoOutput.indexOf("Node ", x);
String revision = svnInfoOutput.substring(x, y).trim();
project.setProperty("svn.info.revision", revision);
</script>
<echo file="svn-revision">Revision: ${svn.info.revision}
Username: ${svn.username}
Password: ${svn.password}
Portal: ${project.dir}
Plugins: ${lp.plugins.dir}</echo>
</target>
<target name="start">
<antcall target="compile" />
<ant dir="util-taglib" target="jar" inheritAll="false" />
<ant dir="sql" target="build-db" inheritAll="false" />
<ant dir="sql" target="rebuild-hypersonic" inheritAll="false" />
<ant dir="portal-impl" target="build-themes" inheritAll="false" />
<antcall target="jar" />
<antcall target="print-current-time" />
</target>
<target name="test">
<ant antfile="build-test.xml" target="test" inheritAll="false" />
</target>
<target name="test-integration">
<ant antfile="build-test.xml" target="test-integration" inheritAll="false" />
</target>
<target name="test-unit">
<ant antfile="build-test.xml" target="test-unit" inheritAll="false" />
</target>
<target name="update-plugins-to-svn-revision">
<loadfile property="svn.info.revision.valid" srcfile="svn-revision" />
<script classpathref="project.classpath" language="beanshell">
String svnInfoOutput = project.getProperty("svn.info.revision.valid");
int x = svnInfoOutput.indexOf("Revision: ");
x = svnInfoOutput.indexOf(" ", x);
int y = svnInfoOutput.indexOf("Username:", x);
String revision = svnInfoOutput.substring(x, y).trim();
project.setProperty("svn.info.revision", revision);
</script>
<exec dir="${lp.plugins.dir}" executable="cmd.exe" os="${os.windows}">
<arg line="/c svn --username ${svn.username} --password ${svn.password} update -r ${svn.info.revision}" />
</exec>
</target>
<target name="validate-xml">
<xmlvalidate failonerror="no">
<fileset dir="${project.dir}"
excludes="**/dependencies/**,**/ehcache/**"
includes="**/liferay-*.xml,**/web.xml"
/>
<xmlcatalog refid="dtd.catalog" />
</xmlvalidate>
</target>
</project>