a little cleanup
[mir.git] / build.xml
1 <project name="Mir" default="compile" basedir=".">
2
3 <!-- Property Definitions
4
5      Please not that only the first couple of properties have to be defined.
6      The rest, residing below the "no customization needed" line may be
7      customized if you know what you are doing. Else, leave the defaults
8      and use them to look up where ant places all the files.
9
10      app.name          Base name of this application, used to
11                        construct filenames and directories.
12
13      deploy.home       The name of the directory into which the
14                        deployment hierarchy will be created.
15                        Normally, this will be the name of a
16                        subdirectory under $TOMCAT_HOME/webapps.
17
18      deploy.classes    The name of the directory that will contain
19                        the class files.
20
21      dist.home         The name of the base directory in which
22                        distribution files are created.
23
24      dist.src          The name of the distribution JAR file
25                        containing the application source code,
26                        to be stored in the "dist.home" directory.
27                        This filename should end with ".jar".
28
29      dist.war          The name of the Web ARchive (WAR) file
30                        containing our deployable application.
31                        This filename should end with ".war".
32
33      javadoc.home      The name of the base directory in which
34                        the JavaDoc documentation for this application
35                        is generated.
36
37      tomcat.home       The name of the base directory in which
38                        Tomcat has been installed.  This value is
39                        normally set automatically from the value
40                        of the TOMCAT_HOME environment variable.
41
42         java.home          The location of your Java SDK.
43
44         java.localhome     Where your local java classes and jar files
45                        are located.
46
47         tomcat.home        The location of the tomcat root directory.
48
49 -->
50
51   <property name="app.name"       value="mir"/>
52   <property name="deploy.home"    value="./bin/${app.name}"/>
53
54   <!-- don't use unless your Jikes is >= v1.18 -->
55   <!-- <property name="build.compiler"   value="jikes"/>-->
56
57
58 <!-- No customization required after this line -->
59
60   <property environment="env"/>
61   <property file="build.properties"/>
62   <property name="dist.home"      value="${deploy.home}"/>
63   <property name="deploy.webinf"  value="${deploy.home}/WEB-INF"/>
64   <property name="deploy.classes" value="${deploy.webinf}/classes"/>
65   <property name="dist.src"       value="${app.name}.jar"/>
66   <property name="dist.war"       value="${app.name}.war"/>
67   <property name="javadoc.home"   value="${deploy.home}/javadoc"/>
68   <property name="tomcat.home"    value="${env.TOMCAT_HOME}"/>
69   <property name="compile.optimize" value="off" />
70   <property name="compile.debug" value="on" />
71
72
73   <!-- Construct the classpath -->
74   <path id="project.class.path">
75     <pathelement path="${deploy.home}"/>
76     <pathelement path="${deploy.classes}"/>
77     <pathelement path="source"/>
78     <pathelement path="etc/extrasource"/>
79     <fileset dir="lib">
80       <include name="*.jar"/>
81     </fileset>
82
83     <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
84   <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
85         <fileset dir="${tomcat.home}">
86                 <include name="lib/common/*.jar" />
87         </fileset>
88   <!-- for libs shared between webapps (tomcat 3.3.x) -->
89         <fileset dir="${tomcat.home}">
90                 <include name="lib/apps/*.jar" />
91         </fileset>
92   <!-- for libs shared between tomcat and webapps (tomcat 4.x.x) -->
93         <fileset dir="${tomcat.home}">
94                 <include name="common/lib/*.jar" />
95         </fileset>
96   <!-- for libs shared between webapps (tomcat 4.0.x) -->
97         <fileset dir="${tomcat.home}">
98                 <include name="lib/*.jar" />
99         </fileset>
100   <!-- for libs shared between webapps (tomcat 4.1.x) -->
101         <fileset dir="${tomcat.home}">
102                 <include name="shared/lib/*.jar" />
103         </fileset>
104         <fileset dir="${tomcat.home}">
105                 <include name="common/endorsed/*.jar" />
106         </fileset>
107   </path>
108
109   <target name="prepare">
110     <mkdir  dir="${deploy.home}"/>
111     <mkdir  dir="${deploy.webinf}"/>
112     <mkdir  dir="${deploy.classes}"/>
113     <mkdir  dir="${deploy.webinf}/log"/>
114
115     <copy todir="${deploy.home}">
116       <fileset dir="web"/>
117     </copy>
118
119     <copy todir="${deploy.webinf}/etc">
120       <fileset dir="etc" excludes="bundles/** web.xml"/>
121     </copy>
122     <copy todir="${deploy.classes}/bundles">
123         <fileset dir="etc/bundles"/>
124     </copy>
125     <copy todir="${deploy.webinf}" file="etc/web.xml"/>
126
127     <copy todir="${deploy.webinf}/templates">
128       <fileset dir="templates"/>
129     </copy>
130     
131     <copy todir="${deploy.webinf}" file="source/default.properties" />
132     
133     <copy todir="${deploy.classes}/bundles">
134       <fileset dir="bundles"/>
135     </copy>
136     
137     <copy todir="${deploy.home}/WEB-INF/lib">
138       <fileset dir="lib" />
139     </copy>
140   </target>
141
142   <target name="clean">
143     <delete dir="${deploy.classes}"/>
144     <mkdir dir="${deploy.classes}"/>
145   </target>
146
147   <target name="mrproper">
148     <delete dir="${deploy.home}"/>
149   </target>
150   
151   <!-- drop out if $TOMCAT_HOME is not set>-->
152   <target name="testtomcat" unless="tomcat.present">
153     <fail message="the $$TOMCAT_HOME environment variable is not set or is set to the wrong path. Please set it first. giving up!"/>
154   </target>
155
156   <target name="compile" depends="prepare">
157     <!-- check to see if $TOMCAT_HOME was set to something useful.. -->
158     <available file="${tomcat.home}/conf" property="tomcat.present"/>
159     <antcall target="testtomcat"/>
160     <dependset>
161       <srcfileset dir="source" includes="**/*.java"/>
162       <srcfileset dir="lib" includes="*.jar"/>         
163       <targetfileset dir="${deploy.classes}" includes="**/*.class"/>
164         <!-- ML: now why can't this be added?
165       <srcfileset dir="etc/extrasource" includes="**/*.java"/> -->   
166     </dependset>
167     <javac destdir="${deploy.classes}"
168            debug="${compile.debug}" optimize="${compile.optimize}" deprecation="on">
169       <src path="source"/>
170       <src path="etc/extrasource"/>
171       <classpath refid="project.class.path"/>
172     </javac>
173   </target>
174
175   <target name="javadoc" depends="prepare">
176     <javadoc packagenames="mir.*, mircoders.*"
177              sourcefiles="source/Mir.java,source/OpenMir.java"
178              sourcepath="source"
179              destdir="${javadoc.home}">
180           <classpath refid="project.class.path"/>
181         </javadoc>
182   </target>
183
184   <target name="all" depends="clean,prepare,compile,javadoc"/>
185
186 </project>