root/trunk/bedework/build/buildwar.xml

Revision 956 (checked in by douglm, 7 years ago)

Add missing files

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