Ok, big merge. here's the new xml-config stuff in action. There's a few
[mir.git] / build.xml
1 <project name="Mir" default="compile" basedir=".">
2
3
4 <!-- Property Definitions
5      app.name          Base name of this application, used to
6                        construct filenames and directories.
7
8      deploy.home       The name of the directory into which the
9                        deployment hierarchy will be created.
10                        Normally, this will be the name of a
11                        subdirectory under $TOMCAT_HOME/webapps.
12
13      dist.home         The name of the base directory in which
14                        distribution files are created.
15
16      dist.src          The name of the distribution JAR file
17                        containing the application source code,
18                        to be stored in the "dist.home" directory.
19                        This filename should end with ".jar".
20
21      dist.war          The name of the Web ARchive (WAR) file
22                        containing our deployable application.
23                        This filename should end with ".war".
24
25      javadoc.home      The name of the base directory in which
26                        the JavaDoc documentation for this application
27                        is generated.
28
29      tomcat.home       The name of the base directory in which
30                        Tomcat has been installed.  This value is
31                        normally set automatically from the value
32                        of the TOMCAT_HOME environment variable.
33 -->
34
35   <property name="app.name"       value="Mir"/>
36   <property name="deploy.home"    value="../${app.name}"/>
37   <property name="dist.home"      value="${deploy.home}"/>
38   <property name="dist.src"       value="${app.name}.jar"/>
39   <property name="dist.war"       value="${app.name}.war"/>
40   <property name="javadoc.home"   value="${deploy.home}/javadoc"/>
41   <property name="build.compiler"   value="jikes"/>
42
43
44 <!-- The "prepare" target is used to construct the deployment home
45      directory structure (if necessary), and to copy in static files
46      as required.  In the example below, Ant is instructed to create
47      the deployment directory, copy the contents of the "web/" source
48      hierarchy, and set up the WEB-INF subdirectory appropriately.
49 -->
50
51   <target name="prepare">
52     <mkdir  dir="${deploy.home}"/>
53     <copy todir="${deploy.home}">
54       <fileset dir="web"/>
55     </copy>
56     <mkdir  dir="${deploy.home}/templates"/>
57     <copy todir="${deploy.home}/templates">
58       <fileset dir="templates"/>
59     </copy>
60     <mkdir  dir="${deploy.home}/src"/>
61     <copy todir="${deploy.home}/src">
62       <fileset dir="source"/>
63     </copy>
64
65     <mkdir  dir="${deploy.home}/WEB-INF"/>
66     <copy  file="etc/web.xml"          tofile="${deploy.home}/WEB-INF/web.xml"/>
67     <mkdir  dir="${deploy.home}/WEB-INF/classes"/>
68     <mkdir  dir="${deploy.home}/WEB-INF/lib"/>
69     <copy todir="${deploy.home}/WEB-INF/lib">
70       <fileset dir="lib">
71         <exclude name="ant.jar"/>
72         <exclude name="xerces.jar"/>
73       </fileset>
74     </copy>
75     <mkdir  dir="${javadoc.home}"/>
76     <mkdir  dir="${deploy.home}/log"/>
77
78   </target>
79
80
81 <!-- The "clean" target removes the deployment home directory structure,
82      so that the next time the "compile" target is requested, it will need
83      to compile everything from scratch.
84 -->
85
86
87   <target name="clean">
88     <delete dir="${deploy.home}"/>
89   </target>
90
91
92 <!-- The "compile" target is used to compile (or recompile) the Java classes
93      that make up this web application.  The recommended source code directory
94      structure makes this very easy because the <javac> task automatically
95      works its way down a source code hierarchy and compiles any class that
96      has not yet been compiled, or where the source file is newer than the
97      class file.
98
99      Feel free to adjust the compilation option parameters (debug,
100      optimize, and deprecation) to suit your requirements.  It is also
101      possible to base them on properties, so that you can adjust this
102      behavior at runtime.
103
104      The "compile" task depends on the "prepare" task, so the deployment
105      home directory structure will be created if needed the first time.
106 -->
107
108   <target name="compile" depends="prepare">
109     <javac srcdir="source" destdir="${deploy.home}/WEB-INF/classes"
110            classpath="${deploy.home}/WEB-INF/classes"
111            debug="on" optimize="off" deprecation="on"/>
112     <copy   todir="${deploy.home}/WEB-INF/classes">
113       <fileset dir="source" includes="**/*.properties"/>
114     </copy>
115     <copy   todir="${deploy.home}">
116       <fileset dir="source" includes="**/content-types.properties"/>
117       <fileset dir="source" includes="**/server.xml"/>
118     </copy>
119   </target>
120
121
122 <!-- The "javadoc" target is used to create the Javadoc API documentation
123      for the Java classes in this web application.  It is assumed that
124      this documentation is included in the deployed application, so the
125      example below generates the Javadoc HTML files in a subdirectory under
126      the deployment home directory.  Feel free to customize the options for
127      the JavaDoc task, after consulting the Ant documentation.
128 -->
129
130   <target name="javadoc" depends="prepare">
131     <javadoc packagenames="mir.*, mircoders.*"
132              sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
133              sourcepath="source"
134              destdir="${javadoc.home}"/>
135   </target>
136
137
138 <!-- The "all" target rebuilds everything by executing the "clean"
139      target first, which forces the "compile" target to compile all
140      source code instead of just the files that have been changed.
141 -->
142
143   <target name="all" depends="clean,prepare,compile,javadoc"/>
144
145
146 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
147      for this application, suitable for distribution to sites that wish
148      to install your application.  It also creates a JAR file containing
149      the source code for this application, if you wish to distribute
150      that separately.
151 -->
152   <target name="dist" depends="prepare,compile">
153     <jar jarfile="mirbase.jar"
154          includes="mir/**"
155          basedir="../Mir/WEB-INF/classes"/>
156     <jar jarfile="${dist.src}"
157          basedir="./source"/>
158     <jar jarfile="${dist.war}"
159          basedir="${deploy.home}"/>
160   </target>
161
162 </project>