root/trunk/deployment/build.xml

Revision 2698 (checked in by douglm, 3 years ago)

Rework the build process to make war/ear differences part of the imported platform specific build files.

Added a resource reference to the web.xml files for jms and updated the jboss-web files to link that in to a jboss resource. This probably needs some more parameterization.

Line 
1 <?xml version="1.0"?>
2
3 <!-- ===================== Deployment build file =======================
4      This directory and the files within it are to be part of the config
5      and deployment process.
6      
7      ======================== new comment ========================
8      Modules are of type and kind.
9      
10      The type is for example, webadmin, usercaldav etc.
11      
12      The kind is webapp, shellscr etc.
13      
14      We cycle over the information we have for each application we want to
15      build and for each application use ants property mapping to map the
16      properties onto a constant set of names, e.g. the application specific
17      name
18          org.bedework.app.CalAdmin.deploy.dir
19      would be mapped onto
20          propval.app.deploy.dir
21          
22      We then look for build.xml files on a path given by the type and kind,
23      for example
24          webadmin/webapp/build.xml
25      or
26          indexer/shellscr/build.xml
27          
28      The intent was to allow certain modules to be built in different forms.
29      At one point it was also the case that we tried to deal with platform
30      specific issues through this scheme. Now that is handled by importing
31      platform specific build files into a generic build file.
32      
33      That may allow for some simplification.
34      ======================== old comment ========================
35
36      A number of properties of the form org.bedework.install.XXX will be
37      defined, each indicating that a particular component is to be deployed.
38
39      Targets below will be executed only if that property is defined.
40
41      Adding a new configuration, e.g. a different portal platform, requires
42      the steps:
43         Create a subdirectory in each components subdirectory,
44         e.g.  webadmin/myportal
45
46         Create any other required resource directories and resources and
47         create a build.xml file to configure and package the component(s).
48
49         Update the config program to load, save and display the new
50         properties for that configuration.
51
52         Add an antcall for each component and a corresponding target
53
54      Authors: Mike Douglass   douglm rpi.edu
55      =================================================================== -->
56
57 <project name="deploy.bedework" default="init">
58   <property name="base.name" value="deployment"/>
59
60   <property name="org.bedework.temp.wars.home"
61             location="${org.bedework.temp.dir}/wars" />
62
63   <property name="org.bedework.temp.shellscr.home"
64             location="${org.bedework.temp.dir}/shellscr" />
65
66   <!-- Recreateed by each app build file. Place extra jars here -->
67   <property name="org.bedework.temp.extrajars.dir"
68             location="${org.bedework.temp.dir}/extrajars" />
69
70   <!-- Preserve extra jars for ear builds -->
71   <property name="org.bedework.temp.ear.extrajars.dir"
72             location="${org.bedework.temp.dir}/earextrajars" />
73        
74   <dirname property="this.build.dir" file="${ant.file}"/>
75   <property name="bedework.deployment.base" location="this.build.dir" />
76
77   <import file="${build.dir}/buildTools/getJar.xml"/>
78
79   <import file="${this.build.dir}/appjars.xml" />
80
81   <import file="${build.dir}/loadDeployConfig.xml"/>
82
83   <target name="init" >
84     <getAppJars />
85
86     <loadDeployConfig />
87
88     <!-- default to debug off -->
89     <property name="app.debug.val" value="0" />
90
91     <!-- set this for the war builds -->
92     <dirname property="app.root.dir" file="${ant.file}"/>
93
94     <!-- Common resources directory -->
95     <property name="org.bedework.common.resources"
96               location="${app.root.dir}/resources" />
97
98     <property name="org.bedework.global.build.common.context.war.name"
99               value="bw-common" />
100
101     <!-- Where we put ear stuff -->
102     <if>
103       <isset property="org.bedework.global.build.ear" />
104       <then>
105         <property name="app.ear.file.name"
106                   value="${org.bedework.global.ear.name}.ear" />
107
108         <if>
109           <equals arg1="${org.bedework.global.ear.zipped}"
110                   arg2="yes" />
111           <then>
112             <property name="org.bedework.ear.dir"
113                       location="${dist.home}/${org.bedework.global.ear.name}" />
114             <property name="org.bedework.ear.file"
115                       location="${dist.home}/${org.bedework.global.ear.name}.ear" />
116           </then>
117           <else>
118             <property name="org.bedework.ear.dir"
119                       location="${dist.home}/${org.bedework.global.ear.name}.ear" />
120           </else>
121         </if>
122
123         <property name="org.bedework.ear.properties.dir"
124                   location="${org.bedework.temp.dir}/ear-properties" />
125
126         <property name="org.bedework.ear.properties.jar"
127                   location="${org.bedework.ear.dir}/bw-ear-properties.jar"/>
128
129         <delete dir="${org.bedework.ear.dir}" />
130         <mkdir dir="${org.bedework.ear.dir}" />
131
132         <delete dir="${org.bedework.ear.templib}" />
133         <mkdir dir="${org.bedework.ear.templib}" />
134
135         <delete dir="${org.bedework.ear.properties.dir}" />
136         <mkdir dir="${org.bedework.ear.properties.dir}" />
137       </then>
138     </if>
139
140     <property name="org.bedework.global.context.roots"
141               location="${org.bedework.temp.dir}/context-roots.properties" />
142
143     <if>
144       <not>
145         <isset property="org.bedework.global.context.roots" />
146       </not>
147       <then>
148         <tempfile property="org.bedework.global.context.roots"
149                   destdir="${org.bedework.temp.dir}"
150                   prefix="context-roots" suffix=".properties" />
151       </then>
152     </if>
153   </target>
154
155   <target name="deftasks" depends="init">
156     <path id="app.xml.cp">
157       <pathelement location="${org.bedework.deployutil.jar}"/>
158     </path>
159
160     <taskdef name="forEachApp"
161              classname="org.bedework.deployment.ForEachAppTask">
162       <classpath refid="app.xml.cp"/>
163     </taskdef>
164
165     <taskdef name="resolveFile"
166              classname="org.bedework.deployment.ResolveFile">
167       <classpath refid="app.xml.cp"/>
168     </taskdef>
169
170     <taskdef name="makeLangXsl"
171              classname="org.bedework.deployment.MakeLangXsl">
172       <classpath refid="app.xml.cp"/>
173     </taskdef>
174   </target>
175
176   <target name="build.configured" depends="deftasks" >
177     <!-- Clean up before we start -->
178     <delete dir="${org.bedework.temp.wars.home}" />
179
180     <antcall target="build.apps" inheritrefs="true" />
181   </target>
182
183   <!-- =================================================================
184        Targets called by the build.configured target. Each is conditional on a
185        config property and each executes a build file in a subdirectory of
186        this component.
187        ================================================================= -->
188
189   <target name="build.apps" >
190     <property name="org.bedework.deploy.kind" value="webapp" />
191     <antcall target="build.configured.apps" inheritrefs="true" />
192   </target>
193
194   <!-- =================================================================
195                          The deploy target.
196        ================================================================= -->
197
198   <target name="deploy" depends="deftasks" >
199     <!-- Clean up before we start -->
200     <delete dir="${org.bedework.temp.wars.home}" />
201
202     <property name="org.bedework.lang.properties"
203               location="${org.bedework.project.calendarapi}/calFacade/resources/org/bedework/locale/resources" />
204
205     <property name="org.bedework.xsllang.dir"
206               location="${org.bedework.temp.dir}/xsllang" />
207
208     <delete dir="${org.bedework.xsllang.dir}"/>
209     <mkdir dir="${org.bedework.xsllang.dir}"/>
210
211     <makeLangXsl dir="${org.bedework.lang.properties}"
212                  prefix="BwResources"
213                  resdir="${org.bedework.xsllang.dir}"
214                  xsldir="${org.bedework.xsllang.dir}"
215                  name="org.bedework.locales"
216                  check="true" />
217
218     <!-- Build the webapps stuff.-->
219     <antcall target="deploy.apps" inheritrefs="true" >
220       <param name="org.bedework.deploy.kind" value="webapp" />
221     </antcall>
222
223     <!-- Build the shellscr stuff.-->
224     <antcall target="deploy.apps" inheritrefs="true" >
225       <param name="org.bedework.deploy.kind" value="shellscr" />
226     </antcall>
227
228     <!-- copy startup website that sends you to the applications -->
229     <delete dir="${webapp.root.dir}/bedework"/>
230     <mkdir dir="${webapp.root.dir}/bedework"/>
231     <copy todir="${webapp.root.dir}/bedework">
232       <fileset dir="${app.root.dir}/resources/bedework"/>
233     </copy>
234
235     <!-- copy jdbc jar so datasources work -->
236     <if>
237       <available file="${org.bedework.global.ext.lib}/jdbc" type="dir" />
238       <then>
239         <!-- jdbc drivers -->
240         <copy todir="${appserver.lib.dir}" flatten="yes" >
241           <!-- local jdbc drivers -->
242           <fileset dir="${org.bedework.global.ext.lib}/jdbc">
243             <include name="*.jar"/>
244           </fileset>
245         </copy>
246       </then>
247       <else>
248         <!-- Include the quickstart jdbc driver -->
249         <copy todir="${appserver.lib.dir}" file="${org.bedework.appjar.hsqldb}"/>
250       </else>
251     </if>
252
253     <if>
254       <available file="${java.tools.jar}" />
255       <then>
256         <copy todir="${appserver.lib.dir}" file="${java.tools.jar}"/>
257       </then>
258     </if>
259   </target>
260
261   <!-- =================================================================
262        Targets called by the deploy target. Each is conditional on a
263        config property and each executes a build file in a subdirectory of
264        this component.
265        ================================================================= -->
266
267   <!-- The cp.xalan task conditionally copies the xalan.jar file, if
268        necessary -->
269   <target name="cp.xalan" if="xalan.in.tomcat.common.endorsed">
270     <copy file="${org.bedework.default.lib}/xalan.jar"
271           todir="${appserver.endorsed.dir}"/>
272   </target>
273
274   <!-- =================================================================
275        Targets called by the build.configured target. Each is conditional on a
276        config property and each executes a build file in a subdirectory of
277        this component.
278        ================================================================= -->
279   <target name="build.configured.apps">
280     <forEachApp names="${org.bedework.install.app.names}"
281                 prefix="org.bedework.deploy"
282                 appPrefix="org.bedework.app"
283                 projectPrefix="org.bedework.project">
284       <sequential>
285         <antcall target="build.available.configured.app" inheritrefs="true" />
286       </sequential>
287     </forEachApp>
288
289     <!-- ======================= termination tasks ================= -->
290
291     <ant antfile="${org.bedework.deployment.base}/termination/build.xml"
292          inheritrefs="true" target="build.configured" />
293   </target>
294
295   <target name="build.available.configured.app">
296     <propertycopy name="propval.app.type"
297                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
298     <property name="org.bedework.deploy.type.dir"
299               location="${app.root.dir}/${org.bedework.deploy.name}/${propval.app.type}" />
300     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
301
302     <if>
303       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
304       <then>
305         <propertyset id="deploy-app-properties">
306           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
307           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
308         </propertyset>
309
310         <propertycopy name="propval.app.unauthenticated"
311                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
312
313         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
314              inheritrefs="true" target="build.configured" >
315           <propertyset refid="deploy-app-properties" />
316         </ant>
317       </then>
318     </if>
319   </target>
320
321   <target name="deploy.apps">
322     <forEachApp names="${org.bedework.install.app.names}"
323                 prefix="org.bedework.deploy"
324                 appPrefix="org.bedework.app"
325                 projectPrefix="org.bedework.project">
326       <sequential>
327         <antcall target="deploy.available.app" inheritrefs="true" />
328       </sequential>
329     </forEachApp>
330
331     <!-- ======================= termination tasks ================= -->
332
333     <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml"
334          inheritrefs="true" target="deploy" />
335   </target>
336
337   <target name="deploy.available.app">
338     <propertycopy name="propval.app.type"
339                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
340     <property name="org.bedework.deploy.type.dir"
341               location="${app.root.dir}/${propval.app.type}" />
342     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
343
344     <if>
345       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
346       <then>
347         <propertyset id="deploy-app-properties">
348           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
349           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
350         </propertyset>
351
352         <propertycopy name="propval.app.unauthenticated"
353                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
354
355         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
356              inheritrefs="true" target="deploy" >
357           <propertyset refid="deploy-app-properties" />
358         </ant>
359       </then>
360     </if>
361   </target>
362 </project>
363
Note: See TracBrowser for help on using the browser.