forked from alkacon/opencms-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
780 lines (657 loc) · 31.6 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="OpenCms" default="bindist" basedir=".">
<property file="${basedir}/xbuild.properties" />
<property file="${basedir}/build-default.properties" />
<property name="version.number" value="8.5.1.1" />
<property name="java.target.version" value="1.6" />
<property name="version.usecommitid" value="false" />
<property name="app.name" value="opencms" />
<property name="src.all.comps" value="lib,modules,src-components,src-gwt,src-modules,src-setup,test,webapp" />
<property name="opencms.input" location="${basedir}" />
<property name="opencms.output" location="${basedir}/../BuildCms" />
<property name="opencms.build" location="${opencms.output}/build" />
<property name="opencms.output.classes" location="${opencms.output}/build/classes-core" />
<property name="opencms.output.tests" location="${opencms.output}/build/test" />
<property name="opencms.output.jars" location="${opencms.output}/build/jars-core" />
<property name="opencms.output.jars-components" location="${opencms.output}/build/jars-components" />
<property name="opencms.output.warfiles" location="${opencms.output}/build/${app.name}" />
<property name="opencms.output.distfiles" location="${opencms.output}/zip" />
<property name="databases" value="as400,db2,derby,empress,firebird,hsqldb,informix,ingres,interbase,intersystemscache,jdatastore,mssql,mysql,oracle,postgresql,sybase" />
<!-- <property name="databases" value="mysql" /> -->
<property name="opencms.input.warfiles" location="${opencms.input}/webapp" />
<property name="opencms.input.webinf" location="${opencms.input.warfiles}/WEB-INF" />
<property name="opencms.input.libs.runtime" location="${opencms.input}/lib/runtime" />
<property name="opencms.input.libs.compile" location="${opencms.input}/lib/compile" />
<property name="opencms.input.libs.db.base" location="${opencms.input.warfiles}/setup/database" />
<property name="opencms.input.defaultconfiguration" location="${opencms.input.warfiles}/WEB-INF/config/opencms.properties" />
<property name="opencms.input.default.registry" location="${opencms.input.warfiles}/WEB-INF/config/registry.xml" />
<property name="opencms.input.default.config" location="${opencms.input.warfiles}/WEB-INF/config/opencms.xml" />
<property name="opencms.input.default.system" location="${opencms.input.warfiles}/WEB-INF/config/opencms-system.xml" />
<property name="drivers.vfs" value="db" />
<property name="drivers.project" value="db" />
<property name="drivers.user" value="db" />
<property name="drivers.history" value="db" />
<property name="drivers.subscription" value="db" />
<property name="db.additional.pools" value="" />
<property name="drivers.configuration" value="" />
<property name="registry.configuration" value="" />
<property name="opencms.configuration" value="" />
<property name="system.runtimeinfo" value="org.opencms.db.CmsDbContextFactory" />
<property name="excludes" value="**/CVS/*,**/.nbattrs,**/.project,**/.classpath" />
<property environment="env" />
<property name="enhance" value="1" />
<!-- comma separated list of jar archives to be removed during update -->
<!-- comma separated list of files in WEB-INF/ to be updated -->
<property name="updater.webinf.files" value="opencms.tld,web.xml,cmsshell.sh,classes/META-INF/persistence.xml,classes/ehcache.xml,classes/repository.properties,sun-jaxws.xml" />
<path id="opencms.input.libs.all">
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef resource="net/sf/antcontrib/antlib.xml" loaderref="contrib">
<classpath>
<pathelement location="${opencms.input.libs.compile}/ant-contrib-1.0b1.jar" />
</classpath>
</taskdef>
<taskdef resource="checkstyletask.properties"
classpathref="opencms.input.libs.all"/>
<target name="init-components">
<mkdir dir="${opencms.output.jars-components}" />
<timestampselector property="mostRecentComponent">
<path>
<fileset dir="${opencms.output.jars-components}" />
</path>
</timestampselector>
<echo level="verbose">Most recent component: ${mostRecentComponent}</echo>
<uptodate property="componentsUpToDate" targetfile="mostRecentComponent">
<srcfiles dir="${opencms.input}/src-components" includes="**/*.java" excludes="${build.excludes},${excludes}" />
<srcfiles dir="${opencms.input}/src-components" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
</uptodate>
<antcall target="compile-components" />
<taskdef resource="org/opencms/util/ant/taskdefs.properties" loaderref="opencms">
<classpath>
<pathelement location="${opencms.output.jars-components}/ant-opencms.jar" />
<pathelement location="${opencms.input.libs.runtime}/commons-digester-1.8.jar" />
<pathelement location="${opencms.input.libs.runtime}/commons-logging-1.1.1.jar" />
<pathelement location="${opencms.input.libs.runtime}/commons-collections-3.2.1.jar" />
<pathelement location="${opencms.input.libs.runtime}/commons-beanutils-1.8.3.jar" />
<pathelement location="${opencms.input.libs.runtime}/dom4j-1.6.1.jar" />
<pathelement location="${opencms.input.libs.runtime}/jaxen-1.1.1.jar" />
<pathelement location="${opencms.input.libs.runtime}/jug-lgpl-2.0.0.jar" />
</classpath>
</taskdef>
</target>
<target name="compile-components" unless="componentsUpToDate" description="Builds the OpenCms components">
<!-- build ant-opencms.jar -->
<ant dir="${opencms.input}/src-components" />
</target>
<!--
- Checks if all required libraries are available
-->
<target name="initrevision" depends="init-components">
<if>
<isset property="env.GIT_COMMIT" />
<then>
<if>
<istrue value="${version.usecommitid}" />
<then>
<echo message="Git commit id available: ${env.GIT_COMMIT}." />
<propertyregex property="revisionshort" input="${env.GIT_COMMIT}" regexp="^(........)" select="\1" casesensitive="false" />
<echo message="Shortened id: ${revisionshort}." />
<property name="version.revision" value="${version.number}.${revisionshort}" />
</then>
</if>
</then>
</if>
<!-- In case version.revision has not been set we set it now,
as ant properties are immutable we are not going to override any previous setting. -->
<property name="version.revision" value="${version.number}" />
</target>
<target name="init" depends="initrevision">
<!-- this is a comment -->
<condition property="tomcat.home" value="${env.TOMCAT_HOME}">
<available file="${env.TOMCAT_HOME}" type="dir" />
</condition>
<condition property="tomcat.home" value="${env.CATALINA_HOME}">
<available file="${env.CATALINA_HOME}" type="dir" />
</condition>
<echo message="Building OpenCms ${version.revision}" />
<echo message=" " />
<echo message="OpenCms input directory is: ${opencms.input}" />
<echo message="OpenCms output directory is: ${opencms.output}" />
<echo message="Java version detected: ${ant.java.version}" />
<echo message="Java target version: ${java.target.version}" />
<echo message="Java home is: ${env.JAVA_HOME}" />
<echo message="Tomcat home is: ${tomcat.home}" />
</target>
<target name="initmodulenames" depends="initrevision">
<property file="${opencms.input}/modules/all-modules.properties" />
<var name="modules.common.collect" value="${modules.common.all}" />
<if>
<isset property="externaldirectories" />
<then>
<for list="${externaldirectories}" param="exdir">
<sequential>
<var name="modules.common.all" unset="true" />
<property file="@{exdir}/modules/all-modules.properties" />
<var name="modules.common.collect" value="${modules.common.collect},${modules.common.all}" />
</sequential>
</for>
</then>
</if>
<var name="modules.common.all" unset="true" />
<property name="modules.common.all" value="${modules.common.collect}" />
</target>
<target name="clean" description="Delete existing output directories">
<delete dir="${opencms.output.tests}" />
<delete dir="${opencms.output.warfiles}" />
<delete dir="${opencms.output}/build" />
<delete dir="${opencms.output.distfiles}" />
</target>
<target name="generate-schema">
<taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask" />
<for list="${databases}" param="db">
<sequential>
<if>
<and>
<available file="${basedir}/webapp/setup/database/@{db}/create_tables.sql" />
<not>
<equals arg1="mssql" arg2="@{db}" />
</not>
</and>
<then>
<property file="${basedir}/webapp/setup/database/@{db}/database.properties" />
<echo message="DRIVER: ${@{db}.driver}" />
<mappingtool schemaAction="build" readSchema="false" sqlFile="${basedir}/webapp/setup/database/@{db}/create_tables_gen.sql" >
<config ConnectionDriverName="${@{db}.driver}" propertiesFile="${basedir}/persistence.xml" />
</mappingtool>
</then>
</if>
</sequential>
</for>
</target>
<target name="compile" depends="init" description="Compile the OpenCms classes">
<mkdir dir="${opencms.output.classes}" />
<uptodate property="classesUpToDate" targetfile="${opencms.output.jars}/opencms.jar">
<srcfiles dir="${opencms.input}/src" includes="**/*.java" excludes="${build.excludes},${excludes}" />
<srcfiles dir="${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
</uptodate>
<javac srcdir="${opencms.input}/src" destdir="${opencms.output.classes}" debug="on" optimize="on" deprecation="on" source="1.5" target="${java.target.version}">
<classpath>
<pathelement location="${opencms.output.jars-components}/gwt-opencms.jar" />
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
<exclude name="**/gwt-user*.jar" />
<exclude name="**/gwt-dev*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</classpath>
<!-- compilerarg value="-Xlint:unchecked"/ -->
</javac>
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="opencms.input.libs.all" />
<!-- invoke OpenJPA enhancer on all .class files below the persistence directory -->
<if>
<equals arg1="${enhance}" arg2="1" />
<then>
<echo message="Enhancing entity classes !!!" />
<openjpac>
<fileset dir="${opencms.output.classes}/org/opencms/db/jpa/persistence">
<include name="*.class" />
<exclude name="*$*.class" />
</fileset>
<classpath>
<pathelement location="${opencms.output.classes}" />
<path refid="opencms.input.libs.all" />
</classpath>
<config propertiesFile="${opencms.input}/webapp/WEB-INF/classes/META-INF/persistence.xml" />
</openjpac>
</then>
</if>
<copy todir="${opencms.output.classes}">
<fileset dir="${opencms.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
</copy>
<antcall target="versioninfo" />
</target>
<!--
- Generate version information files
-->
<target name="versioninfo" unless="classesUpToDate">
<copy file="${opencms.input.warfiles}/WEB-INF/setupdata/version.properties" tofile="${opencms.output.classes}/org/opencms/main/version.properties" overwrite="true">
<filterset>
<filter token="OPENCMS_VERSION_NUMBER" value="${version.revision}" />
<filter token="OPENCMS_VERSION_NAME" value="${version.name}" />
</filterset>
</copy>
<copy file="${opencms.input.warfiles}/setup/versions.txt" tofile="${opencms.output.classes}/versions.txt" overwrite="true">
<filterset>
<filter token="OPENCMS_VERSION" value="OpenCms ${version.revision}" />
</filterset>
</copy>
<copy file="${opencms.input.warfiles}/setup/license.html" tofile="${opencms.output.classes}/license.html" overwrite="true">
<filterset>
<filter token="OPENCMS_VERSION_NUMBER" value="${version.revision}" />
<filter token="OPENCMS_VERSION_NAME" value="${version.name}" />
</filterset>
</copy>
<copy file="${opencms.input.defaultconfiguration}" tofile="${opencms.output.classes}/opencms.properties" overwrite="true">
<filterset>
<filter token="DRIVERS_VFS" value="${drivers.vfs}" />
<filter token="DRIVERS_PROJECT" value="${drivers.project}" />
<filter token="DRIVERS_USER" value="${drivers.user}" />
<filter token="DRIVERS_HISTORY" value="${drivers.history}" />
<filter token="DRIVERS_CONFIGURATION" value="${drivers.configuration}" />
<filter token="DRIVERS_SUBSCRIPTION" value="${drivers.subscription}" />
<filter token="ADDITIONAL_DB_POOLS" value="${db.additional.pools}" />
</filterset>
</copy>
<copy file="${opencms.input.default.config}" tofile="${opencms.output.classes}/opencms.xml" overwrite="true">
<filterset>
<filter token="OPENCMS_CONFIGURATION" value="${opencms.configuration}" />
</filterset>
</copy>
<copy file="${opencms.input.default.system}" tofile="${opencms.output.classes}/opencms-system.xml" overwrite="true">
<filterset>
<filter token="RUNTIME_INFO" value="${system.runtimeinfo}" />
</filterset>
</copy>
</target>
<target name="jar" depends="compile" description="Generate the OpenCms .jar files">
<mkdir dir="${opencms.output.jars}" />
<jar jarfile="${opencms.output.jars}/opencms.jar" basedir="${opencms.output.classes}" includes="org/opencms/**,com/**">
<metainf dir="${opencms.input.warfiles}/WEB-INF" includes="opencms.tld" />
</jar>
</target>
<!--
Set/Override this property to one of the following values:
- interactive: interactive GUI based module selection.
- selection: module selection based on modules.common.selection property
- all: module selection based on modules.common.all property defined in the all-modules.properties file
-->
<property name="modules.selection.mode" value="interactive" />
<target name="build.updater" depends="setup-jar" description="Generates a distributable updater zip file">
<property file="${basedir}/modules/all-modules.properties" />
<echo message="all: ${basedir}/modules" />
<if>
<not>
<isset property="modules.common.all" />
</not>
<then>
<fail>
property modules.common.all undefined.
</fail>
</then>
</if>
<sortlist property="modules.all.sort" value="${modules.common.all}" override="true" />
<echo message="all: ${modules.all.sort}" />
<property name="modules.var" value="${modules.all.sort}" />
<ant antfile="${basedir}/modules/build.xml" target="dist" inheritAll="false">
<property name="modules.selection.mode" value="selection" />
<property name="modules.common.selection" value="${modules.var}" />
</ant>
<delete failonerror="no" file="${opencms.output.distfiles}/opencms_upgrade_to_${version.revision}.zip" />
<for list="${updater.jars.remove}" param="jarfile" delimiter="," trim="yes">
<sequential>
<copy file="${opencms.input.warfiles}/update/empty.jar" tofile="${opencms.output}/build/jars-core/@{jarfile}" />
</sequential>
</for>
<copy todir="${opencms.output.jars}" flatten="true">
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</copy>
<property name="zip.update" value="${opencms.output}/updatezip" />
<delete dir="${zip.update}" />
<mkdir dir="${zip.update}/update/modules" />
<mkdir dir="${zip.update}/update/WEB-INF/lib" />
<for list="${modules.var}" param="module" trim="yes">
<sequential>
<!-- skip some unwanted modules -->
<if>
<not>
<or>
<equals arg1="@{module}" arg2="org.opencms.legacy.compatibility" />
<equals arg1="@{module}" arg2="org.opencms.workplace.demos" />
<equals arg1="@{module}" arg2="org.opencms.workplace.demos.list" />
<equals arg1="@{module}" arg2="org.opencms.workplace.demos.widget" />
<equals arg1="@{module}" arg2="com.alkacon.opencms.v8.template3.demo" />
<equals arg1="@{module}" arg2="org.opencms.dev.demo.content" />
<equals arg1="@{module}" arg2="org.opencms.welcome" />
</or>
</not>
<then>
<copy todir="${zip.update}/update/modules">
<fileset dir="${opencms.output.distfiles}" includes="@{module}_*.zip" />
</copy>
<if>
<available file="${opencms.output}/build/jars-@{module}" />
<then>
<copy todir="${zip.update}/WEB-INF/lib">
<fileset dir="${opencms.output}/build/jars-@{module}" includes="@{module}.jar" />
</copy>
</then>
</if>
<if>
<available file="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" />
<then>
<copy todir="${zip.update}/WEB-INF/lib">
<fileset dir="${opencms.input}/modules/@{module}/resources/system/modules/@{module}/lib" includes="*.jar" />
</copy>
</then>
</if>
</then>
</if>
</sequential>
</for>
<delete file="${opencms.output.distfiles}/opencms_upgrade_to_${version.revision}.zip" failonerror="false" />
<zip zipfile="${opencms.output.distfiles}/opencms_upgrade_to_${version.revision}.zip" update="true">
<zipfileset dir="${opencms.input.webinf}" prefix="WEB-INF" includes="${updater.webinf.files}" />
<zipfileset dir="${opencms.input.webinf}/wsdl" prefix="WEB-INF/wsdl" includes="*" />
<zipfileset dir="${opencms.input.warfiles}" includes="update/**" excludes="update/empty.jar,update/readme.txt" />
<zipfileset dir="${opencms.input.warfiles}" includes="update/readme.txt" fullpath="readme.txt" />
<zipfileset dir="${opencms.input.libs.runtime}" prefix="WEB-INF/lib" includes="*.jar" />
<zipfileset dir="${opencms.output}/build/jars-core/" prefix="WEB-INF/lib" includes="*.jar" />
<zipfileset dir="${zip.update}" includes="**/*" />
</zip>
</target>
<target name="war" depends="setup-jar" description="Builds the opencms.war">
<delete failonerror="no" file="${opencms.output}/build/${app.name}.war" />
<copy todir="${opencms.output.jars}" flatten="true">
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</copy>
<war destfile="${opencms.output}/build/${app.name}.war" webxml="${opencms.input.warfiles}/WEB-INF/web.xml" manifest="${opencms.input.warfiles}/META-INF/MANIFEST.MF">
<lib dir="${opencms.output.jars}">
<include name="*.jar" />
</lib>
<lib dir="${opencms.input.libs.runtime}">
<include name="*.jar" />
</lib>
<fileset dir="${opencms.input.warfiles}">
<exclude name="WEB-INF/web.xml" />
<exclude name="WEB-INF/config/opencms.properties" />
<exclude name="WEB-INF/config/opencms-system.xml" />
<exclude name="WEB-INF/config/opencms.xml" />
<exclude name="WEB-INF/config/registry.xml" />
<exclude name="setup/versions.txt" />
<exclude name="setup/license.html" />
<exclude name="setup/database/**/*.jar" />
<exclude name="update/**" />
<exclude name="build.xml,.*,${excludes}" />
</fileset>
<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.properties" />
<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms-system.xml" />
<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="registry.xml" />
<zipfileset dir="${opencms.output.classes}" prefix="WEB-INF/config" includes="opencms.xml" />
<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="versions.txt" />
<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
<zipfileset dir="${opencms.output.classes}" prefix="setup" includes="license.html" />
</war>
</target>
<target name="tomcat.copy" depends="jar" description="Copy updated files to Tomcat directorys">
<copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
</copy>
<copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
<fileset dir="${opencms.output.jars}">
<include name="*.jar" />
</fileset>
</copy>
<copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${tomcat.home}/webapps/${app.name}/WEB-INF" />
<copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${tomcat.home}/webapps/${app.name}/WEB-INF" />
</target>
<target name="tomcat.update" depends="setup-jar, tomcat.copy" description="Recompile changed classes and install in Tomcat webapps directory" />
<target name="show-time">
<tstamp>
<format property="time" pattern="hh:mm" />
</tstamp>
<echo message="Time: ${time}" />
</target>
<target name="tomcat.all" depends="clean, tomcat.update" description="Do a complete recompile of all classes and install in Tomcat webapps directory" />
<target name="jboss.copy" description="Copy updated files to JBoss directory">
<copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
</copy>
<copy todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF/lib">
<fileset dir="${opencms.output.jars}">
<include name="*.jar" />
</fileset>
</copy>
<copy file="${opencms.input.warfiles}/WEB-INF/web.xml" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF" />
<copy file="${opencms.input.warfiles}/WEB-INF/opencms.tld" todir="${jboss.home}/server/default/deploy/${app.name}.war/WEB-INF" />
</target>
<target name="jboss.update" depends="setup-jar, jboss.copy" description="Recompile changed classes and install in JBoss deploy directory" />
<target name="bindist" depends="clean, initrevision, initmodulenames" description="Creates a binary distribution ZIP, including the templateone demopages">
<!-- read list of all available modules is now done through target 'initmodulenames'-->
<!-- remove org.opencms.workplace.demos modules -->
<var name="modules.common.selection" unset="true" />
<for list="${modules.common.all}" param="module" trim="yes">
<sequential>
<propertyregex property="pack.name" input="@{module}" regexp="org\.opencms\.workplace\.demos([^\.]*)" select="\1" casesensitive="false" />
<if>
<not>
<isset property="pack.name" />
</not>
<then>
<if>
<isset property="modules.common.selection" />
<then>
<var name="modules.common.selection" value="${modules.common.selection},@{module}" />
</then>
<else>
<var name="modules.common.selection" value="@{module}" />
</else>
</if>
</then>
</if>
<var name="pack.name" unset="true" />
</sequential>
</for>
<echo>${modules.common.selection}</echo>
<!-- build war with selected modules -->
<ant antfile="${opencms.input}/modules/build.xml" target="war" inheritAll="false">
<property name="modules.common.selection" value="${modules.common.selection}" />
<property name="modules.selection.mode" value="selection" />
<property name="app.name" value="${app.name}" />
</ant>
<!-- build distro -->
<mkdir dir="${opencms.output.distfiles}" />
<zip destfile="${opencms.output.distfiles}/opencms_${version.revision}.zip">
<zipfileset dir="${opencms.output}/build" includes="${app.name}.war" />
<zipfileset dir="${opencms.input}" includes="install.html,license.txt,history.txt" />
</zip>
</target>
<target name="srcdist" depends="initrevision" description="Creates a source distribution ZIP">
<echo message="Building OpenCms ${app.name} source distribution " />
<echo message=" " />
<echo message="OpenCms input directory is: ${opencms.input}" />
<echo message="OpenCms output directory is: ${opencms.output}" />
<selectionprompt property="src.comps" defaultvalue="${src.all.comps}" allvalues="${src.all.comps}" prompt="Please select the additional source components to include:" title="Additional Source Components Selection" columns="1" />
<mkdir dir="${opencms.output.distfiles}" />
<delete file="${opencms.output.distfiles}/${app.name}_${version.revision}_src.zip" failonerror="no" />
<zip destfile="${opencms.output.distfiles}/${app.name}_${version.revision}_src.zip">
<zipfileset dir="${opencms.input}/src" excludes="${excludes}" prefix="src" />
<zipfileset dir="${opencms.input}" includes="build.xml,install.html,license.txt,history.txt" />
</zip>
<if>
<not>
<equals arg1="${src.comps}" arg2="__ABORT__" />
</not>
<then>
<for list="${src.comps}" param="comp" trim="yes">
<sequential>
<zip destfile="${opencms.output.distfiles}/${app.name}_${version.revision}_src.zip" update="true" whenempty="fail">
<zipfileset dir="${opencms.input}/@{comp}" excludes="${excludes}" prefix="@{comp}" />
</zip>
</sequential>
</for>
</then>
</if>
</target>
<target name="checkstyle"
description="Generates a report of code convention violations.">
<checkstyle config="${basedir}/Checkstyle_OpenCms.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml" tofile="checkstyle_report.xml"/>
<!-- excluding org.opencms.jsp.util.UAgentInfo -->
<fileset dir="src" includes="**/*.java" excludes="**/UAgentInfo.java" />
<fileset dir="src-gwt" includes="**/*.java" excludes="**/super-scr/**/*.java" />
</checkstyle>
<!-- <style in="checkstyle_report.xml" out="checkstyle_report.html" style="checkstyle.xsl"/> -->
</target>
<target name="compile-tests" description="Compile the OpenCms test classes">
<mkdir dir="${opencms.output.tests}" />
<javac srcdir="${opencms.input}/test" destdir="${opencms.output.tests}" excludes="**/data/**" debug="on" optimize="on" deprecation="on" source="1.5" target="${java.target.version}">
<classpath>
<fileset dir="${opencms.output}/build">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${opencms.output.tests}">
<fileset dir="${opencms.input}/test" excludes="${excludes},**/data/**, **/*.java" />
</copy>
<mkdir dir="${opencms.output.tests}/../webapp/" />
<copy todir="${opencms.output.tests}/../webapp/">
<fileset dir="${opencms.input.warfiles}" />
</copy>
<mkdir dir="${opencms.output.tests}/../test/data/" />
<copy todir="${opencms.output.tests}/../test/data/">
<fileset dir="${opencms.input}/test/data" />
</copy>
</target>
<target name="setup-jar" depends="jar" description="Compile the OpenCms setup/updater classes">
<mkdir dir="${opencms.output}/build/setup" />
<javac srcdir="${opencms.input}/src-setup" destdir="${opencms.output}/build/setup" debug="on" optimize="on" deprecation="on" source="1.5" target="${java.target.version}">
<classpath>
<fileset dir="${opencms.output}/build">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
<copy todir="${opencms.output}/build/setup">
<fileset dir="${opencms.input}/src-setup" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
</copy>
<jar jarfile="${opencms.output.jars}/opencms-setup.jar" basedir="${opencms.output}/build/setup" includes="org/opencms/**" />
</target>
<target name="unittests" depends="compile-tests" description="Runs the core Junit test cases">
<junit showoutput="yes" printsummary="yes" fork="yes" haltonfailure="no" haltonerror="no" maxmemory="1500m">
<jvmarg value="-XX:MaxPermSize=512m"/>
<sysproperty key="test.data.path" value="${opencms.input}/test/data" />
<sysproperty key="test.webapp.path" value="${opencms.input}/webapp" />
<sysproperty key="test.build.folder" value="${opencms.output.tests}" />
<classpath>
<pathelement path="${opencms.output.tests}" />
<fileset dir="${opencms.output}/build">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
<exclude name="**/ant.jar" />
<exclude name="**/gwt-dev-*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<test name="org.opencms.test.AllTests" />
</junit>
</target>
<target name="single-unittest" depends="compile-tests" description="Runs the core Junit test cases">
<junit showoutput="yes" printsummary="yes" fork="yes" haltonfailure="no" haltonerror="no">
<sysproperty key="test.data.path" value="${opencms.input}/test/data" />
<sysproperty key="test.webapp.path" value="${opencms.input}/webapp" />
<sysproperty key="test.build.folder" value="${opencms.output.tests}" />
<classpath>
<pathelement path="${opencms.output.tests}" />
<fileset dir="${opencms.output}/build">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.compile}">
<include name="**/*.jar" />
<exclude name="**/ant.jar" />
<exclude name="**/gwt-dev-*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.runtime}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${opencms.input.libs.db.base}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<test name="org.opencms.${test}" />
</junit>
</target>
<property name="signjar.storepass" value="secret" />
<target name="uploadjar" description="Build the upload.jar">
<delete dir="${opencms.output}/upload/" />
<mkdir dir="${opencms.output}/upload/org/opencms/applet/" />
<copy todir="${opencms.output}/upload/org/opencms/applet/">
<fileset dir="${opencms.input}/src-components/org/opencms/applet">
<include name="**/*.png" />
<include name="**/*.gif" />
</fileset>
</copy>
<unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-logging-1.1.1.jar" />
<unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-httpclient-3.1.jar" />
<unjar dest="${opencms.output}/upload/" src="${opencms.input.libs.runtime}/commons-codec-1.3.jar" />
<delete>
<fileset dir="${opencms.output}/upload/">
<include name="**/*.html" />
</fileset>
</delete>
<javac srcdir="${opencms.input}/src-components/org/opencms/applet" destdir="${opencms.output}/upload" debug="on" optimize="on" deprecation="on" source="1.5" target="${java.target.version}">
</javac>
<jar jarfile="${opencms.output}/upload/upload_unsigned.jar" basedir="${opencms.output}/upload/" includes="org/**">
</jar>
<genkey keystore="${opencms.output}/upload/keystore" validity="3650" alias="OpenCms" storepass="${signjar.storepass}">
<dname>
<param name="CN" value="OpenCms Upload Applet" />
<param name="OU" value="opencms.org" />
<param name="O" value="Alkacon Software GmbH" />
<param name="L" value="An der Wachsfabrik 13" />
<param name="S" value="Cologne" />
<param name="C" value="DE" />
</dname>
</genkey>
<signjar signedjar="${opencms.output}/upload/upload.jar" alias="OpenCms" jar="${opencms.output}/upload/upload_unsigned.jar" storepass="${signjar.storepass}" keystore="${opencms.output}/upload/keystore" />
<delete file="${opencms.output}/upload/upload_unsigned.jar" />
<copy todir="${opencms.input}/modules/org.opencms.workplace.explorer/resources/system/workplace/resources/components/upload_applet/" file="${opencms.output}/upload/upload.jar" />
</target>
</project>