root/trunk/build/buildwar.xml

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

Revert to previous version of ical4j. Latest appears to have timezone issues

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="SECOND-LEVEL-CACHING"
128               value="${org.bedework.global.hibernate.cache.use_second_level_cache}" />
129
130       <filter token="CACHE-PROVIDER"
131               value="${org.bedework.global.hibernate.cache.provider_class}" />
132
133       <filter token="DIRECTORY-BROWSING-DISALLOWED"
134               value="${org.bedework.global.directory.browsing.disallowed}" />
135
136       <filter token="PORTAL-PLATFORM"
137               value="${org.bedework.global.portal.platform}"/>
138
139       <filter token="SERVLET-CLASS"
140               value="${org.bedework.global.servlet.class}"/>
141
142       <filter token="PORTLET-SERVLET-CLASS"
143               value="${org.bedework.global.portlet-servlet.class}"/>
144
145       <filter token="PORTAL-SERVLET-CONTEXT-PROVIDER"
146               value="${org.bedework.global.portal-servlet.context.provider}"/>
147
148       <filter token="PORTLET-CLASS"
149               value="${org.bedework.global.portlet.class}"/>
150
151       <filter token="IGNORE-CONTENT-TYPE"
152               value="${org.bedework.global.ignoreContentType}" />
153
154       <filter token="GENURL-TAGLIB-TLD"
155               value="${org.bedework.global.genurl.taglib.tld}"/>
156
157       <filter token="LIFERAY-COMPANY-ID"
158               value="${org.bedework.global.liferay.company-id}"/>
159
160       <!--      Application settings            -->
161
162       <filter token="APP-DESCRIPTION"
163               value="${propval.app.description}" />
164
165       <filter token="PORTLET-NAME"
166               value="${propval.app.portlet.name}"/>
167
168       <filter token="CAL-SUITE"
169               value="${propval.app.cal.suite}"/>
170
171       <filter token="SECURITY-DOMAIN"
172               value="${propval.app.security.domain}"/>
173       <filter token="SECURITY-PREFIX"
174               value="${propval.app.security.prefix}"/>
175       <filter token="TRANSPORT-GUARANTEE"
176               value="${propval.app.transport.guarantee}"/>
177
178       <filter token="DISPLAY-NAME"
179               value="${propval.app.display.name}"/>
180       <filter token="CONTEXT-ROOT"
181               value="${propval.app.context.root}" />
182       <filter token="APP-NAME"
183               value="${propval.app.name}"/>
184       <filter token="APP-VERSION"
185               value="${propval.app.version}"/>
186       <filter token="WAR-NAME"
187               value="${propval.app.war.name}"/>
188       <filter token="TOMCAT-DOC-BASE"
189               value="${org.bedework.appserver.dir}${propval.app.deploy.dir}/${propval.app.war.name}"/>
190
191       <filter token="DEFAULT-CONTENTTYPE"
192               value="${propval.app.default.contenttype}" />
193       <filter token="NOXSLT"
194               value="${propval.app.noxslt}" />
195       <filter token="APPLICATION-ROOT"
196               value="${propval.app.root}" />
197
198       <filter token="APP-GUESTMODE"
199               value="${propval.app.guestmode}" />
200
201       <!-- Change this to be an app par -->
202       <filter token="RUN-AS-USER"
203               value="${org.bedework.syspar.public.user}" />
204
205               <!-- ???????
206       <filter token="CALFILE-NAME"
207               value="${propval.app.calfile.name}" /> -->
208       <filter token="ADMIN-URI"
209               value="${org.bedework.global.public.admin.uri}" />
210       <filter token="PUBEVENTS-URI"
211               value="${org.bedework.global.public.calendar.uri}" />
212       <filter token="PERSONAL-URI"
213               value="${org.bedework.global.personal.calendar.uri}" />
214     </filterset>
215
216     <available file="${app.sou.dir}/properties" type="dir"
217                property="org.bedework.properties.dir.exists" />
218
219     <available file="${app.sou.properties}" type="file"
220                property="org.bedework.servlet.properties.exists" />
221
222     <available file="${app.sou.dir}/war/docs" type="dir"
223                property="org.bedework.war.docs.exists" />
224
225     <antcall target="copy.properties" inheritRefs="true" />
226     <antcall target="copy.servlet.properties" inheritRefs="true" />
227     <antcall target="copy.war.docs" inheritRefs="true" />
228
229     <!-- Create the env.properties file -->
230     <mkdir dir="${app.dest.properties}" />
231
232     <copy tofile="${app.dest.properties}/env.properties"
233           file="${org.bedework.config.properties}" />
234
235     <copy tofile="${app.dest.properties}/options.xml"
236           file="${org.bedework.config.options}" >
237       <filterset>
238         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
239       </filterset>
240       <filterset refid="property.filters" />
241     </copy>
242
243     <!-- Make a modified copy of the web.xml file -->
244     <copy tofile="${app.dest.web.xml}"
245           file="${app.web.xml}"
246           overwrite="yes" >
247       <filterset>
248         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
249       </filterset>
250       <filterset refid="property.filters" />
251     </copy>
252
253     <antcall target="struts-stuff" inheritRefs="true" />
254
255     <!-- ===============================================================
256          Add hibernate jars and property files from calendar api.
257          =============================================================== -->
258
259     <copy todir="${app.dest.classes}">
260       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
261       <filterset refid="property.filters" />
262     </copy>
263
264     <copy todir="${app.dest.classes}">
265       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
266       <filterset refid="property.filters" />
267     </copy>
268
269     <copy todir="${app.dest.lib}">
270       <fileset dir="${hibernate.jars.dir}">
271         <include name="*.jar"/>
272       </fileset>
273     </copy>
274
275     <antcall target="jboss-stuff" inheritRefs="true" />
276     <antcall target="bexchange-stuff" inheritRefs="true" />
277     <antcall target="domino-stuff" inheritRefs="true" />
278     <antcall target="google-stuff" inheritRefs="true" />
279
280     <!-- ===============================================================
281          Any jar files required
282          =============================================================== -->
283
284     <copy todir="${app.dest.lib}" overwrite="yes">
285       <fileset dir="${bin.home}">
286         <!-- jars from sub-projects needed by all -->
287         <include name="rpiaccess*.jar"/>
288         <include name="rpiutil*.jar"/>
289         <include name="bw-davdefs*.jar"/>
290         <include name="bw-davio*.jar"/>
291
292         <!-- Calendar api jars -->
293         <include name="bw-apiutil*.jar"/>
294         <include name="bw-calcore*.jar"/>
295         <include name="bw-calcorei*.jar"/>
296         <include name="bw-calenv*.jar"/>
297         <include name="bw-calfacade*.jar"/>
298         <include name="bw-calsvc*.jar"/>
299         <include name="bw-calsvci*.jar"/>
300         <include name="bw-icalendar*.jar"/>
301         <include name="bw-locale*.jar"/>
302         <include name="bw-logging*.jar"/>
303
304         <!-- Common jars for web apps -->
305         <include name="bw-appcommon*.jar"/>
306       </fileset>
307     </copy>
308
309      <!-- any extra bin files-->
310     <copy todir="${app.dest.lib}" >
311       <fileset refid="app.bin.files" />
312     </copy>
313
314     <!-- Some more standard libs -->
315     <if>
316       <not>
317         <isset property="org.bedework.build.for.jboss"/>
318       </not>
319       <then>
320         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
321       </then>
322     </if>
323     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
324     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
325     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
326     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
327     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
328     <copy todir="${app.dest.lib}" file="${commons-httpclient.jar}"/>
329     <copy todir="${app.dest.lib}" file="${commons-lang.jar}"/>
330     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
331
332
333     <!-- add the jdbcdriver if defined -->
334     <antcall target="add.jdbcdriver" inheritRefs="true" />
335
336     <!-- tomcat -->
337     <antcall target="add.tomcat" inheritRefs="true" />
338
339      <!-- any extra lib files-->
340     <copy todir="${app.dest.lib}" >
341       <fileset refid="app.lib.files" />
342       <!-- <fileset refid="app.temp.lib.files" /> -->
343     </copy>
344
345     <!-- build the war file -->
346     <mkdir dir="${dist.home}" />
347     <delete file="${app.war.file}" />
348
349     <war warfile="${app.war.file}"
350          webxml="${app.dest.web.xml}"
351          basedir="${app.dest.war}"
352          excludes="WEB-INF/web.xml" />
353
354     <!-- build the ear file for a j2ee app
355     <antcall target="build.ear" inheritRefs="true" />
356     -->
357   </target>
358
359   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
360     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
361   </target>
362
363   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
364     <property name="propval.app.tomcat.context.xml"
365               location="${app.sou.dir}/war/META-INF/context.xml" />
366     <resolveFile name="app.tomcat.context.xml"
367                  file="${propval.app.tomcat.context.xml}"
368                  base="${app.sou.dir}"/>
369
370     <copy tofile="${app.dest.metainf}/context.xml"
371           file="${app.tomcat.context.xml}"
372           overwrite="yes" >
373       <filterset refid="property.filters" />
374     </copy>
375   </target>
376
377   <target name="copy.properties" if="org.bedework.properties.dir.exists">
378     <!-- ===============================================================
379          Any property files we need for configuration, other than the
380          standard struts file, should be in the "${app.sou.dir}/properties
381          directory. They will be copied into the appropriate place for the
382          war and transformed by the above filter.
383          =============================================================== -->
384     <copy todir="${app.dest.properties}" overwrite="yes" >
385       <fileset dir="${app.sou.dir}/properties"
386                includes="*.properties"/>
387       <filterset refid="property.filters" />
388     </copy>
389   </target>
390
391   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
392     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
393       <filterset refid="property.filters" />
394     </copy>
395   </target>
396
397   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
398     <copy todir="${app.dest.docs}">
399       <fileset dir="${app.sou.dir}/war/docs" />
400     </copy>
401   </target>
402
403   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
404     <copy tofile="${app.dest.properties}/timezones.xml"
405           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
406   </target>
407
408   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
409     <copy tofile="${app.dest.properties}/timezones.xml"
410           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
411   </target>
412
413   <target name="google-stuff" if="org.bedework.build.caldav.google">
414     <copy todir="${app.dest.lib}">
415       <fileset dir="${google.dir}">
416         <include name="*.jar"/>
417       </fileset>
418     </copy>
419
420     <copy tofile="${app.dest.properties}/timezones.xml"
421           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
422   </target>
423
424   <!-- =================================================================
425        If this is a struts app the following gets executed.
426        We create an updated struts-config.xml file and add some jars.
427        ================================================================= -->
428
429   <target name="struts-stuff" if="org.bedework.strutsapp">
430     <!-- Copy a dummy startup file into the war. -->
431     <copy todir="${app.dest.war}">
432       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
433     </copy>
434
435     <copy todir="${app.dest.webinf}"
436           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
437
438     <mkdir  dir="${app.dest.webinf}/tlds"/>
439     <copy todir="${app.dest.webinf}/tlds" >
440       <fileset dir="${struts.tlds.dir}">
441         <include name="*"/>
442       </fileset>
443     </copy>
444     <copy todir="${app.dest.webinf}/tlds" >
445       <fileset dir="${org.bedework.default.lib}/tlds">
446         <include name="*"/>
447       </fileset>
448     </copy>
449
450     <if>
451       <not>
452         <isset property="xalan.in.tomcat.common.endorsed" />
453       </not>
454       <then>
455         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
456       </then>
457     </if>
458
459     <if>
460       <isset property="org.bedework.global.portal.platform" />
461       <then>
462         <!-- Add common portlet files -->
463
464         <copy todir="${app.dest.lib}" >
465           <fileset dir="${portals-bridges.jars.dir}">
466             <include name="*.jar"/>
467           </fileset>
468         </copy>
469
470         <!-- Use generic bedework portlet tld -->
471         <copy todir="${app.dest.webinf}/tlds"
472               overwrite="yes"
473               failonerror="no" >
474           <fileset dir="${app.root.dir}/resources/portlet" >
475             <include name="*.tld"/>
476           </fileset>
477         </copy>
478
479         <copy todir="${app.dest.webinf}"
480               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
481               overwrite="yes"
482               failonerror="no" />
483
484         <copy todir="${app.dest.webinf}"
485               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
486               overwrite="yes"
487               failonerror="no" >
488           <filterset refid="property.filters" />
489         </copy>
490
491         <!-- Add the portal bridge controller def -->
492         <replace file="${app.dest.webinf}/struts-config.xml">
493           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
494           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
495                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
496           </replacevalue>
497         </replace>
498
499         <replace file="${app.dest.webinf}/web.xml">
500           <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
501         </replace>
502       </then>
503     </if>
504     <antcall target="add.jetspeed2" inheritRefs="true" />
505     <antcall target="add.uportal2" inheritRefs="true" />
506     <antcall target="add.liferay4" inheritRefs="true" />
507
508     <copy todir="${app.dest.lib}">
509       <fileset dir="${struts.dir}">
510         <include name="*.jar"/>
511       </fileset>
512     </copy>
513
514     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
515     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
516     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
517     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
518     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
519     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
520     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
521   </target>
522
523   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
524     <copy todir="${app.dest.webinf}/tlds" >
525       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
526         <include name="*.tld"/>
527       </fileset>
528     </copy>
529   </target>
530
531   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
532     <copy todir="${app.dest.lib}" >
533       <fileset dir="${bin.home}">
534         <include name="bw-uportal*.jar"/>
535       </fileset>
536     </copy>
537
538     <!-- Add the portlet servlet mapping -->
539     <replace file="${app.dest.webinf}/web.xml">
540       <replacetoken><![CDATA[<!-- uPortal2 portlet servlet mapping here -->]]></replacetoken>
541       <replacevalue><![CDATA[<servlet-mapping>
542     <servlet-name>@PORTLET-NAME@</servlet-name>
543     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
544   </servlet-mapping>]]>
545       </replacevalue>
546     </replace>
547
548   </target>
549
550   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
551    <!-- Add liferay config files -->
552     <copy todir="${app.dest.webinf}" >
553       <fileset dir="${app.sou.dir}/war/WEB-INF" >
554         <include name="liferay*"/>
555       </fileset>
556       <filterset refid="property.filters" />
557     </copy>
558
559     <copy todir="${app.dest.lib}" >
560       <fileset dir="${bin.home}">
561         <include name="bw-liferay*.jar"/>
562       </fileset>
563     </copy>
564
565     <!-- Add the portlet servlet mapping -->
566     <replace file="${app.dest.webinf}/web.xml">
567       <replacetoken><![CDATA[<!-- liferay4 portlet servlet mapping here -->]]></replacetoken>
568       <replacevalue><![CDATA[<listener>
569     <listener-class>
570       com.liferay.portal.servlet.PortletContextListener
571     </listener-class>
572   </listener>
573   <servlet-mapping>
574     <servlet-name>@PORTLET-NAME@</servlet-name>
575     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
576   </servlet-mapping>]]>
577       </replacevalue>
578     </replace>
579   </target>
580
581   <!-- =================================================================
582        If this is a j2ee app the following gets executed.
583        We create an uodated jboss-web.xml file (for jboss) and a ear
584        ================================================================= -->
585
586   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
587     <copy todir="${app.dest.webinf}"
588           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
589       <filterset refid="property.filters" />
590     </copy>
591     <antcall target="jboss-virtual-host" inheritRefs="true" />
592   </target>
593
594   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
595     <replace file="${app.dest.webinf}/jboss-web.xml">
596       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
597       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
598       ]]>
599       </replacevalue>
600     </replace>
601     <replace file="${app.dest.webinf}/jboss-web.xml">
602       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
603     </replace>
604   </target>
605
606   <target name="build.ear" if="cal.j2ee">
607     <ant antfile="${buildear}"
608          inheritRefs="true" target="build" />
609   </target>
610 </project>
Note: See TracBrowser for help on using the browser.