root/releases/bedework-3.8/build/buildwar.xml

Revision 3462 (checked in by douglm, 1 year ago)

A whole bunch of changes that somehow got missed

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      These should be defined in the build properties for the application.
22
23      It is possible to define any of the app.dest properties below to override
24      the location of destination files.
25
26      In the directory
27         ${apps.sou.dir}
28      we expect an application skeleton formatted like a web-application
29      For the purposes of this build it should contain a
30      structure like
31               war - docs    (contains jsp and html for this app)
32                     WEB-INF - struts-config.xml
33                               web.xml
34                               jboss-web.xml (for jboss only)
35
36      Authors: Mike Douglass
37      =================================================================== -->
38
39 <project name="bedework.buildwar" default="build" >
40   <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
41
42   <!--<import file="${build.dir}/buildfilters.xml" />-->
43   <buildfilters/>
44  
45   <if>
46     <isset property="org.bedework.global.portal.platform" />
47     <then>
48       <import file="${build.dir}/portals/${org.bedework.global.portal.platform}War.xml" />
49     </then>
50   </if>
51
52   <import file="${build.dir}/platforms/${org.bedework.global.deploy.platform}War.xml" />
53
54   <target name="init" depends="init.common">
55     <if>
56       <isset property="org.bedework.global.build.ear" />
57       <then>
58         <!-- Properties all go into a single jar file at termination -->
59         <property name="app.dest.classes"
60                   location="${org.bedework.ear.properties.dir}" />
61       </then>
62       <else>
63         <!-- Properties in the war file -->
64         <property name="app.dest.classes"
65                   location="${app.dest.webinf}/classes" />
66       </else>
67     </if>
68     <property name="app.dest.properties"
69               location="${app.dest.classes}/properties/${org.bedework.deployment.name}" />
70   </target>
71
72   <target name="init.common">
73     <!-- Destinations - where we build an unwrapped war -->
74     <property name="app.dest.war"
75               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
76     <property name="app.dest.docs"
77               location="${app.dest.war}/docs" />
78     <property name="app.dest.webinf"
79               location="${app.dest.war}/WEB-INF" />
80     <property name="app.dest.metainf"
81               location="${app.dest.war}/META-INF" />
82
83     <!--temp web.xml location  -->
84     <property name="app.temp.web.xml"
85               location="${app.dest.webinf}/tempweb.xml" />
86
87     <!--final web.xml location  -->
88     <property name="app.dest.web.xml"
89               location="${app.dest.webinf}/web.xml" />
90
91     <property name="app.war.file"
92               location="${dist.home}/${propval.app.war.name}.war" />
93
94     <!-- default web.xml -->
95     <property name="propval.app.web.xml"
96               value="war/WEB-INF/web.xml" />
97
98               <!--
99     <property name="app.web.xml"
100               location="${propval.app.web.xml}" />
101               -->
102     <resolveFile name="app.web.xml"
103                  file="${propval.app.web.xml}"
104                  base="${app.sou.dir}"/>
105
106     <property name="app.sou.properties"
107               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
108   </target>
109
110   <target name="build" depends="init">
111     <infoMsg message="* =========== Building war ${propval.app.war.name}" />
112
113     <delete dir="${app.dest.war}" />
114
115     <if>
116       <isset property="propval.app.login.directory" />
117       <then>
118         <fileset dir="${propval.app.login.directory}"
119                  id="org.bedework.login.fileset" />
120       </then>
121       <else>
122         <fileset dir="${org.bedework.common.resources}/login"
123                  id="org.bedework.login.fileset" />
124       </else>
125     </if>
126
127     <if>
128       <available file="${app.sou.dir}/war/docs" type="dir" />
129       <then>
130         <!-- Add modifed login pages -->
131         <copy todir="${app.dest.docs}/login" failonerror="false" >
132           <fileset refid="org.bedework.login.fileset" />
133           <filterset>
134             <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
135           </filterset>
136         </copy>
137       </then>
138     </if>
139
140     <!-- ===============================================================
141          We copy 3 sets of properties.
142
143          First (for struts) are the servlet properties which ends up as
144               classes/servlet.properties
145          Next we copy in a set of generic property files and then with
146          overwrite we copy in a set of base specific files.
147
148          All are updated with new values.
149          =============================================================== -->
150
151     <if>
152       <available file="${app.sou.dir}/war/docs" type="dir" />
153       <then>
154         <copy todir="${app.dest.docs}">
155           <fileset dir="${app.sou.dir}/war/docs" />
156         </copy>
157       </then>
158     </if>
159
160     <!-- ===============================================================
161          Any property files we need for configuration, other than the
162          standard struts file, should be in the "${app.sou.dir}/properties
163          directory. They will be copied into the appropriate place for the
164          war and transformed by the above filter.
165          =============================================================== -->
166
167     <!-- Create the runtime options file -->
168     <mkdir dir="${app.dest.properties}" />
169
170     <if>
171       <available file="${app.sou.dir}/properties" type="dir" />
172       <then>
173         <copy todir="${app.dest.properties}" overwrite="yes" >
174           <fileset dir="${app.sou.dir}/properties"
175                    includes="*.properties"/>
176           <filterset refid="property.filters" />
177         </copy>
178       </then>
179     </if>
180
181     <copy tofile="${app.dest.properties}/options.xml"
182           file="${org.bedework.config.options}" >
183       <filterset>
184         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
185       </filterset>
186       <filterset refid="property.filters" />
187     </copy>
188    
189     <if>
190       <isset property="org.bedework.extra.properties" />
191       <then>
192         <copy todir="${app.dest.properties}">
193           <filelist dir="${org.bedework.extra.properties.dir}"
194                     files="${org.bedework.extra.properties}"/>
195           <filterset refid="property.filters" />
196         </copy>
197       </then>
198     </if>
199    
200     <copy tofile="${app.dest.classes}/sysevents.properties"
201           file="${org.bedework.config.sysevents.properties}" />
202
203     <if>
204       <isset property="org.bedework.sou.classpath.properties" />
205       <then>
206         <copy todir="${app.dest.classes}">
207           <fileset dir="${org.bedework.sou.classpath.properties}" />
208           <filterset refid="property.filters" />
209         </copy>
210       </then>
211     </if>
212
213     <if>
214       <isset property="org.bedework.sou.hibernate.properties" />
215       <then>
216         <!-- ===========================================================
217              Add hibernate config.
218              =========================================================== -->
219
220         <debugMsg message="************* Copy hib properties from ${org.bedework.sou.hibernate.properties}" />
221
222         <copy todir="${app.dest.classes}">
223           <fileset dir="${org.bedework.sou.hibernate.properties}/properties" />
224           <filterset refid="property.filters" />
225         </copy>
226    
227         <copy todir="${app.dest.classes}">
228           <fileset dir="${org.bedework.sou.hibernate.properties}/hbms" />
229           <filterset refid="property.filters" />
230         </copy>
231       </then>
232     </if>
233
234     <!-- Make a temp copy of the web.xml file -->
235     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
236           overwrite="yes" />
237
238     <antcall target="struts-stuff" inheritRefs="true" />
239
240     <!-- Filter the temp copy of the web.xml file -->
241     <copy tofile="${app.dest.web.xml}"
242           file="${app.temp.web.xml}"
243           overwrite="yes" >
244       <filterset>
245         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
246       </filterset>
247       <filterset refid="property.filters" />
248     </copy>
249
250     <delete file="${app.temp.web.xml}" />
251
252     <!-- Add the context root to the file. Note that newline is required -->
253     <echo file="${org.bedework.global.context.roots}" append="yes">
254 ${propval.app.war.name}.context=${propval.app.context.root}
255     </echo>
256
257     <!-- Add libraries: Platform specific -->
258     <antcall target="addLibs" inheritRefs="true" />
259
260     <!-- Platform specific -->
261     <antcall target="doPlatform" inheritRefs="true" />
262
263     <!-- build the war file or directory -->
264     <mkdir dir="${dist.home}" />
265
266     <!-- may be there as a file or a directory -->
267     <delete file="${app.war.file}" />
268     <delete dir="${app.war.file}" />
269        
270     <if>
271       <or>
272         <not>
273           <isset property="org.bedework.global.wars.zipped" />
274         </not>
275         <istrue value="${org.bedework.global.wars.zipped}"/>
276       </or>
277       <then>
278         <!-- Build a zipped war file -->
279         <war warfile="${app.war.file}"
280              webxml="${app.dest.web.xml}"
281              basedir="${app.dest.war}"
282              excludes="WEB-INF/web.xml" />
283       </then>
284       <else>
285         <!-- Unzipped war file -->
286         <copy todir="${app.war.file}">
287           <fileset dir="${app.dest.war}"  includes="*"/>
288           <filterset refid="property.filters" />
289         </copy>
290       </else>
291     </if>
292   </target>
293
294   <!-- =================================================================
295        If this is a struts app the following gets executed.
296        We create an updated struts-config.xml file and add some jars.
297        ================================================================= -->
298
299   <target name="struts-stuff" if="org.bedework.strutsapp">
300     <!-- Make our own servlet.properties file for struts applications -->
301     <echo file="${app.dest.classes}/servlet.properties" ><![CDATA[#
302 # ========================================================================
303 # This file contains all properties for servlet applications.
304 # It cannot be application specific as the jboss build creates a
305 # single set of resources on the classpath.
306 # ========================================================================
307 #
308
309 # ========================================================================
310 # Properties for the xml/xslt based calendar web applications
311 # ========================================================================
312 #
313 # author Mike Douglass douglm rpi.edu
314
315 # This is only here because the jetspeed portal-struts bridge does not seem to be
316 # passing across the servlet context.
317 #org.bedework.svcicb.sessionAttrName=org.bedework.admin.svcicb.sessionattrname.@APP-NAME@
318
319 # These are required by the Struts framework
320 errors.header=<errors><ul>
321 errors.footer=</ul></errors>
322
323 messages.header=<messages><ul>
324 messages.footer=</ul></messages>
325
326 edu.rpi.sss.util.action.noactionerrors=yes
327
328 applicationResources=<li>Cannot load application resources bundle {0}</li>
329
330 # set the default content type - html for jsp, xml for xml/xslt.
331 #edu.rpi.sss.util.action.contenttype=@DEFAULT-CONTENTTYPE@
332 edu.rpi.sss.util.action.contenttype=text/xml
333
334 edu.rpi.sss.util.error.exc=<li>Exception: {0}</li>
335
336 # Turn nocache headers on. We don't use the standard struts directives
337 # because we need to be able to turn nocache off for a single response.
338 # This gets around an IE problem with delivery of files.
339 edu.rpi.sss.util.action.nocache=yes
340
341 org.bedework.security.prefix=@SECURITY-PREFIX@
342
343 edu.rpi.sss.util.action.logprefix=@APP-NAME@
344
345 # Roles we need to know about - init action uses these
346 # (Not using roles in the current system)
347 #org.bedework.role.admin=@SECURITY-PREFIX@.admin
348 #org.bedework.role.contentadmin=@SECURITY-PREFIX@.contentadmin
349 #org.bedework.role.alert=@SECURITY-PREFIX@.alerts
350 #org.bedework.role.owner=@SECURITY-PREFIX@.owner
351 ]]></echo>
352
353     <!-- Replace the tokens -->
354     <replace file="${app.dest.classes}/servlet.properties">
355       <replacefilter token="@SECURITY-PREFIX@"
356                      value="${propval.app.security.prefix}" />
357       <replacefilter token="@APP-NAME@"
358                      value="${propval.app.name}" />
359       <replacefilter token="@DEFAULT-CONTENTTYPE@"
360                      value="${propval.app.default.contenttype}" />
361     </replace>
362      
363     <!-- Copy a dummy startup file into the war. -->
364     <copy todir="${app.dest.war}">
365       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
366     </copy>
367
368     <copy todir="${app.dest.webinf}"
369           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
370
371     <mkdir  dir="${app.dest.webinf}/tlds"/>
372     <copy todir="${app.dest.webinf}/tlds" >
373       <fileset dir="${org.bedework.struts.tlds}">
374         <include name="*"/>
375       </fileset>
376     </copy>
377
378     <if>
379       <isset property="org.bedework.global.portal.platform" />
380       <then>
381         <antcall target="doPortal" inheritRefs="true" />
382       </then>
383     </if>
384
385   </target>
386 </project>
Note: See TracBrowser for help on using the browser.