root/trunk/deployment/build.xml

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

Create new platform specific termination build files.

Move some stuff out of the web termination and the deployment build.xml into the termination build files.

Allow the bedework ds config to be supplied in the configuration directory and copied into the server

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     <!-- ================= termination tasks for deployment ================ -->
229
230     <ant antfile="${org.bedework.deployment.base}/termination/build.xml"
231          inheritrefs="true" target="deploy" />
232   </target>
233
234   <!-- =================================================================
235        Targets called by the deploy target. Each is conditional on a
236        config property and each executes a build file in a subdirectory of
237        this component.
238        ================================================================= -->
239
240   <!-- The cp.xalan task conditionally copies the xalan.jar file, if
241        necessary -->
242   <target name="cp.xalan" if="xalan.in.tomcat.common.endorsed">
243     <copy file="${org.bedework.default.lib}/xalan.jar"
244           todir="${appserver.endorsed.dir}"/>
245   </target>
246
247   <!-- =================================================================
248        Targets called by the build.configured target. Each is conditional on a
249        config property and each executes a build file in a subdirectory of
250        this component.
251        ================================================================= -->
252   <target name="build.configured.apps">
253     <forEachApp names="${org.bedework.install.app.names}"
254                 prefix="org.bedework.deploy"
255                 appPrefix="org.bedework.app"
256                 projectPrefix="org.bedework.project">
257       <sequential>
258         <antcall target="build.available.configured.app" inheritrefs="true" />
259       </sequential>
260     </forEachApp>
261
262     <!-- ==================== termination tasks for apps ================= -->
263
264     <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml"
265          inheritrefs="true" target="build.configured" />
266   </target>
267
268   <target name="build.available.configured.app">
269     <propertycopy name="propval.app.type"
270                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
271     <property name="org.bedework.deploy.type.dir"
272               location="${app.root.dir}/${org.bedework.deploy.name}/${propval.app.type}" />
273     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
274
275     <if>
276       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
277       <then>
278         <propertyset id="deploy-app-properties">
279           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
280           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
281         </propertyset>
282
283         <propertycopy name="propval.app.unauthenticated"
284                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
285
286         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
287              inheritrefs="true" target="build.configured" >
288           <propertyset refid="deploy-app-properties" />
289         </ant>
290       </then>
291     </if>
292   </target>
293
294   <target name="deploy.apps">
295     <forEachApp names="${org.bedework.install.app.names}"
296                 prefix="org.bedework.deploy"
297                 appPrefix="org.bedework.app"
298                 projectPrefix="org.bedework.project">
299       <sequential>
300         <antcall target="deploy.available.app" inheritrefs="true" />
301       </sequential>
302     </forEachApp>
303
304     <!-- =================== termination tasks for apps ================= -->
305
306     <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml"
307          inheritrefs="true" target="deploy" />
308   </target>
309
310   <target name="deploy.available.app">
311     <propertycopy name="propval.app.type"
312                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
313     <property name="org.bedework.deploy.type.dir"
314               location="${app.root.dir}/${propval.app.type}" />
315     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
316
317     <if>
318       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
319       <then>
320         <propertyset id="deploy-app-properties">
321           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
322           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
323         </propertyset>
324
325         <propertycopy name="propval.app.unauthenticated"
326                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
327
328         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
329              inheritrefs="true" target="deploy" >
330           <propertyset refid="deploy-app-properties" />
331         </ant>
332       </then>
333     </if>
334   </target>
335 </project>
336
Note: See TracBrowser for help on using the browser.