root/releases/bedework-3.4/build/buildwar.xml

Revision 1429 (checked in by douglm, 6 years ago)

In preparation for moving th eweb ui to generating xml based acls, copied parsing into access/AccessXmlUtil

To simplify the task, and avoid some of the problems posed by packaging, moved all the tag definitions into the rpiutil package.

The bulk of the changes below involve changing the import statements.

At this point, other than the packaging, there is little functional change.

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 hibernate jars and property files from calendar api.
172          =============================================================== -->
173
174     <copy todir="${app.dest.classes}">
175       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
176       <filterset refid="property.filters" />
177     </copy>
178
179     <copy todir="${app.dest.classes}">
180       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
181       <filterset refid="property.filters" />
182     </copy>
183
184     <copy todir="${app.dest.lib}">
185       <fileset dir="${hibernate.jars.dir}">
186         <include name="*.jar"/>
187       </fileset>
188     </copy>
189
190     <antcall target="jboss-stuff" inheritRefs="true" />
191     <antcall target="bexchange-stuff" inheritRefs="true" />
192     <antcall target="domino-stuff" inheritRefs="true" />
193     <antcall target="google-stuff" inheritRefs="true" />
194
195     <!-- ===============================================================
196          Any jar files required
197          =============================================================== -->
198
199     <copy todir="${app.dest.lib}" overwrite="yes">
200       <fileset dir="${bin.home}">
201         <!-- jars from sub-projects needed by all -->
202         <include name="rpiaccess*.jar"/>
203         <include name="rpiutil*.jar"/>
204         <include name="bw-davio*.jar"/>
205
206         <!-- Calendar api jars -->
207         <include name="bw-apiutil*.jar"/>
208         <include name="bw-calcore*.jar"/>
209         <include name="bw-calcorei*.jar"/>
210         <include name="bw-calenv*.jar"/>
211         <include name="bw-calfacade*.jar"/>
212         <include name="bw-calsvc*.jar"/>
213         <include name="bw-calsvci*.jar"/>
214         <include name="bw-icalendar*.jar"/>
215         <include name="bw-locale*.jar"/>
216         <include name="bw-logging*.jar"/>
217         <include name="bw-mail*.jar"/>
218
219         <!-- Common jars for web apps -->
220         <include name="bw-appcommon*.jar"/>
221       </fileset>
222     </copy>
223
224      <!-- any extra bin files-->
225     <copy todir="${app.dest.lib}" >
226       <fileset refid="app.bin.files" />
227     </copy>
228
229     <!-- Some more standard libs -->
230     <if>
231       <not>
232         <isset property="org.bedework.build.for.jboss"/>
233       </not>
234       <then>
235         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
236       </then>
237     </if>
238     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
239     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
240     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
241     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
242     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
243     <copy todir="${app.dest.lib}" file="${commons-httpclient.jar}"/>
244     <copy todir="${app.dest.lib}" file="${commons-lang.jar}"/>
245     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
246
247     <copy todir="${app.dest.lib}" overwrite="yes">
248       <fileset dir="${javamail.dir}">
249         <include name="*.jar"/>
250       </fileset>
251     </copy>
252
253     <!-- add the jdbcdriver if defined -->
254     <antcall target="add.jdbcdriver" inheritRefs="true" />
255
256     <!-- tomcat -->
257     <antcall target="add.tomcat" inheritRefs="true" />
258
259      <!-- any extra lib files-->
260     <copy todir="${app.dest.lib}" >
261       <fileset refid="app.lib.files" />
262       <!-- <fileset refid="app.temp.lib.files" /> -->
263     </copy>
264
265     <!-- build the war file -->
266     <mkdir dir="${dist.home}" />
267     <delete file="${app.war.file}" />
268
269     <war warfile="${app.war.file}"
270          webxml="${app.dest.web.xml}"
271          basedir="${app.dest.war}"
272          excludes="WEB-INF/web.xml" />
273   </target>
274
275   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
276     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
277   </target>
278
279   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
280     <property name="propval.app.tomcat.context.xml"
281               location="${app.sou.dir}/war/META-INF/context.xml" />
282     <resolveFile name="app.tomcat.context.xml"
283                  file="${propval.app.tomcat.context.xml}"
284                  base="${app.sou.dir}"/>
285
286     <copy tofile="${app.dest.metainf}/context.xml"
287           file="${app.tomcat.context.xml}"
288           overwrite="yes" >
289       <filterset refid="property.filters" />
290     </copy>
291   </target>
292
293   <target name="copy.properties" if="org.bedework.properties.dir.exists">
294     <!-- ===============================================================
295          Any property files we need for configuration, other than the
296          standard struts file, should be in the "${app.sou.dir}/properties
297          directory. They will be copied into the appropriate place for the
298          war and transformed by the above filter.
299          =============================================================== -->
300     <copy todir="${app.dest.properties}" overwrite="yes" >
301       <fileset dir="${app.sou.dir}/properties"
302                includes="*.properties"/>
303       <filterset refid="property.filters" />
304     </copy>
305   </target>
306
307   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
308     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
309       <filterset refid="property.filters" />
310     </copy>
311   </target>
312
313   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
314     <copy todir="${app.dest.docs}">
315       <fileset dir="${app.sou.dir}/war/docs" />
316     </copy>
317   </target>
318
319   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
320     <copy tofile="${app.dest.properties}/timezones.xml"
321           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
322   </target>
323
324   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
325     <copy tofile="${app.dest.properties}/timezones.xml"
326           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
327   </target>
328
329   <target name="google-stuff" if="org.bedework.build.caldav.google">
330     <copy todir="${app.dest.lib}">
331       <fileset dir="${google.dir}">
332         <include name="*.jar"/>
333       </fileset>
334     </copy>
335
336     <copy tofile="${app.dest.properties}/timezones.xml"
337           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
338   </target>
339
340   <!-- =================================================================
341        If this is a struts app the following gets executed.
342        We create an updated struts-config.xml file and add some jars.
343        ================================================================= -->
344
345   <target name="struts-stuff" if="org.bedework.strutsapp">
346     <!-- Copy a dummy startup file into the war. -->
347     <copy todir="${app.dest.war}">
348       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
349     </copy>
350
351     <copy todir="${app.dest.webinf}"
352           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
353
354     <mkdir  dir="${app.dest.webinf}/tlds"/>
355     <copy todir="${app.dest.webinf}/tlds" >
356       <fileset dir="${struts.tlds.dir}">
357         <include name="*"/>
358       </fileset>
359     </copy>
360     <copy todir="${app.dest.webinf}/tlds" >
361       <fileset dir="${org.bedework.default.lib}/tlds">
362         <include name="*"/>
363       </fileset>
364     </copy>
365
366     <if>
367       <not>
368         <isset property="xalan.in.tomcat.common.endorsed" />
369       </not>
370       <then>
371         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
372       </then>
373     </if>
374
375     <if>
376       <isset property="org.bedework.global.portal.platform" />
377       <then>
378         <!-- Add common portlet files -->
379
380         <copy todir="${app.dest.lib}" >
381           <fileset dir="${portals-bridges.jars.dir}">
382             <include name="*.jar"/>
383           </fileset>
384         </copy>
385
386         <!-- Use generic bedework portlet tld -->
387         <copy todir="${app.dest.webinf}/tlds"
388               overwrite="yes"
389               failonerror="no" >
390           <fileset dir="${app.root.dir}/resources/portlet" >
391             <include name="*.tld"/>
392           </fileset>
393         </copy>
394
395         <copy todir="${app.dest.webinf}"
396               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
397               overwrite="yes"
398               failonerror="no" />
399
400         <copy todir="${app.dest.webinf}"
401               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
402               overwrite="yes"
403               failonerror="no" >
404           <filterset refid="property.filters" />
405         </copy>
406
407         <!-- Add the portal bridge controller def -->
408         <replace file="${app.dest.webinf}/struts-config.xml">
409           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
410           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
411                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
412           </replacevalue>
413         </replace>
414
415         <antcall target="add.jetspeed2" inheritRefs="true" />
416         <antcall target="add.uportal2" inheritRefs="true" />
417         <antcall target="add.liferay4" inheritRefs="true" />
418       </then>
419     </if>
420
421     <copy todir="${app.dest.lib}">
422       <fileset dir="${struts.dir}">
423         <include name="*.jar"/>
424       </fileset>
425     </copy>
426
427     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
428     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
429     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
430     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
431     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
432     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
433     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
434   </target>
435
436   <!-- =================================================================
437        Jetspeed 2 modifications
438        ================================================================= -->
439
440   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
441     <copy todir="${app.dest.webinf}/tlds" >
442       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
443         <include name="*.tld"/>
444       </fileset>
445     </copy>
446   </target>
447
448   <!-- =================================================================
449        Uportal 2 modifications
450        ================================================================= -->
451
452   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
453     <copy todir="${app.dest.lib}" >
454       <fileset dir="${bin.home}">
455         <include name="bw-uportal*.jar"/>
456       </fileset>
457     </copy>
458
459     <!-- Add the portlet servlet mapping -->
460     <replace file="${app.temp.web.xml">
461       <replacetoken><![CDATA[<!-- portlet servlet mapping here -->]]></replacetoken>
462       <replacevalue><![CDATA[<servlet-mapping>
463     <servlet-name>@PORTLET-NAME@</servlet-name>
464     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
465   </servlet-mapping>]]>
466       </replacevalue>
467     </replace>
468
469   </target>
470
471   <!-- =================================================================
472        Liferay 4 modifications
473        ================================================================= -->
474
475   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
476    <!-- Add liferay config files -->
477     <copy todir="${app.dest.webinf}" >
478       <fileset dir="${app.sou.dir}/war/WEB-INF" >
479         <include name="liferay*"/>
480       </fileset>
481       <filterset refid="property.filters" />
482     </copy>
483
484     <copy todir="${app.dest.lib}" >
485       <fileset dir="${bin.home}">
486         <include name="bw-liferay*.jar"/>
487       </fileset>
488       <fileset dir="${liferay4.lib}">
489         <include name="*.jar"/>
490       </fileset>
491     </copy>
492
493     <!-- Add the context params -->
494     <replace file="${app.temp.web.xml}">
495       <replacetoken><![CDATA[<!-- add context params here -->]]></replacetoken>
496       <replacevalue><![CDATA[<!-- add context params here -->
497
498   <context-param>
499     <param-name>company_id</param-name>
500     <param-value>@LIFERAY-COMPANY-ID@</param-value>
501   </context-param>]]>
502       </replacevalue>
503     </replace>
504
505     <!-- Add the portal listener -->
506     <replace file="${app.temp.web.xml}">
507       <replacetoken><![CDATA[<!-- add listeners here -->]]></replacetoken>
508       <replacevalue><![CDATA[<!-- add listeners here -->
509
510   <listener>
511     <listener-class>
512       @PORTAL-SERVLET-CONTEXT-LISTENER@
513     </listener-class>
514   </listener>]]>
515       </replacevalue>
516     </replace>
517
518     <!-- Add the portlet servlet definition -->
519     <replace file="${app.temp.web.xml}">
520       <replacetoken><![CDATA[<!-- add servlet definitions here -->]]></replacetoken>
521       <replacevalue><![CDATA[<!-- add servlet definitions here -->
522
523   <!-- Servlet definition for portlet use. -->
524   <servlet>
525     <servlet-name>@PORTLET-NAME@</servlet-name>
526     <display-name>@PORTLET-NAME@ Wrapper</display-name>
527     <servlet-class>@PORTLET-SERVLET-CLASS@</servlet-class>
528     <init-param>
529       <param-name>portlet-class</param-name>
530       <param-value>@PORTLET-CLASS@</param-value>
531     </init-param>
532     <init-param>
533       <param-name>portlet-guid</param-name>
534       <param-value>@CONTEXT-ROOT@.@PORTLET-NAME@</param-value>
535     </init-param>
536   </servlet>]]>
537       </replacevalue>
538     </replace>
539
540     <!-- Add the portlet servlet mapping -->
541     <replace file="${app.temp.web.xml}">
542       <replacetoken><![CDATA[<!-- add servlet mappings here -->]]></replacetoken>
543       <replacevalue><![CDATA[<!-- add servlet mappings here -->
544
545   <servlet-mapping>
546     <servlet-name>@PORTLET-NAME@</servlet-name>
547     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
548   </servlet-mapping>]]>
549       </replacevalue>
550     </replace>
551   </target>
552
553   <!-- =================================================================
554        If this is a j2ee app the following gets executed.
555        We create an uodated jboss-web.xml file (for jboss) and a ear
556        ================================================================= -->
557
558   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
559     <copy todir="${app.dest.webinf}"
560           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
561       <filterset refid="property.filters" />
562     </copy>
563     <antcall target="jboss-virtual-host" inheritRefs="true" />
564   </target>
565
566   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
567     <replace file="${app.dest.webinf}/jboss-web.xml">
568       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
569       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
570       ]]>
571       </replacevalue>
572     </replace>
573     <replace file="${app.dest.webinf}/jboss-web.xml">
574       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
575     </replace>
576   </target>
577
578   <target name="build.ear" if="cal.j2ee">
579     <ant antfile="${buildear}"
580          inheritRefs="true" target="build" />
581   </target>
582 </project>
Note: See TracBrowser for help on using the browser.