root/trunk/deployment/build.xml

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

Further changes to the build.

Delete (most of) the jar files from the lib directory - we are downloading them from bedework.org at build time.

Use a macro to load the deployment properties adn define some deployment proeprties based on the run time options.

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