bugfixxes
[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
42
43 <!-- The "prepare" target is used to construct the deployment home
44      directory structure (if necessary), and to copy in static files
45      as required.  In the example below, Ant is instructed to create
46      the deployment directory, copy the contents of the "web/" source
47      hierarchy, and set up the WEB-INF subdirectory appropriately.
48 -->
49
50   <target name="prepare">
51     <mkdir  dir="${deploy.home}"/>
52     <copy todir="${deploy.home}">
53       <fileset dir="web"/>
54     </copy>
55     <mkdir  dir="${deploy.home}/templates"/>
56     <copy todir="${deploy.home}/templates">
57       <fileset dir="templates"/>
58     </copy>
59     <mkdir  dir="${deploy.home}/src"/>
60     <copy todir="${deploy.home}/src">
61       <fileset dir="source"/>
62     </copy>
63
64     <mkdir  dir="${deploy.home}/WEB-INF"/>
65     <copy  file="etc/web.xml"          tofile="${deploy.home}/WEB-INF/web.xml"/>
66     <mkdir  dir="${deploy.home}/WEB-INF/classes"/>
67     <mkdir  dir="${deploy.home}/WEB-INF/lib"/>
68     <copy todir="${deploy.home}/WEB-INF/lib">
69       <fileset dir="lib"/>
70     </copy>
71     <mkdir  dir="${javadoc.home}"/>
72     <mkdir  dir="${deploy.home}/log"/>
73
74   </target>
75
76
77 <!-- The "clean" target removes the deployment home directory structure,
78      so that the next time the "compile" target is requested, it will need
79      to compile everything from scratch.
80 -->
81
82
83   <target name="clean">
84     <delete dir="${deploy.home}"/>
85   </target>
86
87
88 <!-- The "compile" target is used to compile (or recompile) the Java classes
89      that make up this web application.  The recommended source code directory
90      structure makes this very easy because the <javac> task automatically
91      works its way down a source code hierarchy and compiles any class that
92      has not yet been compiled, or where the source file is newer than the
93      class file.
94
95      Feel free to adjust the compilation option parameters (debug,
96      optimize, and deprecation) to suit your requirements.  It is also
97      possible to base them on properties, so that you can adjust this
98      behavior at runtime.
99
100      The "compile" task depends on the "prepare" task, so the deployment
101      home directory structure will be created if needed the first time.
102 -->
103
104   <target name="compile" depends="prepare">
105     <javac srcdir="source" destdir="${deploy.home}/WEB-INF/classes"
106            classpath="${deploy.home}/WEB-INF/classes"
107            debug="on" optimize="off" deprecation="on"/>
108     <copy   todir="${deploy.home}/WEB-INF/classes">
109       <fileset dir="source" includes="**/*.properties"/>
110     </copy>
111   </target>
112
113
114 <!-- The "javadoc" target is used to create the Javadoc API documentation
115      for the Java classes in this web application.  It is assumed that
116      this documentation is included in the deployed application, so the
117      example below generates the Javadoc HTML files in a subdirectory under
118      the deployment home directory.  Feel free to customize the options for
119      the JavaDoc task, after consulting the Ant documentation.
120 -->
121
122   <target name="javadoc" depends="prepare">
123     <javadoc packagenames="mir.*, mircoders.*"
124              sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
125              sourcepath="source"
126              destdir="${javadoc.home}"/>
127   </target>
128
129
130 <!-- The "all" target rebuilds everything by executing the "clean"
131      target first, which forces the "compile" target to compile all
132      source code instead of just the files that have been changed.
133 -->
134
135   <target name="all" depends="clean,prepare,compile,javadoc"/>
136
137
138 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
139      for this application, suitable for distribution to sites that wish
140      to install your application.  It also creates a JAR file containing
141      the source code for this application, if you wish to distribute
142      that separately.
143 -->
144
145   <target name="dist" depends="prepare,compile">
146     <jar jarfile="${dist.home}/${dist.src}"
147          basedir="./source"/>
148     <jar jarfile="${dist.home}/${dist.war}"
149          basedir="${deploy.home}"/>
150   </target>
151 </project>