root/trunk/deployment/build.xml

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

More changes to the build process. Main build now pulls jars out of the archive and out of each projects bin directory.

Also remove some unused ant build code.

Not yet complete but close.

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