root/trunk/build/buildwar.xml

Revision 1968 (checked in by douglm, 5 years ago)

1. Move options classes into rpiutil to make them availabkle to other packages.

2. Make changes to the WebDAV classes to facilitate building of extra WebDAV based services (such as CardDAV)

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         <!-- Common library in ear file -->
56         <property name="app.dest.lib"
57                   location="${org.bedework.ear.templib}" />
58
59         <!-- Properties all go into a single jar file at termination -->
60         <property name="app.dest.classes"
61                   location="${org.bedework.ear.properties.dir}" />
62       </then>
63       <else>
64         <!-- Library in war file -->
65         <property name="app.dest.lib"
66                   location="${app.dest.webinf}/lib" />
67
68         <!-- Properties in the war file -->
69         <property name="app.dest.classes"
70                   location="${app.dest.webinf}/classes" />
71       </else>
72     </if>
73     <property name="app.dest.properties"
74               location="${app.dest.classes}/properties/calendar" />
75   </target>
76
77   <target name="init.common">
78     <!-- Destinations - where we build an unwrapped war -->
79     <property name="app.dest.war"
80               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
81     <property name="app.dest.docs"
82               location="${app.dest.war}/docs" />
83     <property name="app.dest.webinf"
84               location="${app.dest.war}/WEB-INF" />
85     <property name="app.dest.metainf"
86               location="${app.dest.war}/META-INF" />
87
88     <!--temp web.xml location  -->
89     <property name="app.temp.web.xml"
90               location="${app.dest.webinf}/tempweb.xml" />
91
92     <!--final web.xml location  -->
93     <property name="app.dest.web.xml"
94               location="${app.dest.webinf}/web.xml" />
95
96     <property name="app.war.file"
97               location="${dist.home}/${propval.app.war.name}.war" />
98
99     <!-- default web.xml -->
100     <property name="propval.app.web.xml"
101               value="war/WEB-INF/web.xml" />
102
103               <!--
104     <property name="app.web.xml"
105               location="${propval.app.web.xml}" />
106               -->
107     <resolveFile name="app.web.xml"
108                  file="${propval.app.web.xml}"
109                  base="${app.sou.dir}"/>
110
111     <property name="app.sou.properties"
112               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
113   </target>
114
115   <target name="build" depends="init">
116     <echo message="**************************************************" />
117     <echo message=" * Building war ${propval.app.war.name}"/>
118     <echo message="**************************************************" />
119
120     <delete dir="${app.dest.war}" />
121
122     <!-- Add modifed login pages -->
123     <copy todir="${app.dest.docs}/login" failonerror="false" >
124       <fileset dir="${org.bedework.common.resources}/login" />
125       <filterset>
126         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
127       </filterset>
128     </copy>
129
130     <!-- ===============================================================
131          We copy 3 sets of properties.
132
133          First (for struts) are the servlet properties which ends up as
134               classes/servlet.properties
135          Next we copy in a set of generic property files and then with
136          overwrite we copy in a set of base specific files.
137
138          All are updated with new values.
139          =============================================================== -->
140
141     <if>
142       <available file="${app.sou.dir}/war/docs" type="dir" />
143       <then>
144         <copy todir="${app.dest.docs}">
145           <fileset dir="${app.sou.dir}/war/docs" />
146         </copy>
147       </then>
148     </if>
149
150     <!-- ===============================================================
151          Any property files we need for configuration, other than the
152          standard struts file, should be in the "${app.sou.dir}/properties
153          directory. They will be copied into the appropriate place for the
154          war and transformed by the above filter.
155          =============================================================== -->
156     <if>
157       <available file="${app.sou.dir}/properties" type="dir" />
158       <then>
159         <copy todir="${app.dest.properties}" overwrite="yes" >
160           <fileset dir="${app.sou.dir}/properties"
161                    includes="*.properties"/>
162           <filterset refid="property.filters" />
163         </copy>
164       </then>
165     </if>
166
167     <copy todir="${app.dest.classes}">
168       <fileset dir="${app.sou.dir}/war/WEB-INF/classes"
169                includes="*"/>
170       <filterset refid="property.filters" />
171     </copy>
172
173     <!-- Create the runtime options file -->
174     <mkdir dir="${app.dest.properties}" />
175
176     <copy tofile="${app.dest.properties}/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     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
185       <filterset refid="property.filters" />
186     </copy>
187
188     <!-- ===============================================================
189          Add hibernate jars and property files from calendar api.
190          =============================================================== -->
191
192     <copy todir="${app.dest.classes}">
193       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
194       <filterset refid="property.filters" />
195     </copy>
196
197     <copy todir="${app.dest.classes}">
198       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
199       <filterset refid="property.filters" />
200     </copy>
201
202     <!-- Make a temp copy of the web.xml file -->
203     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
204           overwrite="yes" />
205
206     <antcall target="struts-stuff" inheritRefs="true" />
207
208     <!-- Filter the temp copy of the web.xml file -->
209     <copy tofile="${app.dest.web.xml}"
210           file="${app.temp.web.xml}"
211           overwrite="yes" >
212       <filterset>
213         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
214       </filterset>
215       <filterset refid="property.filters" />
216     </copy>
217
218     <delete file="${app.temp.web.xml}" />
219
220     <!-- Add the contex root to the file. Note that newline is required -->
221     <echo file="${org.bedework.global.context.roots}" append="yes">
222 ${propval.app.war.name}.context=${propval.app.context.root}
223     </echo>
224
225     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}" />
226     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm-attrs}" />
227     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm}" />
228     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.cglib}" />
229     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dom4j}" />
230     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ehcache}" />
231     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.hibernate}" />
232     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jgroups}" />
233     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jta}" />
234
235     <antcall target="bexchange-stuff" inheritRefs="true" />
236     <antcall target="domino-stuff" inheritRefs="true" />
237     <antcall target="google-stuff" inheritRefs="true" />
238
239     <!-- ===============================================================
240          Any jar files required
241          =============================================================== -->
242
243     <echo message="+++++++++++  bw-logging at ${org.bedework.appjar.bw-logging}" />
244     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-annotations}" />
245     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiaccess}" />
246     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiutil}" />
247     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-davio}" />
248     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-apiutil}" />
249     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcore}" />
250     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcorei}" />
251     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calfacade}" />
252     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvc}" />
253     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvci}" />
254     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-client}" />
255     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-icalendar}" />
256     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-logging}" />
257     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-mail}" />
258     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-appcommon}" />
259
260     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-core}"/>
261     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-misc}"/>
262     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j}"/>
263     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-codec}"/>
264     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-collections}"/>
265     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-httpclient}"/>
266     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-lang}"/>
267     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-ssl}"/>
268
269     <!-- Mail related stuff -->
270     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activation}" />
271     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dsn}" />
272     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.imap}" />
273     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.mailapi}" />
274     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.pop3}" />
275     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.smtp}" />
276
277     <!-- any extra files-->
278     <copy todir="${app.dest.lib}" >
279       <fileset dir="${org.bedework.temp.extrajars.dir}" />
280     </copy>
281
282     <!-- Platform specific -->
283     <antcall target="doPlatform" inheritRefs="true" />
284
285     <!-- build the war file -->
286     <mkdir dir="${dist.home}" />
287     <delete file="${app.war.file}" />
288
289     <war warfile="${app.war.file}"
290          webxml="${app.dest.web.xml}"
291          basedir="${app.dest.war}"
292          excludes="WEB-INF/web.xml" />
293   </target>
294
295   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
296     <copy tofile="${app.dest.properties}/timezones.xml"
297           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
298   </target>
299
300   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
301     <copy tofile="${app.dest.properties}/timezones.xml"
302           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
303   </target>
304
305   <target name="google-stuff" if="org.bedework.build.caldav.google">
306     <copy todir="${app.dest.lib}">
307       <fileset dir="${google.dir}">
308         <include name="*.jar"/>
309       </fileset>
310     </copy>
311
312     <copy tofile="${app.dest.properties}/timezones.xml"
313           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
314   </target>
315
316   <!-- =================================================================
317        If this is a struts app the following gets executed.
318        We create an updated struts-config.xml file and add some jars.
319        ================================================================= -->
320
321   <target name="struts-stuff" if="org.bedework.strutsapp">
322     <!-- Copy a dummy startup file into the war. -->
323     <copy todir="${app.dest.war}">
324       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
325     </copy>
326
327     <copy todir="${app.dest.webinf}"
328           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
329
330     <mkdir  dir="${app.dest.webinf}/tlds"/>
331     <copy todir="${app.dest.webinf}/tlds" >
332       <fileset dir="${org.bedework.struts.tlds}">
333         <include name="*"/>
334       </fileset>
335     </copy>
336
337     <if>
338       <isset property="org.bedework.global.portal.platform" />
339       <then>
340         <antcall target="doPortal" inheritRefs="true" />
341       </then>
342     </if>
343
344     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.xalan}"/>
345     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.struts}"/>
346
347     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}"/>
348     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-beanutils}"/>
349     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-digester}"/>
350     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-fileupload}"/>
351     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-logging}"/>
352     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-validator}"/>
353     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jakarta-oro}"/>
354     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl}"/>
355     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl-standard}"/>
356   </target>
357 </project>
Note: See TracBrowser for help on using the browser.