root/trunk/calendar3/bldfiles/buildwar.xml

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

Two major components to this update.

New xml options module - the intent is to move run-time options into the xml
and leave build time properties in the current properties file. An xml element
can define a class with the usual setters to hold values defined by it's child
elements. Curently only ldap properties are set.

New ldap groups module. Allow us to move forward on user client development.

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