first attempt to support localization source
[mir.git] / build.xml
1 <project name="Mir" default="compile" basedir=".">
2
3
4 <!-- What this file is all about
5
6      You can use this version of build.xml to use directly with ant
7      i.e. without the build.sh script. Simply call ant and let it all
8      happen.
9 -->
10
11 <!-- Property Definitions
12
13      Please not that only the first couple of properties have to be defined.
14      The rest, residing below the "no customization needed" line may be
15      customized if you know what you are doing. Else, leave the defaults
16      and use them to look up where ant places all the files.
17
18      app.name          Base name of this application, used to
19                        construct filenames and directories.
20
21      deploy.home       The name of the directory into which the
22                        deployment hierarchy will be created.
23                        Normally, this will be the name of a
24                        subdirectory under $TOMCAT_HOME/webapps.
25
26      deploy.classes    The name of the directory that will contain
27                        the class files.
28
29      dist.home         The name of the base directory in which
30                        distribution files are created.
31
32      dist.src          The name of the distribution JAR file
33                        containing the application source code,
34                        to be stored in the "dist.home" directory.
35                        This filename should end with ".jar".
36
37      dist.war          The name of the Web ARchive (WAR) file
38                        containing our deployable application.
39                        This filename should end with ".war".
40
41      javadoc.home      The name of the base directory in which
42                        the JavaDoc documentation for this application
43                        is generated.
44
45      tomcat.home       The name of the base directory in which
46                        Tomcat has been installed.  This value is
47                        normally set automatically from the value
48                        of the TOMCAT_HOME environment variable.
49
50         java.home          The location of your Java SDK.
51
52         java.localhome     Where your local java classes and jar files
53                        are located.
54
55         tomcat.home        The location of the tomcat root directory.
56
57 -->
58
59   <property name="app.name"       value="Mir"/>
60   <property name="deploy.home"    value="../${app.name}"/>
61
62   <!-- don't use unless your Jikes is >= v1.17 and you know what you are doing -->
63   <!-- <property name="build.compiler"   value="jikes"/>-->
64
65
66 <!-- No customization required after this line -->
67
68   <property environment="env"/>
69   <property name="dist.home"      value="${deploy.home}"/>
70   <property name="deploy.webinf"  value="${deploy.home}/WEB-INF"/>
71   <property name="deploy.classes" value="${deploy.webinf}/classes"/>
72   <property name="dist.src"       value="${app.name}.jar"/>
73   <property name="dist.war"       value="${app.name}.war"/>
74   <property name="javadoc.home"   value="${deploy.home}/javadoc"/>
75   <property name="tomcat.home"    value="${env.TOMCAT_HOME}"/>
76
77
78
79   <!-- Construct the classpath -->
80   <path id="project.class.path">
81     <pathelement path="${deploy.home}"/>
82     <pathelement path="${deploy.classes}"/>
83     <pathelement path="source"/>
84     <pathelement path="etc/extrasource"/>
85     <fileset dir="lib">
86       <include name="*.jar"/>
87     </fileset>
88     <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
89   <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
90         <fileset dir="${tomcat.home}">
91                 <include name="lib/common/*.jar" />
92         </fileset>
93   <!-- for libs shared between webapps (tomcat 3.3.x) -->
94         <fileset dir="${tomcat.home}">
95                 <include name="lib/apps/*.jar" />
96         </fileset>
97   <!-- for libs shared between tomcat and webapps (tomcat 4.0.x) -->
98         <fileset dir="${tomcat.home}">
99                 <include name="common/lib/*.jar" />
100         </fileset>
101   <!-- for libs shared between webapps (tomcat 4.0.x) -->
102         <fileset dir="${tomcat.home}">
103                 <include name="lib/*.jar" />
104         </fileset>
105   </path>
106
107
108
109 <!-- The "prepare" target is used to construct the deployment home
110      directory structure (if necessary), and to copy in static files
111      as required.  In the example below, Ant is instructed to create
112      the deployment directory, copy the contents of the "web/" source
113      hierarchy, and set up the WEB-INF subdirectory appropriately.
114 -->
115
116   <target name="prepare">
117     <mkdir  dir="${deploy.home}"/>
118     <mkdir  dir="${deploy.webinf}"/>
119     <mkdir  dir="${deploy.classes}"/>
120     <mkdir  dir="${deploy.webinf}/log"/>
121
122     <copy todir="${deploy.home}">
123       <fileset dir="web"/>
124     </copy>
125
126     <copy todir="${deploy.webinf}/etc">
127       <fileset dir="etc" excludes="bundles/** web.xml"/>
128     </copy>
129     <copy todir="${deploy.classes}/bundles">
130         <fileset dir="etc/bundles"/>
131     </copy>
132     <copy todir="${deploy.webinf}" file="etc/web.xml"/>
133
134     <copy todir="${deploy.webinf}/templates">
135       <fileset dir="templates"/>
136     </copy>
137
138     <copy todir="${deploy.classes}/bundles">
139       <fileset dir="bundles"/>
140     </copy>
141
142     <copy todir="${deploy.home}/WEB-INF/lib">
143       <fileset dir="lib">
144         <exclude name="ant.jar"/>
145         <exclude name="xerces.jar"/>
146         <exclude name="servlet-2.2.jar"/>
147       </fileset>
148     </copy>
149   </target>
150
151
152
153 <!-- The "clean" target removes the deployment home directory structure,
154      so that the next time the "compile" target is requested, it will need
155      to compile everything from scratch.
156 -->
157
158
159   <target name="clean">
160     <delete dir="${deploy.classes}"/>
161     <mkdir dir="${deploy.classes}"/>
162   </target>
163
164
165
166 <!-- The "mrproper" target removes the entire deploy dir - including all
167         built pages and images.
168 -->
169
170   <target name="mrproper">
171     <delete dir="${deploy.home}"/>
172   </target>
173
174   <!-- drop out if $TOMCAT_HOME is not set>-->
175   <target name="testtomcat" unless="tomcat.present">
176     <fail message="the $$TOMCAT_HOME environment variable is not set or is set to the wrong path. Please set it first. giving up!"/>
177   </target>
178
179 <!-- The "compile" target is used to compile (or recompile) the Java classes
180      that make up this web application.  The recommended source code directory
181      structure makes this very easy because the <javac> task automatically
182      works its way down a source code hierarchy and compiles any class that
183      has not yet been compiled, or where the source file is newer than the
184      class file.
185
186      Feel free to adjust the compilation option parameters (debug,
187      optimize, and deprecation) to suit your requirements.  It is also
188      possible to base them on properties, so that you can adjust this
189      behavior at runtime.
190
191      The "compile" task depends on the "prepare" task, so the deployment
192      home directory structure will be created if needed the first time.
193 -->
194
195   <target name="compile" depends="prepare">
196     <!-- check to see if $TOMCAT_HOME was set to something useful.. -->
197     <available file="${tomcat.home}/conf" property="tomcat.present"/>
198     <antcall target="testtomcat"/>
199
200     <!--<antcall target="clean"/>-->
201     <dependset>
202       <srcfileset
203         dir="source"
204         includes="**/*.java"/>
205 <!-- ML: now why can't this be added?
206       <srcfileset
207         dir="etc/extrasource"
208         includes="**/*.java"/> -->
209       <srcfileset
210         dir="lib"
211         includes="*.jar"/>
212       <targetfileset
213         dir="${deploy.classes}"
214         includes="**/*.class"/>
215     </dependset>
216     <javac destdir="${deploy.classes}"
217            debug="on" optimize="off" deprecation="on">
218       <src path="source"/>
219       <src path="etc/extrasource"/>
220       <classpath refid="project.class.path"/>
221     </javac>
222   </target>
223
224
225
226   <target name="perms">
227     <exec executable="./perms.sh"/>
228   </target>
229
230
231 <!-- The "javadoc" target is used to create the Javadoc API documentation
232      for the Java classes in this web application.  It is assumed that
233      this documentation is included in the deployed application, so the
234      example below generates the Javadoc HTML files in a subdirectory under
235      the deployment home directory.  Feel free to customize the options for
236      the JavaDoc task, after consulting the Ant documentation.
237 -->
238
239   <target name="javadoc" depends="prepare">
240     <javadoc packagenames="mir.*, mircoders.*"
241              sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
242              sourcepath="source"
243              destdir="${javadoc.home}">
244           <classpath refid="project.class.path"/>
245         </javadoc>
246   </target>
247
248
249 <!-- The "all" target rebuilds everything by executing the "clean"
250      target first, which forces the "compile" target to compile all
251      source code instead of just the files that have been changed.
252 -->
253
254   <target name="all" depends="clean,prepare,compile,javadoc"/>
255
256
257 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
258      for this application, suitable for distribution to sites that wish
259      to install your application.  It also creates a JAR file containing
260      the source code for this application, if you wish to distribute
261      that separately.
262 -->
263   <target name="dist" depends="prepare,compile">
264     <jar jarfile="${dist.home}/mirbase.jar"
265          includes="mir/**"
266          basedir="${deploy.classes}"/>
267     <jar jarfile="${dist.home}/${dist.src}"
268          basedir="./source"/>
269     <jar jarfile="${dist.home}/${dist.war}"
270          basedir="${deploy.home}"
271          excludes="${dist.war}"/>
272   </target>
273
274 </project>