root/trunk/deployment/build.xml

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

Some fixes to broken build.

Also a startjboss script

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         <property name="startup.website.dir"
230                   location="${org.bedework.appserver.dir}/${org.bedework.server.resource.root.dir}/bedework" />
231     <delete dir="${startup.website.dir}"/>
232     <mkdir dir="${startup.website.dir}"/>
233     <copy todir="${startup.website.dir}">
234       <fileset dir="${app.root.dir}/resources/bedework"/>
235     </copy>
236
237     <!-- copy jdbc jar so datasources work -->
238     <if>
239       <available file="${org.bedework.global.ext.lib}/jdbc" type="dir" />
240       <then>
241         <!-- jdbc drivers -->
242         <copy todir="${appserver.lib.dir}" flatten="yes" >
243           <!-- local jdbc drivers -->
244           <fileset dir="${org.bedework.global.ext.lib}/jdbc">
245             <include name="*.jar"/>
246           </fileset>
247         </copy>
248       </then>
249       <else>
250         <!-- Include the quickstart jdbc driver -->
251         <copy todir="${appserver.lib.dir}" file="${org.bedework.appjar.hsqldb}"/>
252       </else>
253     </if>
254
255     <if>
256       <available file="${java.tools.jar}" />
257       <then>
258         <copy todir="${appserver.lib.dir}" file="${java.tools.jar}"/>
259       </then>
260     </if>
261   </target>
262
263   <!-- =================================================================
264        Targets called by the deploy target. Each is conditional on a
265        config property and each executes a build file in a subdirectory of
266        this component.
267        ================================================================= -->
268
269   <!-- The cp.xalan task conditionally copies the xalan.jar file, if
270        necessary -->
271   <target name="cp.xalan" if="xalan.in.tomcat.common.endorsed">
272     <copy file="${org.bedework.default.lib}/xalan.jar"
273           todir="${appserver.endorsed.dir}"/>
274   </target>
275
276   <!-- =================================================================
277        Targets called by the build.configured target. Each is conditional on a
278        config property and each executes a build file in a subdirectory of
279        this component.
280        ================================================================= -->
281   <target name="build.configured.apps">
282     <forEachApp names="${org.bedework.install.app.names}"
283                 prefix="org.bedework.deploy"
284                 appPrefix="org.bedework.app"
285                 projectPrefix="org.bedework.project">
286       <sequential>
287         <antcall target="build.available.configured.app" inheritrefs="true" />
288       </sequential>
289     </forEachApp>
290
291     <!-- ======================= termination tasks ================= -->
292
293     <ant antfile="${org.bedework.deployment.base}/termination/build.xml"
294          inheritrefs="true" target="build.configured" />
295   </target>
296
297   <target name="build.available.configured.app">
298     <propertycopy name="propval.app.type"
299                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
300     <property name="org.bedework.deploy.type.dir"
301               location="${app.root.dir}/${org.bedework.deploy.name}/${propval.app.type}" />
302     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
303
304     <if>
305       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
306       <then>
307         <propertyset id="deploy-app-properties">
308           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
309           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
310         </propertyset>
311
312         <propertycopy name="propval.app.unauthenticated"
313                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
314
315         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
316              inheritrefs="true" target="build.configured" >
317           <propertyset refid="deploy-app-properties" />
318         </ant>
319       </then>
320     </if>
321   </target>
322
323   <target name="deploy.apps">
324     <forEachApp names="${org.bedework.install.app.names}"
325                 prefix="org.bedework.deploy"
326                 appPrefix="org.bedework.app"
327                 projectPrefix="org.bedework.project">
328       <sequential>
329         <antcall target="deploy.available.app" inheritrefs="true" />
330       </sequential>
331     </forEachApp>
332
333     <!-- ======================= termination tasks ================= -->
334
335     <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml"
336          inheritrefs="true" target="deploy" />
337   </target>
338
339   <target name="deploy.available.app">
340     <propertycopy name="propval.app.type"
341                   from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.appType" />
342     <property name="org.bedework.deploy.type.dir"
343               location="${app.root.dir}/${propval.app.type}" />
344     <echo message="*********************************** deploy directory is ${org.bedework.deploy.type.dir}" />
345
346     <if>
347       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
348       <then>
349         <propertyset id="deploy-app-properties">
350           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
351           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
352         </propertyset>
353
354         <propertycopy name="propval.app.unauthenticated"
355                       from="bedework-options.org.bedework.app.${org.bedework.deploy.name}.guestMode" />
356
357         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
358              inheritrefs="true" target="deploy" >
359           <propertyset refid="deploy-app-properties" />
360         </ant>
361       </then>
362     </if>
363   </target>
364 </project>
365
Note: See TracBrowser for help on using the browser.