root/trunk/bedework/deployment/build.xml

Revision 952 (checked in by douglm, 7 years ago)

--

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