root/trunk/calendar3/bldfiles/buildwar.xml

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

Initial import of bedework

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