root/trunk/calendar3/deployment/build.xml

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

Fixes needed to resolve properties issues when applications are bundled together.

The result of bundling the applications is that the properties files are all on the same class path. This means that we cannot have one resource file per application, rather it's shared between all of them.

Rather than have client specific properties be based on a particular properties file they are now based on the context paramater bwappname. This is used to create a property name prefix which is then used to get client specific properties.

There is an additional section in the config/configs/democal.properties file which defiens the names and associated type of application.

Most application properties have changed and a few have been added. Watch out for the additonal properties

# uris to cross link apps - of dubious usefulness
org.bedework.global.public.admin.uri=/caladmin
org.bedework.global.public.calendar.uri=/cal
org.bedework.global.personal.calendar.uri=/ucal

Additional properties have also been added to each application section - <app-prefix> refers to the application specific part of the name, e.g. org.bedework.app.Caladmin

<app-prefix>.logprefix= value used for log messages
<app-prefix>.guestmode= true for config, public events client and public caldav, false elsewhere
<app-prefix>.publicadmin= true for public events admin client, false elsewhere
<app-prefix>.run.as.user= only present for pubcaldav(?), public events admin and public events client.

Created a new ant task to cycle through the above list of applications. Also made use of the ant propertyset task.

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