direct-io.hg

view tools/control/build-web.xml @ 875:ad4db8b417c1

bitkeeper revision 1.547 (3fa3dd2aH8eamu3ONvYovJgq8wBNbQ)

Many files:
Fixes to the DOM0 interface and domain building code. Ready for new save/restore dom0_ops.
author kaf24@scramble.cl.cam.ac.uk
date Sat Nov 01 16:19:54 2003 +0000 (2003-11-01)
parents cae97f492816
children
line source
1 <!--
2 General purpose build script for web applications and web services,
3 including enhanced support for deploying directly to a Tomcat 4
4 based server.
6 This build script assumes that the source code of your web application
7 is organized into the following subdirectories underneath the source
8 code directory from which you execute the build script:
10 docs Static documentation files to be copied to
11 the "docs" subdirectory of your distribution.
13 src Java source code (and associated resource files)
14 to be compiled to the "WEB-INF/classes"
15 subdirectory of your web applicaiton.
17 web Static HTML, JSP, and other content (such as
18 image files), including the WEB-INF subdirectory
19 and its configuration file contents.
21 $Id: build.xml.txt,v 1.7 2002/12/28 09:08:58 jfclere Exp $
22 -->
25 <!-- A "project" describes a set of targets that may be requested
26 when Ant is executed. The "default" attribute defines the
27 target which is executed if no specific target is requested,
28 and the "basedir" attribute defines the current working directory
29 from which Ant executes the requested task. This is normally
30 set to the current working directory.
31 -->
33 <project name="xenctl web interface" default="compile" basedir=".">
37 <!-- ===================== Property Definitions =========================== -->
40 <!--
42 Each of the following properties are used in the build script.
43 Values for these properties are set by the first place they are
44 defined, from the following list:
46 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
48 * Definitions from a "build.properties" file in the top level
49 source directory of this application.
51 * Definitions from a "build.properties" file in the developer's
52 home directory.
54 * Default definitions in this build.xml file.
56 You will note below that property values can be composed based on the
57 contents of previously defined properties. This is a powerful technique
58 that helps you minimize the number of changes required when your development
59 environment is modified. Note that property composition is allowed within
60 "build.properties" files as well as in the "build.xml" script.
62 -->
64 <property file="build.properties"/>
65 <property file="${user.home}/build.properties"/>
68 <!-- ==================== File and Directory Names ======================== -->
71 <!--
73 These properties generally define file and directory names (or paths) that
74 affect where the build process stores its outputs.
76 app.name Base name of this application, used to
77 construct filenames and directories.
78 Defaults to "myapp".
80 app.path Context path to which this application should be
81 deployed (defaults to "/" plus the value of the
82 "app.name" property).
84 app.version Version number of this iteration of the application.
86 build.home The directory into which the "prepare" and
87 "compile" targets will generate their output.
88 Defaults to "build".
90 catalina.home The directory in which you have installed
91 a binary distribution of Tomcat 4. This will
92 be used by the "deploy" target.
94 dist.home The name of the base directory in which
95 distribution files are created.
96 Defaults to "dist".
98 manager.password The login password of a user that is assigned the
99 "manager" role (so that he or she can execute
100 commands via the "/manager" web application)
102 manager.url The URL of the "/manager" web application on the
103 Tomcat installation to which we will deploy web
104 applications and web services.
106 manager.username The login username of a user that is assigned the
107 "manager" role (so that he or she can execute
108 commands via the "/manager" web application)
110 -->
112 <property name="app.name" value="xenctl"/>
113 <property name="app.path" value="/${app.name}"/>
114 <property name="app.version" value="0.1-dev"/>
115 <property name="build.home" value="${basedir}/build-web"/>
116 <property name="catalina.home" value="../../../.."/> <!-- UPDATE THIS! -->
117 <property name="dist.home" value="${basedir}/dist-web"/>
118 <property name="src.home" value="${basedir}/src"/>
119 <property name="web.home" value="${basedir}/web"/>
122 <!-- ================== Custom Ant Task Definitions ======================= -->
125 <!--
127 These properties define custom tasks for the Ant build tool that interact
128 with the "/manager" web application installed with Tomcat 4. Before they
129 can be successfully utilized, you must perform the following steps:
131 - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
132 installation into the "lib" directory of your Ant installation.
134 - Create a "build.properties" file in your application's top-level
135 source directory (or your user login home directory) that defines
136 appropriate values for the "manager.password", "manager.url", and
137 "manager.username" properties described above.
139 For more information about the Manager web application, and the functionality
140 of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
142 -->
144 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
145 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>
146 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
147 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/>
150 <!-- ==================== Compilation Control Options ==================== -->
152 <!--
154 These properties control option settings on the Javac compiler when it
155 is invoked using the <javac> task.
157 compile.debug Should compilation include the debug option?
159 compile.deprecation Should compilation include the deprecation option?
161 compile.optimize Should compilation include the optimize option?
163 -->
165 <property name="compile.debug" value="true"/>
166 <property name="compile.deprecation" value="false"/>
167 <property name="compile.optimize" value="true"/>
171 <!-- ==================== External Dependencies =========================== -->
174 <!--
176 Use property values to define the locations of external JAR files on which
177 your application will depend. In general, these values will be used for
178 two purposes:
179 * Inclusion on the classpath that is passed to the Javac compiler
180 * Being copied into the "/WEB-INF/lib" directory during execution
181 of the "deploy" target.
183 Because we will automatically include all of the Java classes that Tomcat 4
184 exposes to web applications, we will not need to explicitly list any of those
185 dependencies. You only need to worry about external dependencies for JAR
186 files that you are going to include inside your "/WEB-INF/lib" directory.
188 -->
190 <!-- Dummy external dependency -->
191 <!--
192 <property name="foo.jar"
193 value="/path/to/foo.jar"/>
194 -->
197 <!-- ==================== Compilation Classpath =========================== -->
199 <!--
201 Rather than relying on the CLASSPATH environment variable, Ant includes
202 features that makes it easy to dynamically construct the classpath you
203 need for each compilation. The example below constructs the compile
204 classpath to include the servlet.jar file, as well as the other components
205 that Tomcat makes available to web applications automatically, plus anything
206 that you explicitly added.
208 -->
210 <path id="compile.classpath">
212 <!-- Include all JAR files that will be included in /WEB-INF/lib -->
213 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
214 <!--
215 <pathelement location="${foo.jar}"/>
216 -->
218 <!-- Include all elements that Tomcat exposes to applications -->
219 <pathelement location="${catalina.home}/common/classes"/>
220 <fileset dir="${catalina.home}/common/endorsed">
221 <include name="*.jar"/>
222 </fileset>
223 <fileset dir="${catalina.home}/common/lib">
224 <include name="*.jar"/>
225 </fileset>
226 <pathelement location="${catalina.home}/shared/classes"/>
227 <fileset dir="${catalina.home}/shared/lib">
228 <include name="*.jar"/>
229 </fileset>
231 </path>
235 <!-- ==================== All Target ====================================== -->
237 <!--
239 The "all" target is a shortcut for running the "clean" target followed
240 by the "compile" target, to force a complete recompile.
242 -->
244 <target name="all" depends="clean,compile"
245 description="Clean build and dist directories, then compile"/>
249 <!-- ==================== Clean Target ==================================== -->
251 <!--
253 The "clean" target deletes any previous "build" and "dist" directory,
254 so that you can be ensured the application can be built from scratch.
256 -->
258 <target name="clean"
259 description="Delete old build and dist directories">
260 <delete dir="${build.home}"/>
261 <delete dir="${dist.home}"/>
262 <exec executable="make" dir="${web.home}/tmpl"><arg value="clean"/></exec>
263 </target>
267 <!-- ==================== Compile Target ================================== -->
269 <!--
271 The "compile" target transforms source files (from your "src" directory)
272 into object files in the appropriate location in the build directory.
273 This example assumes that you will be including your classes in an
274 unpacked directory hierarchy under "/WEB-INF/classes".
276 -->
278 <target name="compile" depends="prepare"
279 description="Compile Java sources">
281 <!-- Compile Java classes as necessary -->
282 <mkdir dir="${build.home}/WEB-INF/classes"/>
283 <javac srcdir="${src.home}"
284 destdir="${build.home}/WEB-INF/classes"
285 debug="${compile.debug}"
286 deprecation="${compile.deprecation}"
287 optimize="${compile.optimize}">
288 <classpath refid="compile.classpath"/>
289 <include name="org/xenoserver/control/**"/>
290 <include name="org/xenoserver/web/**"/>
291 </javac>
293 <!-- Copy application resources -->
294 <copy todir="${build.home}/WEB-INF/classes">
295 <fileset dir="${src.home}" excludes="**/*.java"/>
296 </copy>
298 </target>
302 <!-- ==================== Dist Target ===================================== -->
305 <!--
307 The "dist" target creates a binary distribution of your application
308 in a directory structure ready to be archived in a tar.gz or zip file.
309 Note that this target depends on:
311 * "compile" so that the entire web application (including external
312 dependencies) will have been assembled
314 -->
316 <target name="dist" depends="compile"
317 description="Create binary distribution">
319 <!-- Create application JAR file -->
320 <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
321 basedir="${build.home}"/>
323 <!-- Copy additional files to ${dist.home} as necessary -->
325 </target>
329 <!-- ==================== Install Target ================================== -->
331 <!--
333 The "install" target tells the specified Tomcat 4 installation to dynamically
334 install this web application and make it available for execution. It does
335 *not* cause the existence of this web application to be remembered across
336 Tomcat restarts; if you restart the server, you will need to re-install all
337 this web application.
339 If you have already installed this application, and simply want Tomcat to
340 recognize that you have updated Java classes (or the web.xml file), use the
341 "reload" target instead.
343 NOTE: This target will only succeed if it is run from the same server that
344 Tomcat is running on.
346 NOTE: This is the logical opposite of the "remove" target.
348 -->
350 <target name="install" depends="compile"
351 description="Install application to servlet container">
353 <install url="${manager.url}"
354 username="${manager.username}"
355 password="${manager.password}"
356 path="${app.path}"
357 war="file://${build.home}"/>
359 </target>
362 <!-- ====================== List Target =================================== -->
364 <!--
366 The "list" target asks the specified Tomcat 4 installation to list the
367 currently running web applications, either loaded at startup time or
368 installed dynamically. It is useful to determine whether or not the
369 application you are currently developing has been installed.
371 -->
373 <target name="list"
374 description="List installed applications on servlet container">
376 <list url="${manager.url}"
377 username="${manager.username}"
378 password="${manager.password}"/>
380 </target>
383 <!-- ==================== Prepare Target ================================== -->
385 <!--
387 The "prepare" target is used to create the "build" destination directory,
388 and copy the static contents of your web application to it. If you need
389 to copy static files from external dependencies, you can customize the
390 contents of this task.
392 Normally, this task is executed indirectly when needed.
394 -->
396 <target name="prepare">
398 <!-- Create build directories as needed -->
399 <mkdir dir="${build.home}"/>
400 <mkdir dir="${build.home}/WEB-INF"/>
401 <mkdir dir="${build.home}/WEB-INF/classes"/>
402 <mkdir dir="${dist.home}"/>
404 <!-- create templates -->
405 <exec executable="make" dir="${web.home}/tmpl"/>
407 <!-- Copy static content of this web application -->
408 <copy todir="${build.home}">
409 <fileset dir="${web.home}"/>
410 </copy>
412 <!-- Copy external dependencies as required -->
413 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
414 <mkdir dir="${build.home}/WEB-INF/lib"/>
415 <!--
416 <copy todir="${build.home}/WEB-INF/lib" file="${foo.jar}"/>
417 -->
419 <!-- Copy static files from external dependencies as needed -->
420 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
422 </target>
425 <!-- ==================== Reload Target =================================== -->
427 <!--
429 The "reload" target tells the specified Tomcat 4 installation to dynamically
430 reload this web application, to reflect changes in the underlying classes or
431 the "web.xml" deployment descriptor.
433 -->
435 <target name="reload" depends="compile"
436 description="Reload application on servlet container">
438 <reload url="${manager.url}"
439 username="${manager.username}"
440 password="${manager.password}"
441 path="${app.path}"/>
443 </target>
446 <!-- ==================== Remove Target =================================== -->
448 <!--
450 The "remove" target tells the specified Tomcat 4 installation to dynamically
451 remove this web application from service.
453 NOTE: This is the logical opposite of the "install" target.
455 -->
457 <target name="remove"
458 description="Remove application on servlet container">
460 <remove url="${manager.url}"
461 username="${manager.username}"
462 password="${manager.password}"
463 path="${app.path}"/>
465 </target>
468 <target name="help">
469 <echo>all clean, them compile</echo>
470 <echo>dist create war file</echo>
471 <echo>install install application in servlet container</echo>
472 <echo>list list applications installed in servelet container</echo>
473 <echo>reload reload application in servlet container</echo>
474 <echo>remove dynamically remove web application</echo>
475 </target>
477 </project>