root/trunk/calendar3/bldfiles/buildwar.xml

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

Fixes to personal client.
Use ArrayList? instead of Vector

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 build.properties
8      and app.properties files of the individual applications.
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                        appsuite or uwcalapps probably
17     app.sou.dir        Location of the application skeleton, e.g.
18                        appsuite/admin
19     app.name           Name of the application. This wil be used to determine
20                        the name of the file containing the rest of the
21                        application properties, the directory we build in
22                        and the name of war and ear files.
23     cal.j2ee           Defined if this is a j2ee application
24     cal.j2ee.jboss     Defined if this is a jboss application
25     cal.strutsapp      Defined if this is a struts application
26      These should be defined in the build properties for the application.
27
28      It is possible to define any of the app.dest properties below to override
29      the location of destination files.
30
31      In the directory
32         ${apps.sou.dir}
33      we expect an application skeleton formatted like a web-application
34      For the purposes of this build it should contain a
35      structure like
36               war - docs    (contains jsp and html for this app)
37                     WEB-INF - struts-config.xml
38                               web.xml
39                               jboss-web.xml (for jboss only)
40
41      Authors: Mike Douglass   douglm@rpi.edu
42      =================================================================== -->
43
44 <project name="uwcal.buildwar" default="build" >
45   <target name="init" depends="init.common,init.j2ee,init.standalone" />
46
47   <target name="init.common">
48     <condition property="org.bedework.build.for.jetspeed2">
49       <equals arg1="jetspeed2" arg2="${propval.portal.platform}"/>
50     </condition>
51
52     <condition property="org.bedework.build.for.jboss">
53       <equals arg1="jboss" arg2="${org.bedework.global.j2ee.platform}"/>
54     </condition>
55
56     <!-- Destinations - where we build an unwrapped war -->
57     <property name="app.dest.war"
58               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
59     <property name="app.dest.docs"
60               location="${app.dest.war}/docs" />
61     <property name="app.dest.webinf"
62               location="${app.dest.war}/WEB-INF" />
63     <property name="app.dest.classes"
64               location="${app.dest.webinf}/classes" />
65     <property name="app.dest.properties"
66               location="${app.dest.classes}/properties/calendar" />
67
68     <!--temp web.xml location  -->
69     <property name="app.dest.web.xml"
70               location="${app.dest.webinf}/web.xml" />
71
72     <property name="app.war.file"
73               location="${dist.home}/${propval.app.war.name}.war" />
74
75     <!-- These may have been set already -->
76     <property name="app.web.xml"
77               value="${app.sou.dir}/war/WEB-INF/web.xml" />
78     <property name="app.sou.properties"
79               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
80   </target>
81
82   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
83     <property name="app.dest.lib"
84               location="${app.dest.webinf}/lib" />
85   </target>
86
87   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
88     <property name="app.dest.lib"
89               location="${org.bedework.temp.home}/earlib" />
90   </target>
91
92   <target name="build" depends="init">
93     <delete dir="${app.dest.war}" />
94
95     <!-- Add modifed login pages -->
96     <copy todir="${app.dest.docs}/login" failonerror="false" >
97       <fileset dir="${app.root.dir}/resources/login" />
98       <filterset>
99         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
100       </filterset>
101     </copy>
102
103     <!-- ===============================================================
104          We copy 3 sets of properties.
105
106          First (for struts) are the servlet properties which ends up as
107               classes/servlet.properties
108          Next we copy in a set of generic property files and then with
109          overwrite we copy in a set of base specific files.
110
111          All are updated with new values.
112          =============================================================== -->
113
114     <filterset id="property.filters" >
115       <filter token="BW-APP-NAME"
116               value="${org.bedework.deploy.name}"/>
117
118       <filter token="HIBERNATE-DIALECT"
119               value="${org.bedework.global.hibernate.dialect}" />
120
121       <filter token="DIRECTORY-BROWSING-DISALLOWED"
122               value="${org.bedework.global.directory.browsing.disallowed}" />
123
124       <filter token="APP-DESCRIPTION"
125               value="${propval.app.description}" />
126
127       <filter token="SECURITY-DOMAIN"
128               value="${propval.app.security.domain}"/>
129       <filter token="SECURITY-PREFIX"
130               value="${propval.app.security.prefix}"/>
131       <filter token="TRANSPORT-GUARANTEE"
132               value="${propval.app.transport.guarantee}"/>
133
134       <filter token="DISPLAY-NAME"
135               value="${propval.app.display.name}"/>
136       <filter token="CONTEXT-ROOT"
137               value="${propval.app.context.root}" />
138       <filter token="APP-NAME"
139               value="${propval.app.name}"/>
140       <filter token="APP-VERSION"
141               value="${propval.app.version}"/>
142
143       <filter token="DEFAULT-CONTENTTYPE"
144               value="${propval.app.default.contenttype}" />
145       <filter token="NOXSLT"
146               value="${propval.app.noxslt}" />
147
148       <filter token="APP-GUESTMODE"
149               value="${propval.app.guestmode}" />
150
151       <!-- Change this to be an app par -->
152       <filter token="RUN-AS-USER"
153               value="${org.bedework.syspar.public.user}" />
154
155               <!-- ???????
156       <filter token="CALFILE-NAME"
157               value="${propval.app.calfile.name}" /> -->
158       <filter token="ADMIN-URI"
159               value="${org.bedework.global.public.admin.uri}" />
160       <filter token="PUBEVENTS-URI"
161               value="${org.bedework.global.public.calendar.uri}" />
162       <filter token="PERSONAL-URI"
163               value="${org.bedework.global.personal.calendar.uri}" />
164     </filterset>
165
166     <available file="${app.sou.dir}/properties" type="dir"
167                property="uwcal.properties.dir.exists" />
168
169     <available file="${app.sou.properties}" type="file"
170                property="uwcal.servlet.properties.exists" />
171
172     <available file="${app.sou.dir}/war/docs" type="dir"
173                property="uwcal.war.docs.exists" />
174
175     <antcall target="copy.properties" inheritRefs="true" />
176     <antcall target="copy.servlet.properties" inheritRefs="true" />
177     <antcall target="copy.war.docs" inheritRefs="true" />
178
179     <!-- Create the env.properties file -->
180     <mkdir dir="${app.dest.properties}" />
181
182     <copy tofile="${app.dest.properties}/env.properties"
183           file="${org.bedework.config.properties}" />
184
185     <!-- Make a modified copy of the web.xml file -->
186     <copy tofile="${app.dest.web.xml}"
187           file="${app.web.xml}"
188           overwrite="yes" >
189       <filterset>
190         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
191       </filterset>
192       <filterset refid="property.filters" />
193     </copy>
194
195     <antcall target="struts-stuff" inheritRefs="true" />
196
197     <!-- ===============================================================
198          Add hibernate jars and property files.
199          =============================================================== -->
200
201     <copy todir="${app.dest.classes}">
202       <fileset dir="${org.bedework.core.base}/resources/properties" />
203       <filterset refid="property.filters" />
204     </copy>
205
206     <copy todir="${app.dest.classes}">
207       <fileset dir="${org.bedework.core.base}/resources/hbms" />
208       <filterset refid="property.filters" />
209     </copy>
210
211     <copy todir="${app.dest.lib}">
212       <fileset dir="${hibernate.jars.dir}">
213         <include name="*.jar"/>
214       </fileset>
215     </copy>
216
217     <antcall target="jboss-stuff" inheritRefs="true" />
218
219     <!-- ===============================================================
220          Any jar files required
221          =============================================================== -->
222
223     <!-- core files -->
224     <copy todir="${app.dest.lib}" file="${org.bedework.calcore.jar}" />
225     <copy todir="${app.dest.lib}" file="${org.bedework.calenv.jar}" />
226     <copy todir="${app.dest.lib}" file="${org.bedework.mail.jar}" />
227     <copy todir="${app.dest.lib}" file="${org.bedework.calfacadeshared.jar}" />
228
229       <!-- appcommon -->
230     <copy todir="${app.dest.lib}" file="${org.bedework.locale.jar}" />
231     <copy todir="${app.dest.lib}" file="${org.bedework.access.jar}" />
232     <copy todir="${app.dest.lib}" file="${org.bedework.calsvci.jar}" />
233     <copy todir="${app.dest.lib}" file="${org.bedework.calsvc.jar}" />
234     <copy todir="${app.dest.lib}" file="${org.bedework.ical.jar}" />
235     <copy todir="${app.dest.lib}" file="${org.bedework.common.jar}" />
236     <copy todir="${app.dest.lib}" file="${org.bedework.appcommon.jar}" />
237     <copy todir="${app.dest.lib}" file="${org.bedework.webcommon.jar}" />
238
239     <!-- Some more standard libs -->
240     <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
241     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
242
243     <!-- add the jdbcdriver if defined -->
244     <antcall target="add.jdbcdriver" inheritRefs="true" />
245
246      <!-- any extra -->
247     <copy todir="${app.dest.lib}" >
248       <fileset refid="app.lib.files" />
249       <fileset refid="app.temp.lib.files" />
250     </copy>
251
252     <!-- build the war file -->
253     <mkdir dir="${dist.home}" />
254     <delete file="${app.war.file}" />
255
256     <war warfile="${app.war.file}"
257          webxml="${app.dest.web.xml}"
258          basedir="${app.dest.war}"
259          excludes="${app.dest.web.xml}" />
260
261     <!-- build the ear file for a j2ee app
262     <antcall target="build.ear" inheritRefs="true" />
263     -->
264   </target>
265
266   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
267     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
268   </target>
269
270   <target name="copy.properties" if="uwcal.properties.dir.exists">
271     <!-- ===============================================================
272          Any property files we need for configuration, other than the
273          standard struts file, should be in the "${app.sou.dir}/properties
274          directory. They will be copied into the appropriate place for the
275          war and transformed by the above filter.
276          =============================================================== -->
277     <copy todir="${app.dest.properties}" overwrite="yes" >
278       <fileset dir="${app.sou.dir}/properties"
279                includes="*.properties"/>
280       <filterset refid="property.filters" />
281     </copy>
282   </target>
283
284   <target name="copy.servlet.properties" if="uwcal.servlet.properties.exists">
285     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
286       <filterset refid="property.filters" />
287     </copy>
288   </target>
289
290   <target name="copy.war.docs" if="uwcal.war.docs.exists">
291     <copy todir="${app.dest.docs}">
292       <fileset dir="${app.sou.dir}/war/docs" />
293     </copy>
294   </target>
295
296   <!-- =================================================================
297        If this is a struts app the following gets executed.
298        We create an updated struts-config.xml file and add some jars.
299        ================================================================= -->
300
301   <target name="struts-stuff" if="org.bedework.strutsapp">
302     <!-- Copy a dummy startup file into the war. -->
303     <copy todir="${app.dest.war}">
304       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
305     </copy>
306
307     <copy todir="${app.dest.webinf}"
308           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
309
310     <mkdir  dir="${app.dest.webinf}/tlds"/>
311     <copy todir="${app.dest.webinf}/tlds" >
312       <fileset dir="${struts.tlds.dir}">
313         <include name="*"/>
314       </fileset>
315     </copy>
316
317     <antcall target="add.xalan" inheritRefs="true" />
318     <antcall target="add.jetspeed2" inheritRefs="true" />
319
320     <copy todir="${app.dest.lib}">
321       <fileset dir="${struts.dir}">
322         <include name="*.jar"/>
323       </fileset>
324     </copy>
325   </target>
326
327   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
328     <copy todir="${app.dest.webinf}"
329           file="${org.bedework.portal.resources.dir}/jetspeed2/${propval.app.war.name}/portlet.xml"
330           overwrite="yes"
331           failonerror="no" />
332     <copy todir="${app.dest.webinf}"
333           file="${org.bedework.portal.resources.dir}/jetspeed2/struts-portlet-config.xml"
334           overwrite="yes"
335           failonerror="no" />
336
337     <copy todir="${app.dest.lib}" >
338       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
339         <include name="*.jar"/>
340       </fileset>
341     </copy>
342
343     <copy todir="${app.dest.webinf}/tlds" >
344       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
345         <include name="*.tld"/>
346       </fileset>
347     </copy>
348
349     <!-- Overwrite the web.xml file -->
350     <copy tofile="${app.dest.web.xml}"
351           file="${org.bedework.portal.resources.dir}/jetspeed2/web.xml"
352           overwrite="yes" >
353       <filterset>
354         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
355       </filterset>
356       <filterset refid="property.filters" />
357     </copy>
358
359     <!-- Add the portal bridge controller def -->
360     <replace file="${app.dest.webinf}/struts-config.xml">
361       <replacetoken><![CDATA[<!-- Jetspeed2 controller def here -->]]></replacetoken>
362       <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
363               processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
364       </replacevalue>
365     </replace>
366   </target>
367
368   <target name="add.xalan" unless="xalan.in.tomcat.common.endorsed" >
369     <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
370   </target>
371
372   <!-- =================================================================
373        If this is a j2ee app the following gets executed.
374        We create an uodated jboss-web.xml file (for jboss) and a ear
375        ================================================================= -->
376
377   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
378     <copy todir="${app.dest.webinf}"
379           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
380       <filterset refid="property.filters" />
381     </copy>
382     <antcall target="jboss-virtual-host" inheritRefs="true" />
383   </target>
384
385   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
386     <replace file="${app.dest.webinf}/jboss-web.xml">
387       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
388       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
389       ]]>
390       </replacevalue>
391     </replace>
392     <replace file="${app.dest.webinf}/jboss-web.xml">
393       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
394     </replace>
395   </target>
396
397   <target name="build.ear" if="cal.j2ee">
398     <ant antfile="${buildear}"
399          inheritRefs="true" target="build" />
400   </target>
401
402 </project>
Note: See TracBrowser for help on using the browser.