root/trunk/build/buildwar.xml

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

Major reorganization of the build process mostly affecting handling of portal builds.

Removed portal specific directories from teh deployment directory.

Removed portal sepcific code from buildwar.xml and added new portal specific files to be imported. These are in a section of teh bwbuild config directory.

All portal customization is now part of building the war file.

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