update
[mir.git] / build.xml
index 875cb2f..c6a64cc 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -1,7 +1,20 @@
 <project name="Mir" default="compile" basedir=".">
 
 
+<!-- What this file is all about
+
+     You can use this version of build.xml to use directly with ant
+     i.e. without the build.sh script. Simply call ant and let it all
+     happen.
+-->
+
 <!-- Property Definitions
+
+     Please not that only the first couple of properties have to be defined.
+     The rest, residing below the "no customization needed" line may be
+     customized if you know what you are doing. Else, leave the defaults
+     and use them to look up where ant places all the files.
+
      app.name          Base name of this application, used to
                        construct filenames and directories.
 
@@ -10,6 +23,9 @@
                        Normally, this will be the name of a
                        subdirectory under $TOMCAT_HOME/webapps.
 
+     deploy.classes    The name of the directory that will contain
+                       the class files.
+
      dist.home        The name of the base directory in which
                        distribution files are created.
 
                        Tomcat has been installed.  This value is
                        normally set automatically from the value
                        of the TOMCAT_HOME environment variable.
+
+       java.home          The location of your Java SDK.
+
+       java.localhome     Where your local java classes and jar files
+                       are located.
+
+       tomcat.home        The location of the tomcat root directory.
+
 -->
 
   <property name="app.name"       value="Mir"/>
   <property name="deploy.home"    value="../${app.name}"/>
+
+  <!-- If you want to use the very good jikes compiler, uncomment this -->
+  <!-- <property name="build.compiler"   value="jikes"/>-->
+
+
+<!-- No customization required after this line -->
+
+  <property environment="env"/>
   <property name="dist.home"      value="${deploy.home}"/>
+  <property name="deploy.webinf"  value="${deploy.home}/WEB-INF"/>
+  <property name="deploy.classes" value="${deploy.webinf}/classes"/>
   <property name="dist.src"       value="${app.name}.jar"/>
   <property name="dist.war"       value="${app.name}.war"/>
   <property name="javadoc.home"   value="${deploy.home}/javadoc"/>
+  <property name="tomcat.home"    value="${env.TOMCAT_HOME}"/>
+
+
+
+  <!-- Construct the classpath -->
+  <path id="project.class.path">
+    <pathelement path="${deploy.home}"/>
+    <pathelement path="${deploy.classes}"/>
+    <pathelement path="source"/>
+    <fileset dir="lib">
+      <include name="*.jar"/>
+    </fileset>
+    <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
+  <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
+       <fileset dir="${tomcat.home}">
+               <include name="lib/common/*.jar" />
+       </fileset>
+  <!-- for libs shared between webapps (tomcat 3.3.x) -->
+       <fileset dir="${tomcat.home}">
+               <include name="lib/apps/*.jar" />
+       </fileset>
+  <!-- for libs shared between tomcat and webapps (tomcat 4.0.x) -->
+       <fileset dir="${tomcat.home}">
+               <include name="common/lib/*.jar" />
+       </fileset>
+  <!-- for libs shared between webapps (tomcat 4.0.x) -->
+       <fileset dir="${tomcat.home}">
+               <include name="lib/*.jar" />
+       </fileset>
+  </path>
+
 
 
 <!-- The "prepare" target is used to construct the deployment home
 
     <mkdir  dir="${deploy.home}/WEB-INF"/>
     <copy  file="etc/web.xml"          tofile="${deploy.home}/WEB-INF/web.xml"/>
-    <copy  file="etc/${app.name}.conf" tofile="${deploy.home}/WEB-INF/${app.name}.conf"/>
-    <mkdir  dir="${deploy.home}/WEB-INF/classes"/>
+    <mkdir  dir="${deploy.classes}"/>
     <mkdir  dir="${deploy.home}/WEB-INF/lib"/>
     <copy todir="${deploy.home}/WEB-INF/lib">
-      <fileset dir="lib"/>
+      <fileset dir="lib">
+        <exclude name="ant.jar"/>
+        <exclude name="xerces.jar"/>
+      </fileset>
     </copy>
     <mkdir  dir="${javadoc.home}"/>
     <mkdir  dir="${deploy.home}/log"/>
   </target>
 
 
+
 <!-- The "clean" target removes the deployment home directory structure,
      so that the next time the "compile" target is requested, it will need
      to compile everything from scratch.
 
 
   <target name="clean">
+    <delete dir="${deploy.classes}"/>
+       <mkdir dir="${deploy.classes}"/>
+  </target>
+
+
+
+<!-- The "mrproper" target removes the entire deploy dir - including all
+       built pages and images.
+-->
+
+  <target name="mrproper">
     <delete dir="${deploy.home}"/>
   </target>
 
+  <!-- drop out if $TOMCAT_HOME is not set>-->
+  <target name="testtomcat" unless="tomcat.present">
+    <fail message="the $$TOMCAT_HOME environment variable is not set or is set to the wrong path. Please set it first. giving up!"/>
+  </target>
 
 <!-- The "compile" target is used to compile (or recompile) the Java classes
      that make up this web application.  The recommended source code directory
 -->
 
   <target name="compile" depends="prepare">
-    <javac srcdir="source" destdir="${deploy.home}/WEB-INF/classes"
-           classpath="${deploy.home}/WEB-INF/classes"
-           debug="on" optimize="off" deprecation="on"/>
-    <copy   todir="${deploy.home}/WEB-INF/classes">
+    <!-- check to see if $TOMCAT_HOME was set to something useful.. -->
+    <available file="${tomcat.home}/conf" property="tomcat.present"/>
+    <antcall target="testtomcat"/>
+
+    <!--<antcall target="clean"/>-->
+    <dependset>
+      <srcfileset
+        dir="source"
+        includes="**/*.java"/>
+      <srcfileset
+        dir="lib"
+        includes="*.jar"/>
+      <targetfileset
+        dir="${deploy.classes}"
+        includes="**/*.class"/>
+    </dependset>
+    <javac srcdir="source" destdir="${deploy.classes}"
+           debug="on" optimize="off" deprecation="on">
+      <classpath refid="project.class.path"/>
+    </javac>
+    <copy   todir="${deploy.classes}">
       <fileset dir="source" includes="**/*.properties"/>
     </copy>
+    <copy   todir="${deploy.home}">
+      <fileset dir="source" includes="**/content-types.properties"/>
+      <fileset dir="source" includes="**/server.xml"/>
+    </copy>
+    <copy   todir="${deploy.classes}/bundles">
+      <fileset dir="bundles" includes="**/*.properties"/>
+    </copy>
+  </target>
+
+
+
+  <target name="perms">
+       <exec executable="./perms.sh"/>
   </target>
 
 
 -->
 
   <target name="javadoc" depends="prepare">
-    <javadoc packagenames="mir.*, webdb.*"
-            sourcefiles="source/${app.name}.java"
+    <javadoc packagenames="mir.*, mircoders.*"
+            sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
             sourcepath="source"
-             destdir="${javadoc.home}"/>
+             destdir="${javadoc.home}">
+         <classpath refid="project.class.path"/>
+       </javadoc>
   </target>
 
 
      the source code for this application, if you wish to distribute
      that separately.
 -->
-
   <target name="dist" depends="prepare,compile">
+    <jar jarfile="${dist.home}/mirbase.jar"
+        includes="mir/**"
+        basedir="${deploy.classes}"/>
     <jar jarfile="${dist.home}/${dist.src}"
          basedir="./source"/>
     <jar jarfile="${dist.home}/${dist.war}"
-         basedir="${deploy.home}"/>
+         basedir="${deploy.home}"
+         excludes="${dist.war}"/>
   </target>
-</project>
\ No newline at end of file
+
+</project>