root/trunk/deployment/build.xml

Revision 1895 (checked in by douglm, 5 years ago)

Near completion of build rebuild.

Each deployment fetches the extra jars it needs out of the project and places them in a well-known directory.

Less copying of files takes place now.

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      A number of properties of the form org.bedework.install.XXX will be
8      defined, each indicating that a particualr component is to be deployed.
9
10      Targets below will be executed only if that property is defined.
11
12      Adding a new configuration, e.g. a different portal platform, requires
13      the steps:
14         Create a subdirectory in each components subdirectory,
15         e.g.  webadmin/myportal
16
17         Create any other required resource directories and resources and
18         create a build.xml file to configure and package the component(s).
19
20         Update the config program to load, save and display the new
21         properties for that configuration.
22
23         Add an antcall for each component and a corresponding target
24
25      Authors: Mike Douglass   douglm@rpi.edu
26      =================================================================== -->
27
28 <project name="deploy.bedework" default="init">
29   <property name="base.name" value="deployment"/>
30
31   <property name="org.bedework.temp.wars.home"
32             location="${org.bedework.temp.dir}/wars" />
33
34   <property name="org.bedework.temp.shellscr.home"
35             location="${org.bedework.temp.dir}/shellscr" />
36
37   <!-- Recreateed by each app build file. Place extra jars here -->
38   <property name="org.bedework.temp.extrajars.dir"
39             location="${org.bedework.temp.dir}/extrajars" />
40
41   <!-- Load the location of the libraries -->
42   <property file="${org.bedework.project.bedework}/build/libjars.properties" />
43
44   <dirname property="this.build.dir" file="${ant.file}"/>
45
46   <import file="${build.dir}/getJar.xml"/>
47
48   <import file="${this.build.dir}/appjars.xml" />
49
50   <target name="init" >
51     <getAppJars />
52
53     <property name="source.home" location="${this.build.dir}/src"/>
54
55     <!-- Load default deploy properties
56     <property file="${this.build.dir}/deploy.properties"/>
57      -->
58
59     <!-- ==================== config properties ========================= -->
60     <property name="org.bedework.config.properties"
61               location="${org.bedework.config.base}/configs/democal.properties" />
62     <property name="org.bedework.config.options"
63               location="${org.bedework.config.base}/configs/democal.options.xml" />
64
65     <echo message="==========================================================" />
66     <echo message="Use config properties ${org.bedework.config.properties}" />
67     <loadproperties
68           srcFile="${org.bedework.config.properties}" >
69       <filterchain>
70         <expandproperties/>
71       </filterchain>
72     </loadproperties>
73
74     <!-- default to debug off -->
75     <property name="app.debug.val" value="0" />
76
77     <!-- set this for the war builds -->
78     <dirname property="app.root.dir" file="${ant.file}"/>
79
80     <!-- Common resources directory -->
81     <property name="org.bedework.common.resources"
82               location="${app.root.dir}/resources" />
83
84     <if>
85       <not>
86         <isset property="org.bedework.global.context.roots" />
87       </not>
88       <then>
89         <tempfile property="org.bedework.global.context.roots"
90                   destdir="${org.bedework.temp.dir}"
91                   prefix="context-roots" suffix=".properties" />
92       </then>
93     </if>
94
95     <!-- ==================== config properties =========================
96     <property name="org.bedework.config.properties"
97               location="${org.bedework.config.base}/configs/${org.bedework.clone.name}.properties" />
98
99     <echo message="==========================================================" />
100     <echo message="Use clone properties ${org.bedework.config.properties}" />
101     <loadproperties
102           srcFile="${org.bedework.config.properties}" >
103       <filterchain>
104         <expandproperties/>
105       </filterchain>
106     </loadproperties>
107     -->
108   </target>
109
110   <target name="deftasks" depends="init">
111     <path id="app.xml.cp">
112       <pathelement location="${org.bedework.deployutil.jar}"/>
113     </path>
114
115     <taskdef name="forEachApp"
116              classname="org.bedework.deployment.ForEachAppTask">
117       <classpath refid="app.xml.cp"/>
118     </taskdef>
119
120     <taskdef name="resolveFile"
121              classname="org.bedework.deployment.ResolveFile">
122       <classpath refid="app.xml.cp"/>
123     </taskdef>
124
125     <taskdef name="makeLangXsl"
126              classname="org.bedework.deployment.MakeLangXsl">
127       <classpath refid="app.xml.cp"/>
128     </taskdef>
129   </target>
130
131   <target name="build.configured" depends="deftasks" >
132     <!-- Clean up before we start -->
133     <delete dir="${org.bedework.temp.wars.home}" />
134
135     <antcall target="build.standalone.apps" inheritrefs="true" />
136
137     <antcall target="build.portal.apps" inheritrefs="true" />
138
139     <antcall target="build.j2ee.apps" inheritrefs="true" />
140   </target>
141
142   <!-- =================================================================
143        Targets called by the build.configured target. Each is conditional on a
144        config property and each executes a build file in a subdirectory of
145        this component.
146        ================================================================= -->
147
148   <target name="build.standalone.apps" if="org.bedework.global.build.standalone.app" >
149     <!-- ======================= webconfig - only standalone =================
150     <ant antfile="${org.bedework.deployment.base}/webconfig/webapp/build.xml"
151          inheritrefs="true" target="build.configured" />
152           -->
153
154     <property name="org.bedework.deploy.kind" value="webapp" />
155     <antcall target="build.configured.apps" inheritrefs="true" />
156   </target>
157
158   <target name="build.portal.apps" if="org.bedework.global.portal.platform" >
159     <property name="org.bedework.deploy.kind"
160               value="${org.bedework.global.portal.platform}" />
161     <antcall target="build.configured.apps" inheritrefs="true" />
162   </target>
163
164   <target name="build.j2ee.apps" if="org.bedework.global.j2ee.platform" >
165     <property name="org.bedework.deploy.kind"
166               value="${org.bedework.global.j2ee.platform}" />
167     <antcall target="build.configured.apps" inheritrefs="true" />
168   </target>
169
170   <!-- =================================================================
171                          The deploy target.
172        ================================================================= -->
173
174   <target name="deploy" depends="deftasks" >
175     <!-- Clean up before we start -->
176     <delete dir="${org.bedework.temp.wars.home}" />
177
178     <property name="org.bedework.lang.properties"
179               location="${org.bedework.project.calendarapi}/calFacade/resources/org/bedework/locale/resources" />
180
181     <property name="org.bedework.xsllang.dir"
182               location="${org.bedework.temp.dir}/xsllang" />
183
184     <delete dir="${org.bedework.xsllang.dir}"/>
185     <mkdir dir="${org.bedework.xsllang.dir}"/>
186
187     <makeLangXsl dir="${org.bedework.lang.properties}"
188                  prefix="BwResources"
189                  resdir="${org.bedework.xsllang.dir}"
190                  xsldir="${org.bedework.xsllang.dir}"
191                  name="org.bedework.locales"
192                  check="true" />
193
194     <echo message="LLLLLLLLLLLLLLLLLLLL locales=${org.bedework.locales}" />
195
196     <!--<antcall target="deploy.standalone.apps" inheritrefs="true" />-->
197     <if>
198       <isset property="org.bedework.global.build.standalone.app" />
199       <then>
200         <antcall target="deploy.apps" inheritrefs="true" >
201           <param name="org.bedework.deploy.kind" value="webapp" />
202         </antcall>
203       </then>
204     </if>
205
206     <!--<antcall target="deploy.shellscr.apps" inheritrefs="true" />-->
207     <!-- Always build the shellscr stuff.-->
208     <antcall target="deploy.apps" inheritrefs="true" >
209       <param name="org.bedework.deploy.kind" value="shellscr" />
210     </antcall>
211
212     <!-- <antcall target="deploy.portal.apps" inheritrefs="true" />-->
213     <if>
214       <isset property="org.bedework.global.portal.platform" />
215       <then>
216         <antcall target="deploy.apps" inheritrefs="true" >
217           <param name="org.bedework.deploy.kind"
218                  value="${org.bedework.global.portal.platform}" />
219         </antcall>
220       </then>
221     </if>
222
223     <!-- <antcall target="deploy.j2ee.apps" inheritrefs="true" />-->
224     <if>
225       <isset property="org.bedework.global.j2ee.platform" />
226       <then>
227         <antcall target="deploy.apps" inheritrefs="true" >
228           <param name="org.bedework.deploy.kind"
229                  value="${org.bedework.global.j2ee.platform}" />
230         </antcall>
231       </then>
232     </if>
233
234     <!-- copy startup website that sends you to the applications -->
235     <delete dir="${webapp.root.dir}/bedework"/>
236     <mkdir dir="${webapp.root.dir}/bedework"/>
237     <copy todir="${webapp.root.dir}/bedework">
238       <fileset dir="${app.root.dir}/resources/bedework"/>
239     </copy>
240
241     <!-- copy libs that the application server needs -->
242     <antcall target="deploy.appserver.jdbcdriver" inheritrefs="true" />
243     <antcall target="deploy.appserver.javatools" inheritrefs="true" />
244   </target>
245
246   <!-- =================================================================
247        Targets called by the deploy target. Each is conditional on a
248        config property and each executes a build file in a subdirectory of
249        this component.
250        ================================================================= -->
251
252   <!-- The cp.xalan task conditionally copies the xalan.jar file, if
253        necessary -->
254   <target name="cp.xalan" if="xalan.in.tomcat.common.endorsed">
255     <copy file="${org.bedework.default.lib}/xalan.jar"
256           todir="${appserver.endorsed.dir}"/>
257   </target>
258
259   <target name="deploy.appserver.jdbcdriver"
260           if="appserver.jdbcdriver.jar" >
261     <!-- copy jdbc jar so datasources work -->
262     <copy todir="${appserver.lib.dir}" file="${appserver.jdbcdriver.jar}"/>
263   </target>
264
265   <target name="deploy.appserver.javatools"
266           if="java.tools.jar" >
267     <!-- copy tools jar so jsps work -->
268     <copy todir="${appserver.lib.dir}" file="${java.tools.jar}"/>
269   </target>
270
271   <!-- =================================================================
272        Targets called by the build.configured target. Each is conditional on a
273        config property and each executes a build file in a subdirectory of
274        this component.
275        ================================================================= -->
276   <target name="build.configured.apps">
277     <forEachApp names="${org.bedework.install.app.names}"
278                 prefix="org.bedework.deploy"
279                 appPrefix="org.bedework.app"
280                 projectPrefix="org.bedework.project">
281       <sequential>
282         <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
283                    property="app.kind.available" />
284         <antcall target="build.available.configured.app" inheritrefs="true" />
285       </sequential>
286     </forEachApp>
287
288     <!-- ======================= termination tasks ================= -->
289     <!--
290     <property name="org.bedework.deploy.type.dir"
291               location="${org.bedework.deployment.base}/termination" />
292               -->
293
294     <ant antfile="${org.bedework.deployment.base}/termination/build.xml"
295          inheritrefs="true" target="build.configured" />
296   </target>
297
298   <target name="build.available.configured.app" if="app.kind.available">
299     <!-- Pick out the application build properties based on the prefix "org.bedework.app."
300          and the deployment name -->
301     <propertyset id="build-app-properties">
302       <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
303       <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
304     </propertyset>
305   </target>
306
307   <target name="deploy.apps">
308     <forEachApp names="${org.bedework.install.app.names}"
309                 prefix="org.bedework.deploy"
310                 appPrefix="org.bedework.app"
311                 projectPrefix="org.bedework.project">
312       <sequential>
313         <antcall target="deploy.available.app" inheritrefs="true" />
314       </sequential>
315     </forEachApp>
316
317     <!-- ======================= termination tasks ================= -->
318
319     <ant antfile="${org.bedework.deployment.base}/termination/${org.bedework.deploy.kind}/build.xml"
320          inheritrefs="true" target="deploy" />
321   </target>
322
323   <target name="deploy.available.app">
324     <if>
325       <available file="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"/>
326       <then>
327         <propertyset id="deploy-app-properties">
328           <propertyref prefix="org.bedework.app.${org.bedework.deploy.name}"/>
329           <globmapper from="org.bedework.app.${org.bedework.deploy.name}.*" to="propval.app.*"/>
330         </propertyset>
331
332         <ant antfile="${org.bedework.deploy.type.dir}/${org.bedework.deploy.kind}/build.xml"
333              inheritrefs="true" target="deploy" >
334           <propertyset refid="deploy-app-properties" />
335         </ant>
336       </then>
337     </if>
338   </target>
339 </project>
340
Note: See TracBrowser for help on using the browser.