root/branches/xslt-rewrite/build/buildwar.xml

Revision 1705 (checked in by kllin, 5 years ago)

merging our xsl and i18n changes to xslt-rewrite branch

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   <target name="init" depends="init.common,init.j2ee,init.standalone" />
46
47   <target name="init.common">
48     <!-- Load the location of the libraries -->
49     <property file="${org.bedework.project.bedework}/build/libjars.properties" />
50
51     <!-- Destinations - where we build an unwrapped war -->
52     <property name="app.dest.war"
53               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
54     <property name="app.dest.docs"
55               location="${app.dest.war}/docs" />
56     <property name="app.dest.webinf"
57               location="${app.dest.war}/WEB-INF" />
58     <property name="app.dest.metainf"
59               location="${app.dest.war}/META-INF" />
60     <property name="app.dest.classes"
61               location="${app.dest.webinf}/classes" />
62     <property name="app.dest.properties"
63               location="${app.dest.classes}/properties/calendar" />
64
65     <!--temp web.xml location  -->
66     <property name="app.temp.web.xml"
67               location="${app.dest.webinf}/tempweb.xml" />
68
69     <!--final web.xml location  -->
70     <property name="app.dest.web.xml"
71               location="${app.dest.webinf}/web.xml" />
72
73     <property name="app.war.file"
74               location="${dist.home}/${propval.app.war.name}.war" />
75
76     <!-- default web.xml -->
77     <property name="propval.app.web.xml"
78               value="war/WEB-INF/web.xml" />
79
80               <!--
81     <property name="app.web.xml"
82               location="${propval.app.web.xml}" />
83               -->
84     <resolveFile name="app.web.xml"
85                  file="${propval.app.web.xml}"
86                  base="${app.sou.dir}"/>
87
88     <property name="app.sou.properties"
89               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
90   </target>
91
92   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
93
94     <property name="app.dest.lib"
95               location="${app.dest.webinf}/lib" />
96   </target>
97
98   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
99     <property name="app.dest.lib"
100               location="${org.bedework.temp.dir}/earlib" />
101   </target>
102
103   <target name="build" depends="init">
104     <delete dir="${app.dest.war}" />
105
106     <!-- Add modifed login pages -->
107     <copy todir="${app.dest.docs}/login" failonerror="false" >
108       <fileset dir="${org.bedework.common.resources}/login" />
109       <filterset>
110         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
111       </filterset>
112     </copy>
113
114     <!-- ===============================================================
115          We copy 3 sets of properties.
116
117          First (for struts) are the servlet properties which ends up as
118               classes/servlet.properties
119          Next we copy in a set of generic property files and then with
120          overwrite we copy in a set of base specific files.
121
122          All are updated with new values.
123          =============================================================== -->
124
125     <available file="${app.sou.dir}/properties" type="dir"
126                property="org.bedework.properties.dir.exists" />
127
128     <available file="${app.sou.properties}" type="file"
129                property="org.bedework.servlet.properties.exists" />
130
131     <available file="${app.sou.dir}/war/docs" type="dir"
132                property="org.bedework.war.docs.exists" />
133
134     <antcall target="copy.properties" inheritRefs="true" />
135     <antcall target="copy.servlet.properties" inheritRefs="true" />
136     <antcall target="copy.war.docs" inheritRefs="true" />
137
138     <!-- Create the env.properties file -->
139     <mkdir dir="${app.dest.properties}" />
140
141     <copy tofile="${app.dest.properties}/env.properties"
142           file="${org.bedework.config.properties}" />
143
144     <copy tofile="${app.dest.properties}/options.xml"
145           file="${org.bedework.config.options}" >
146       <filterset>
147         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
148       </filterset>
149       <filterset refid="property.filters" />
150     </copy>
151
152     <!-- Make a temp copy of the web.xml file -->
153     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
154           overwrite="yes" />
155
156     <antcall target="struts-stuff" inheritRefs="true" />
157
158     <!-- Filter the temp copy of the web.xml file -->
159     <copy tofile="${app.dest.web.xml}"
160           file="${app.temp.web.xml}"
161           overwrite="yes" >
162       <filterset>
163         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
164       </filterset>
165       <filterset refid="property.filters" />
166     </copy>
167
168     <delete file="${app.temp.web.xml}" />
169
170     <!-- ===============================================================
171          Add all java resource bundles
172          =============================================================== -->
173     <copy todir="${app.dest.classes}">
174       <fileset dir="${project.home}/deployment/resources/i18n">
175         <include name="*.properties" />
176       </fileset>
177     </copy>
178
179     <!-- ===============================================================
180          Add hibernate jars and property files from calendar api.
181          =============================================================== -->
182     <copy todir="${app.dest.classes}">
183       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
184       <filterset refid="property.filters" />
185     </copy>
186
187     <copy todir="${app.dest.classes}">
188       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
189       <filterset refid="property.filters" />
190     </copy>
191
192     <copy todir="${app.dest.lib}">
193       <fileset dir="${hibernate.jars.dir}">
194         <include name="*.jar"/>
195       </fileset>
196     </copy>
197
198     <antcall target="jboss-stuff" inheritRefs="true" />
199     <antcall target="bexchange-stuff" inheritRefs="true" />
200     <antcall target="domino-stuff" inheritRefs="true" />
201     <antcall target="google-stuff" inheritRefs="true" />
202
203     <!-- ===============================================================
204          Any jar files required
205          =============================================================== -->
206
207     <copy todir="${app.dest.lib}" overwrite="yes">
208       <fileset dir="${bin.home}">
209         <!-- jars from sub-projects needed by all -->
210         <include name="rpiaccess*.jar"/>
211         <include name="rpiutil*.jar"/>
212         <include name="bw-davio*.jar"/>
213
214         <!-- Calendar api jars -->
215         <include name="bw-apiutil*.jar"/>
216         <include name="bw-calcore*.jar"/>
217         <include name="bw-calcorei*.jar"/>
218         <include name="bw-calenv*.jar"/>
219         <include name="bw-calfacade*.jar"/>
220         <include name="bw-calsvc*.jar"/>
221         <include name="bw-calsvci*.jar"/>
222         <include name="bw-client*.jar"/>
223         <include name="bw-icalendar*.jar"/>
224         <include name="bw-locale*.jar"/>
225         <include name="bw-logging*.jar"/>
226         <include name="bw-mail*.jar"/>
227
228         <!-- Common jars for web apps -->
229         <include name="bw-appcommon*.jar"/>
230       </fileset>
231     </copy>
232
233      <!-- any extra bin files-->
234     <copy todir="${app.dest.lib}" >
235       <fileset refid="app.bin.files" />
236     </copy>
237
238     <!-- Some more standard libs -->
239     <if>
240       <not>
241         <isset property="org.bedework.build.for.jboss"/>
242       </not>
243       <then>
244         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
245       </then>
246     </if>
247     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
248     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
249     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
250     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
251     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
252     <copy todir="${app.dest.lib}" file="${commons-httpclient.jar}"/>
253     <copy todir="${app.dest.lib}" file="${commons-lang.jar}"/>
254     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
255
256     <copy todir="${app.dest.lib}" overwrite="yes">
257       <fileset dir="${javamail.dir}">
258         <include name="*.jar"/>
259       </fileset>
260     </copy>
261
262     <!-- add the jdbcdriver if defined -->
263     <antcall target="add.jdbcdriver" inheritRefs="true" />
264
265     <!-- tomcat -->
266     <antcall target="add.tomcat" inheritRefs="true" />
267
268      <!-- any extra lib files-->
269     <copy todir="${app.dest.lib}" >
270       <fileset refid="app.lib.files" />
271       <!-- <fileset refid="app.temp.lib.files" /> -->
272     </copy>
273
274     <!-- build the war file -->
275     <mkdir dir="${dist.home}" />
276     <delete file="${app.war.file}" />
277
278     <war warfile="${app.war.file}"
279          webxml="${app.dest.web.xml}"
280          basedir="${app.dest.war}"
281          excludes="WEB-INF/web.xml" />
282   </target>
283
284   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
285     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
286   </target>
287
288   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
289     <property name="propval.app.tomcat.context.xml"
290               location="${app.sou.dir}/war/META-INF/context.xml" />
291     <resolveFile name="app.tomcat.context.xml"
292                  file="${propval.app.tomcat.context.xml}"
293                  base="${app.sou.dir}"/>
294
295     <copy tofile="${app.dest.metainf}/context.xml"
296           file="${app.tomcat.context.xml}"
297           overwrite="yes" >
298       <filterset refid="property.filters" />
299     </copy>
300   </target>
301
302   <target name="copy.properties" if="org.bedework.properties.dir.exists">
303     <!-- ===============================================================
304          Any property files we need for configuration, other than the
305          standard struts file, should be in the "${app.sou.dir}/properties
306          directory. They will be copied into the appropriate place for the
307          war and transformed by the above filter.
308          =============================================================== -->
309     <copy todir="${app.dest.properties}" overwrite="yes" >
310       <fileset dir="${app.sou.dir}/properties"
311                includes="*.properties"/>
312       <filterset refid="property.filters" />
313     </copy>
314   </target>
315
316   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
317     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
318       <filterset refid="property.filters" />
319     </copy>
320   </target>
321
322   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
323     <copy todir="${app.dest.docs}">
324       <fileset dir="${app.sou.dir}/war/docs" />
325     </copy>
326   </target>
327
328   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
329     <copy tofile="${app.dest.properties}/timezones.xml"
330           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
331   </target>
332
333   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
334     <copy tofile="${app.dest.properties}/timezones.xml"
335           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
336   </target>
337
338   <target name="google-stuff" if="org.bedework.build.caldav.google">
339     <copy todir="${app.dest.lib}">
340       <fileset dir="${google.dir}">
341         <include name="*.jar"/>
342       </fileset>
343     </copy>
344
345     <copy tofile="${app.dest.properties}/timezones.xml"
346           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
347   </target>
348
349   <!-- =================================================================
350        If this is a struts app the following gets executed.
351        We create an updated struts-config.xml file and add some jars.
352        ================================================================= -->
353
354   <target name="struts-stuff" if="org.bedework.strutsapp">
355     <!-- Copy a dummy startup file into the war. -->
356     <copy todir="${app.dest.war}">
357       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
358     </copy>
359
360     <copy todir="${app.dest.webinf}"
361           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
362
363     <mkdir  dir="${app.dest.webinf}/tlds"/>
364     <copy todir="${app.dest.webinf}/tlds" >
365       <fileset dir="${struts.tlds.dir}">
366         <include name="*"/>
367       </fileset>
368     </copy>
369     <copy todir="${app.dest.webinf}/tlds" >
370       <fileset dir="${org.bedework.default.lib}/tlds">
371         <include name="*"/>
372       </fileset>
373     </copy>
374
375     <if>
376       <not>
377         <isset property="xalan.in.tomcat.common.endorsed" />
378       </not>
379       <then>
380         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
381       </then>
382     </if>
383
384     <if>
385       <isset property="org.bedework.global.portal.platform" />
386       <then>
387         <!-- Add common portlet files -->
388
389         <copy todir="${app.dest.lib}" >
390           <fileset dir="${portals-bridges.jars.dir}">
391             <include name="*.jar"/>
392           </fileset>
393         </copy>
394
395         <!-- Use generic bedework portlet tld -->
396         <copy todir="${app.dest.webinf}/tlds"
397               overwrite="yes"
398               failonerror="no" >
399           <fileset dir="${app.root.dir}/resources/portlet" >
400             <include name="*.tld"/>
401           </fileset>
402         </copy>
403
404         <copy todir="${app.dest.webinf}"
405               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
406               overwrite="yes"
407               failonerror="no" />
408
409         <copy todir="${app.dest.webinf}"
410               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
411               overwrite="yes"
412               failonerror="no" >
413           <filterset refid="property.filters" />
414         </copy>
415
416         <!-- Add the portal bridge controller def -->
417         <replace file="${app.dest.webinf}/struts-config.xml">
418           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
419           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
420                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
421           </replacevalue>
422         </replace>
423
424         <antcall target="add.jetspeed2" inheritRefs="true" />
425         <antcall target="add.uportal2" inheritRefs="true" />
426         <antcall target="add.liferay4" inheritRefs="true" />
427       </then>
428     </if>
429
430     <copy todir="${app.dest.lib}">
431       <fileset dir="${struts.dir}">
432         <include name="*.jar"/>
433       </fileset>
434     </copy>
435
436     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
437     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
438     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
439     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
440     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
441     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
442     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
443   </target>
444
445   <!-- =================================================================
446        Jetspeed 2 modifications
447        ================================================================= -->
448
449   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
450     <copy todir="${app.dest.webinf}/tlds" >
451       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
452         <include name="*.tld"/>
453       </fileset>
454     </copy>
455   </target>
456
457   <!-- =================================================================
458        Uportal 2 modifications
459        ================================================================= -->
460
461   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
462     <copy todir="${app.dest.lib}" >
463       <fileset dir="${bin.home}">
464         <include name="bw-uportal*.jar"/>
465       </fileset>
466     </copy>
467
468     <!-- Add the portlet servlet mapping -->
469     <replace file="${app.temp.web.xml}">
470       <replacetoken><![CDATA[<!-- portlet servlet mapping here -->]]></replacetoken>
471       <replacevalue><![CDATA[<servlet-mapping>
472     <servlet-name>@PORTLET-NAME@</servlet-name>
473     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
474   </servlet-mapping>]]>
475       </replacevalue>
476     </replace>
477
478   </target>
479
480   <!-- =================================================================
481        Liferay 4 modifications
482        ================================================================= -->
483
484   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
485    <!-- Add liferay config files -->
486     <copy todir="${app.dest.webinf}" >
487       <fileset dir="${app.sou.dir}/war/WEB-INF" >
488         <include name="liferay*"/>
489       </fileset>
490       <filterset refid="property.filters" />
491     </copy>
492
493     <copy todir="${app.dest.lib}" >
494       <fileset dir="${bin.home}">
495         <include name="bw-liferay*.jar"/>
496       </fileset>
497       <fileset dir="${liferay4.lib}">
498         <include name="*.jar"/>
499       </fileset>
500     </copy>
501
502     <!-- Add the context params -->
503     <replace file="${app.temp.web.xml}">
504       <replacetoken><![CDATA[<!-- add context params here -->]]></replacetoken>
505       <replacevalue><![CDATA[<!-- add context params here -->
506
507   <context-param>
508     <param-name>company_id</param-name>
509     <param-value>@LIFERAY-COMPANY-ID@</param-value>
510   </context-param>]]>
511       </replacevalue>
512     </replace>
513
514     <!-- Add the portal listener -->
515     <replace file="${app.temp.web.xml}">
516       <replacetoken><![CDATA[<!-- add listeners here -->]]></replacetoken>
517       <replacevalue><![CDATA[<!-- add listeners here -->
518
519   <listener>
520     <listener-class>
521       @PORTAL-SERVLET-CONTEXT-LISTENER@
522     </listener-class>
523   </listener>]]>
524       </replacevalue>
525     </replace>
526
527     <!-- Add the portlet servlet definition -->
528     <replace file="${app.temp.web.xml}">
529       <replacetoken><![CDATA[<!-- add servlet definitions here -->]]></replacetoken>
530       <replacevalue><![CDATA[<!-- add servlet definitions here -->
531
532   <!-- Servlet definition for portlet use. -->
533   <servlet>
534     <servlet-name>@PORTLET-NAME@</servlet-name>
535     <display-name>@PORTLET-NAME@ Wrapper</display-name>
536     <servlet-class>@PORTLET-SERVLET-CLASS@</servlet-class>
537     <init-param>
538       <param-name>portlet-class</param-name>
539       <param-value>@PORTLET-CLASS@</param-value>
540     </init-param>
541     <init-param>
542       <param-name>portlet-guid</param-name>
543       <param-value>@CONTEXT-ROOT@.@PORTLET-NAME@</param-value>
544     </init-param>
545   </servlet>]]>
546       </replacevalue>
547     </replace>
548
549     <!-- Add the portlet servlet mapping -->
550     <replace file="${app.temp.web.xml}">
551       <replacetoken><![CDATA[<!-- add servlet mappings here -->]]></replacetoken>
552       <replacevalue><![CDATA[<!-- add servlet mappings here -->
553
554   <servlet-mapping>
555     <servlet-name>@PORTLET-NAME@</servlet-name>
556     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
557   </servlet-mapping>]]>
558       </replacevalue>
559     </replace>
560   </target>
561
562   <!-- =================================================================
563        If this is a j2ee app the following gets executed.
564        We create an uodated jboss-web.xml file (for jboss) and a ear
565        ================================================================= -->
566
567   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
568     <copy todir="${app.dest.webinf}"
569           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
570       <filterset refid="property.filters" />
571     </copy>
572     <antcall target="jboss-virtual-host" inheritRefs="true" />
573   </target>
574
575   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
576     <replace file="${app.dest.webinf}/jboss-web.xml">
577       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
578       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
579       ]]>
580       </replacevalue>
581     </replace>
582     <replace file="${app.dest.webinf}/jboss-web.xml">
583       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
584     </replace>
585   </target>
586
587   <target name="build.ear" if="cal.j2ee">
588     <ant antfile="${buildear}"
589          inheritRefs="true" target="build" />
590   </target>
591 </project>
Note: See TracBrowser for help on using the browser.