root/trunk/build/buildwar.xml

Revision 1178 (checked in by douglm, 6 years ago)

Upgrade ical4j (requires commons-lang)

Ensure a timezone is set in the dtstart object when calling RecurUtil? so that all instances are created when UNTIL is specified

Fix webclient struts-config so that exports work again

Line 
1 <?xml version="1.0"?>
2
3 <!-- ===================================================================
4      This file is called by other build files to create web applications.
5
6      It is assumed that no changes will be made to this file. It should be
7      possible to make all changes needed by modifying the configuration
8      properties or a bedework.build.proeprties file
9
10      An unwrapped web application will be built in the temp directory
11      and a war and ear file will be left in the dist directory.
12
13      Properties which must be defined on entry, apart from those described
14      in the main build file are:
15     app.root.dir       Location of the root directory for the apps
16     app.sou.dir        Location of the application skeleton,
17     app.name           Name of the application. This wil be used to determine
18                        the name of the file containing the rest of the
19                        application properties, the directory we build in
20                        and the name of war and ear files.
21     cal.j2ee           Defined if this is a j2ee application
22     cal.j2ee.jboss     Defined if this is a jboss application
23     cal.strutsapp      Defined if this is a struts application
24      These should be defined in the build properties for the application.
25
26      It is possible to define any of the app.dest properties below to override
27      the location of destination files.
28
29      In the directory
30         ${apps.sou.dir}
31      we expect an application skeleton formatted like a web-application
32      For the purposes of this build it should contain a
33      structure like
34               war - docs    (contains jsp and html for this app)
35                     WEB-INF - struts-config.xml
36                               web.xml
37                               jboss-web.xml (for jboss only)
38
39      Authors: Mike Douglass   douglm@rpi.edu
40      =================================================================== -->
41
42 <project name="bedework.buildwar" default="build" >
43   <target name="init" depends="init.common,init.j2ee,init.standalone" />
44
45   <target name="init.common">
46     <!-- Load the location of the libraries -->
47     <property file="${org.bedework.project.bedework}/build/libjars.properties" />
48
49     <!-- Destinations - where we build an unwrapped war -->
50     <property name="app.dest.war"
51               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
52     <property name="app.dest.docs"
53               location="${app.dest.war}/docs" />
54     <property name="app.dest.webinf"
55               location="${app.dest.war}/WEB-INF" />
56     <property name="app.dest.metainf"
57               location="${app.dest.war}/META-INF" />
58     <property name="app.dest.classes"
59               location="${app.dest.webinf}/classes" />
60     <property name="app.dest.properties"
61               location="${app.dest.classes}/properties/calendar" />
62
63     <!--temp web.xml location  -->
64     <property name="app.dest.web.xml"
65               location="${app.dest.webinf}/web.xml" />
66
67     <property name="app.war.file"
68               location="${dist.home}/${propval.app.war.name}.war" />
69
70     <!-- default web.xml -->
71     <property name="propval.app.web.xml"
72               value="war/WEB-INF/web.xml" />
73
74               <!--
75     <property name="app.web.xml"
76               location="${propval.app.web.xml}" />
77               -->
78     <resolveFile name="app.web.xml"
79                  file="${propval.app.web.xml}"
80                  base="${app.sou.dir}"/>
81
82     <property name="app.sou.properties"
83               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
84   </target>
85
86   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
87
88     <property name="app.dest.lib"
89               location="${app.dest.webinf}/lib" />
90   </target>
91
92   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
93     <property name="app.dest.lib"
94               location="${org.bedework.temp.dir}/earlib" />
95   </target>
96
97   <target name="build" depends="init">
98     <delete dir="${app.dest.war}" />
99
100     <!-- Add modifed login pages -->
101     <copy todir="${app.dest.docs}/login" failonerror="false" >
102       <fileset dir="${org.bedework.common.resources}/login" />
103       <filterset>
104         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
105       </filterset>
106     </copy>
107
108     <!-- ===============================================================
109          We copy 3 sets of properties.
110
111          First (for struts) are the servlet properties which ends up as
112               classes/servlet.properties
113          Next we copy in a set of generic property files and then with
114          overwrite we copy in a set of base specific files.
115
116          All are updated with new values.
117          =============================================================== -->
118
119     <filterset id="property.filters" >
120       <!--      Global settings            -->
121       <filter token="BW-APP-NAME"
122               value="${org.bedework.deploy.name}"/>
123
124       <filter token="HIBERNATE-DIALECT"
125               value="${org.bedework.global.hibernate.dialect}" />
126
127       <filter token="DIRECTORY-BROWSING-DISALLOWED"
128               value="${org.bedework.global.directory.browsing.disallowed}" />
129
130       <filter token="PORTAL-PLATFORM"
131               value="${org.bedework.global.portal.platform}"/>
132
133       <filter token="SERVLET-CLASS"
134               value="${org.bedework.global.servlet.class}"/>
135
136       <filter token="PORTLET-SERVLET-CLASS"
137               value="${org.bedework.global.portlet-servlet.class}"/>
138
139       <filter token="PORTAL-SERVLET-CONTEXT-PROVIDER"
140               value="${org.bedework.global.portal-servlet.context.provider}"/>
141
142       <filter token="PORTLET-CLASS"
143               value="${org.bedework.global.portlet.class}"/>
144
145       <filter token="IGNORE-CONTENT-TYPE"
146               value="${org.bedework.global.ignoreContentType}" />
147
148       <filter token="GENURL-TAGLIB-TLD"
149               value="${org.bedework.global.genurl.taglib.tld}"/>
150
151       <filter token="LIFERAY-COMPANY-ID"
152               value="${org.bedework.global.liferay.company-id}"/>
153
154       <!--      Application settings            -->
155
156       <filter token="APP-DESCRIPTION"
157               value="${propval.app.description}" />
158
159       <filter token="PORTLET-NAME"
160               value="${propval.app.portlet.name}"/>
161
162       <filter token="CAL-SUITE"
163               value="${propval.app.cal.suite}"/>
164
165       <filter token="SECURITY-DOMAIN"
166               value="${propval.app.security.domain}"/>
167       <filter token="SECURITY-PREFIX"
168               value="${propval.app.security.prefix}"/>
169       <filter token="TRANSPORT-GUARANTEE"
170               value="${propval.app.transport.guarantee}"/>
171
172       <filter token="DISPLAY-NAME"
173               value="${propval.app.display.name}"/>
174       <filter token="CONTEXT-ROOT"
175               value="${propval.app.context.root}" />
176       <filter token="APP-NAME"
177               value="${propval.app.name}"/>
178       <filter token="APP-VERSION"
179               value="${propval.app.version}"/>
180       <filter token="WAR-NAME"
181               value="${propval.app.war.name}"/>
182       <filter token="TOMCAT-DOC-BASE"
183               value="${org.bedework.appserver.dir}${propval.app.deploy.dir}/${propval.app.war.name}"/>
184
185       <filter token="DEFAULT-CONTENTTYPE"
186               value="${propval.app.default.contenttype}" />
187       <filter token="NOXSLT"
188               value="${propval.app.noxslt}" />
189       <filter token="APPLICATION-ROOT"
190               value="${propval.app.root}" />
191
192       <filter token="APP-GUESTMODE"
193               value="${propval.app.guestmode}" />
194
195       <!-- Change this to be an app par -->
196       <filter token="RUN-AS-USER"
197               value="${org.bedework.syspar.public.user}" />
198
199               <!-- ???????
200       <filter token="CALFILE-NAME"
201               value="${propval.app.calfile.name}" /> -->
202       <filter token="ADMIN-URI"
203               value="${org.bedework.global.public.admin.uri}" />
204       <filter token="PUBEVENTS-URI"
205               value="${org.bedework.global.public.calendar.uri}" />
206       <filter token="PERSONAL-URI"
207               value="${org.bedework.global.personal.calendar.uri}" />
208     </filterset>
209
210     <available file="${app.sou.dir}/properties" type="dir"
211                property="org.bedework.properties.dir.exists" />
212
213     <available file="${app.sou.properties}" type="file"
214                property="org.bedework.servlet.properties.exists" />
215
216     <available file="${app.sou.dir}/war/docs" type="dir"
217                property="org.bedework.war.docs.exists" />
218
219     <antcall target="copy.properties" inheritRefs="true" />
220     <antcall target="copy.servlet.properties" inheritRefs="true" />
221     <antcall target="copy.war.docs" inheritRefs="true" />
222
223     <!-- Create the env.properties file -->
224     <mkdir dir="${app.dest.properties}" />
225
226     <copy tofile="${app.dest.properties}/env.properties"
227           file="${org.bedework.config.properties}" />
228
229     <copy tofile="${app.dest.properties}/options.xml"
230           file="${org.bedework.config.options}" >
231       <filterset>
232         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
233       </filterset>
234       <filterset refid="property.filters" />
235     </copy>
236
237     <!-- Make a modified copy of the web.xml file -->
238     <copy tofile="${app.dest.web.xml}"
239           file="${app.web.xml}"
240           overwrite="yes" >
241       <filterset>
242         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
243       </filterset>
244       <filterset refid="property.filters" />
245     </copy>
246
247     <antcall target="struts-stuff" inheritRefs="true" />
248
249     <!-- ===============================================================
250          Add hibernate jars and property files from calendar api.
251          =============================================================== -->
252
253     <copy todir="${app.dest.classes}">
254       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
255       <filterset refid="property.filters" />
256     </copy>
257
258     <copy todir="${app.dest.classes}">
259       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
260       <filterset refid="property.filters" />
261     </copy>
262
263     <copy todir="${app.dest.lib}">
264       <fileset dir="${hibernate.jars.dir}">
265         <include name="*.jar"/>
266       </fileset>
267     </copy>
268
269     <antcall target="jboss-stuff" inheritRefs="true" />
270     <antcall target="bexchange-stuff" inheritRefs="true" />
271     <antcall target="domino-stuff" inheritRefs="true" />
272     <antcall target="google-stuff" inheritRefs="true" />
273
274     <!-- ===============================================================
275          Any jar files required
276          =============================================================== -->
277
278     <copy todir="${app.dest.lib}" overwrite="yes">
279       <fileset dir="${bin.home}">
280         <!-- jars from sub-projects needed by all -->
281         <include name="rpiaccess*.jar"/>
282         <include name="rpiutil*.jar"/>
283         <include name="bw-davdefs*.jar"/>
284         <include name="bw-davio*.jar"/>
285
286         <!-- Calendar api jars -->
287         <include name="bw-apiutil*.jar"/>
288         <include name="bw-calcore*.jar"/>
289         <include name="bw-calcorei*.jar"/>
290         <include name="bw-calenv*.jar"/>
291         <include name="bw-calfacade*.jar"/>
292         <include name="bw-calsvc*.jar"/>
293         <include name="bw-calsvci*.jar"/>
294         <include name="bw-icalendar*.jar"/>
295         <include name="bw-locale*.jar"/>
296         <include name="bw-logging*.jar"/>
297
298         <!-- Common jars for web apps -->
299         <include name="bw-appcommon*.jar"/>
300       </fileset>
301     </copy>
302
303      <!-- any extra bin files-->
304     <copy todir="${app.dest.lib}" >
305       <fileset refid="app.bin.files" />
306     </copy>
307
308     <!-- Some more standard libs -->
309     <if>
310       <not>
311         <isset property="org.bedework.build.for.jboss"/>
312       </not>
313       <then>
314         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
315       </then>
316     </if>
317     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
318     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
319     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
320     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
321     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
322     <copy todir="${app.dest.lib}" file="${commons-httpclient.jar}"/>
323     <copy todir="${app.dest.lib}" file="${commons-lang.jar}"/>
324     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
325
326
327     <!-- add the jdbcdriver if defined -->
328     <antcall target="add.jdbcdriver" inheritRefs="true" />
329
330     <!-- tomcat -->
331     <antcall target="add.tomcat" inheritRefs="true" />
332
333      <!-- any extra lib files-->
334     <copy todir="${app.dest.lib}" >
335       <fileset refid="app.lib.files" />
336       <!-- <fileset refid="app.temp.lib.files" /> -->
337     </copy>
338
339     <!-- build the war file -->
340     <mkdir dir="${dist.home}" />
341     <delete file="${app.war.file}" />
342
343     <war warfile="${app.war.file}"
344          webxml="${app.dest.web.xml}"
345          basedir="${app.dest.war}"
346          excludes="WEB-INF/web.xml" />
347
348     <!-- build the ear file for a j2ee app
349     <antcall target="build.ear" inheritRefs="true" />
350     -->
351   </target>
352
353   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
354     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
355   </target>
356
357   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
358     <property name="propval.app.tomcat.context.xml"
359               location="${app.sou.dir}/war/META-INF/context.xml" />
360     <resolveFile name="app.tomcat.context.xml"
361                  file="${propval.app.tomcat.context.xml}"
362                  base="${app.sou.dir}"/>
363
364     <copy tofile="${app.dest.metainf}/context.xml"
365           file="${app.tomcat.context.xml}"
366           overwrite="yes" >
367       <filterset refid="property.filters" />
368     </copy>
369   </target>
370
371   <target name="copy.properties" if="org.bedework.properties.dir.exists">
372     <!-- ===============================================================
373          Any property files we need for configuration, other than the
374          standard struts file, should be in the "${app.sou.dir}/properties
375          directory. They will be copied into the appropriate place for the
376          war and transformed by the above filter.
377          =============================================================== -->
378     <copy todir="${app.dest.properties}" overwrite="yes" >
379       <fileset dir="${app.sou.dir}/properties"
380                includes="*.properties"/>
381       <filterset refid="property.filters" />
382     </copy>
383   </target>
384
385   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
386     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
387       <filterset refid="property.filters" />
388     </copy>
389   </target>
390
391   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
392     <copy todir="${app.dest.docs}">
393       <fileset dir="${app.sou.dir}/war/docs" />
394     </copy>
395   </target>
396
397   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
398     <copy tofile="${app.dest.properties}/timezones.xml"
399           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
400   </target>
401
402   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
403     <copy tofile="${app.dest.properties}/timezones.xml"
404           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
405   </target>
406
407   <target name="google-stuff" if="org.bedework.build.caldav.google">
408     <copy todir="${app.dest.lib}">
409       <fileset dir="${google.dir}">
410         <include name="*.jar"/>
411       </fileset>
412     </copy>
413
414     <copy tofile="${app.dest.properties}/timezones.xml"
415           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
416   </target>
417
418   <!-- =================================================================
419        If this is a struts app the following gets executed.
420        We create an updated struts-config.xml file and add some jars.
421        ================================================================= -->
422
423   <target name="struts-stuff" if="org.bedework.strutsapp">
424     <!-- Copy a dummy startup file into the war. -->
425     <copy todir="${app.dest.war}">
426       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
427     </copy>
428
429     <copy todir="${app.dest.webinf}"
430           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
431
432     <mkdir  dir="${app.dest.webinf}/tlds"/>
433     <copy todir="${app.dest.webinf}/tlds" >
434       <fileset dir="${struts.tlds.dir}">
435         <include name="*"/>
436       </fileset>
437     </copy>
438     <copy todir="${app.dest.webinf}/tlds" >
439       <fileset dir="${org.bedework.default.lib}/tlds">
440         <include name="*"/>
441       </fileset>
442     </copy>
443
444     <if>
445       <not>
446         <isset property="xalan.in.tomcat.common.endorsed" />
447       </not>
448       <then>
449         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
450       </then>
451     </if>
452
453     <if>
454       <isset property="org.bedework.global.portal.platform" />
455       <then>
456         <!-- Add common portlet files -->
457
458         <copy todir="${app.dest.lib}" >
459           <fileset dir="${portals-bridges.jars.dir}">
460             <include name="*.jar"/>
461           </fileset>
462         </copy>
463
464         <!-- Use generic bedework portlet tld -->
465         <copy todir="${app.dest.webinf}/tlds"
466               overwrite="yes"
467               failonerror="no" >
468           <fileset dir="${app.root.dir}/resources/portlet" >
469             <include name="*.tld"/>
470           </fileset>
471         </copy>
472
473         <copy todir="${app.dest.webinf}"
474               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
475               overwrite="yes"
476               failonerror="no" />
477
478         <copy todir="${app.dest.webinf}"
479               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
480               overwrite="yes"
481               failonerror="no" >
482           <filterset refid="property.filters" />
483         </copy>
484
485         <!-- Add the portal bridge controller def -->
486         <replace file="${app.dest.webinf}/struts-config.xml">
487           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
488           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
489                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
490           </replacevalue>
491         </replace>
492
493         <replace file="${app.dest.webinf}/web.xml">
494           <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
495         </replace>
496       </then>
497     </if>
498     <antcall target="add.jetspeed2" inheritRefs="true" />
499     <antcall target="add.uportal2" inheritRefs="true" />
500     <antcall target="add.liferay4" inheritRefs="true" />
501
502     <copy todir="${app.dest.lib}">
503       <fileset dir="${struts.dir}">
504         <include name="*.jar"/>
505       </fileset>
506     </copy>
507
508     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
509     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
510     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
511     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
512     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
513     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
514     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
515   </target>
516
517   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
518     <copy todir="${app.dest.webinf}/tlds" >
519       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
520         <include name="*.tld"/>
521       </fileset>
522     </copy>
523   </target>
524
525   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
526     <copy todir="${app.dest.lib}" >
527       <fileset dir="${bin.home}">
528         <include name="bw-uportal*.jar"/>
529       </fileset>
530     </copy>
531
532     <!-- Add the portlet servlet mapping -->
533     <replace file="${app.dest.webinf}/web.xml">
534       <replacetoken><![CDATA[<!-- uPortal2 portlet servlet mapping here -->]]></replacetoken>
535       <replacevalue><![CDATA[<servlet-mapping>
536     <servlet-name>@PORTLET-NAME@</servlet-name>
537     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
538   </servlet-mapping>]]>
539       </replacevalue>
540     </replace>
541
542   </target>
543
544   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
545    <!-- Add liferay config files -->
546     <copy todir="${app.dest.webinf}" >
547       <fileset dir="${app.sou.dir}/war/WEB-INF" >
548         <include name="liferay*"/>
549       </fileset>
550       <filterset refid="property.filters" />
551     </copy>
552
553     <copy todir="${app.dest.lib}" >
554       <fileset dir="${bin.home}">
555         <include name="bw-liferay*.jar"/>
556       </fileset>
557     </copy>
558
559     <!-- Add the portlet servlet mapping -->
560     <replace file="${app.dest.webinf}/web.xml">
561       <replacetoken><![CDATA[<!-- liferay4 portlet servlet mapping here -->]]></replacetoken>
562       <replacevalue><![CDATA[<listener>
563     <listener-class>
564       com.liferay.portal.servlet.PortletContextListener
565     </listener-class>
566   </listener>
567   <servlet-mapping>
568     <servlet-name>@PORTLET-NAME@</servlet-name>
569     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
570   </servlet-mapping>]]>
571       </replacevalue>
572     </replace>
573   </target>
574
575   <!-- =================================================================
576        If this is a j2ee app the following gets executed.
577        We create an uodated jboss-web.xml file (for jboss) and a ear
578        ================================================================= -->
579
580   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
581     <copy todir="${app.dest.webinf}"
582           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
583       <filterset refid="property.filters" />
584     </copy>
585     <antcall target="jboss-virtual-host" inheritRefs="true" />
586   </target>
587
588   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
589     <replace file="${app.dest.webinf}/jboss-web.xml">
590       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
591       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
592       ]]>
593       </replacevalue>
594     </replace>
595     <replace file="${app.dest.webinf}/jboss-web.xml">
596       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
597     </replace>
598   </target>
599
600   <target name="build.ear" if="cal.j2ee">
601     <ant antfile="${buildear}"
602          inheritRefs="true" target="build" />
603   </target>
604 </project>
Note: See TracBrowser for help on using the browser.