root/trunk/build/buildwar.xml

Revision 2876 (checked in by douglm, 3 years ago)

Disable inclusion of any classes in skeleton war

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