-<project name="Mir" default="compile" basedir=".">
+<project name="Mir" default="deploy" basedir=".">
+ <!--
+ - Build script for the Mir project
+ -
+ - usefull tasks are:
+ - * compile
+ - Creates the jars needed for a mir deployment
+ - * deploy
+ - Sets up a deployment directory
+ - * binary-distribution
+ - Sets up a distributable version of mir in the
+ - form of a war file
+ - * source-distribution
+ - Sets up a distributable version of mir as a
+ - gzipped tar version of the source tree
+ - * full-distribution
+ - Sets up a distributable version of mir in the
+ - form of a gzipped tar file with the sources
+ - * javadoc
+ - Generates the project's javadoc
+ -->
+
+ <property name="version" value="1.1.0rc0"/>
-<!-- Property Definitions
+ <property name="app.name" value="mir"/>
- 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.
+ <!-- -->
+ <property name="deploy.home" value="./bin/${app.name}"/>
- app.name Base name of this application, used to
- construct filenames and directories.
+ <!-- The distribution will be built here: -->
+ <property name="distribution.home" value="./dist"/>
- deploy.home The name of the directory into which the
- deployment hierarchy will be created.
- 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.
+ <!-- The temporary files made during the build process
+ will be created here: -->
+ <property name="build" value="./build"/>
+ <property name="build.classes" value="./${build}/classes"/>
+ <property name="build.jars" value="./${build}/jars"/>
+ <property name="build.javadoc" value="${build}/javadoc"/>
- dist.src The name of the distribution JAR file
- containing the application source code,
- to be stored in the "dist.home" directory.
- This filename should end with ".jar".
+ <!-- retrieve environment variables -->
+ <property environment="env"/>
- dist.war The name of the Web ARchive (WAR) file
- containing our deployable application.
- This filename should end with ".war".
+ <property name="tomcat.home" value="${env.TOMCAT_HOME}"/>
- javadoc.home The name of the base directory in which
- the JavaDoc documentation for this application
- is generated.
+<!--
+ <property name="compile.optimize" value="off" />
+ <property name="compile.debug" value="on" />
+ -->
- tomcat.home The name of the base directory in which
- Tomcat has been installed. This value is
- normally set automatically from the value
- of the TOMCAT_HOME environment variable.
+ <target name="deploy" depends="compile,generate-deployment-tree"
+ description="Sets up a deployment directory">
+ </target>
- java.home The location of your Java SDK.
+ <target name="debug" depends="compile-debug,generate-deployment-tree"
+ description="Sets up a deployment directory with debug enabled">
+ </target>
- java.localhome Where your local java classes and jar files
- are located.
+ <target name="generate-deployment-tree">
+ <property name="destination" value="${deploy.home}"/>
+ <mkdir dir="${destination}"/>
+ <mkdir dir="${destination}/WEB-INF"/>
+ <delete dir="${destination}/WEB-INF/lib"/>
+ <mkdir dir="${destination}/WEB-INF/lib"/>
+ <mkdir dir="${destination}/WEB-INF/log"/>
- tomcat.home The location of the tomcat root directory.
+ <copy todir="${destination}">
+ <fileset dir="web"/>
+ </copy>
--->
+ <copy todir="${destination}/WEB-INF/etc">
+ <fileset dir="etc" excludes="extrasource,extralib"/>
+ </copy>
- <property name="app.name" value="mir"/>
- <property name="deploy.home" value="./bin/${app.name}"/>
+ <copy todir="${destination}/WEB-INF">
+ <fileset dir="meta"/>
+ </copy>
- <!-- don't use unless your Jikes is >= v1.18 -->
- <!-- <property name="build.compiler" value="jikes"/>-->
+ <copy todir="${destination}/WEB-INF/templates">
+ <fileset dir="templates"/>
+ </copy>
+ <copy todir="${destination}/WEB-INF/bundles">
+ <fileset dir="bundles"/>
+ </copy>
-<!-- No customization required after this line -->
+ <copy todir="${destination}/WEB-INF" file="source/default.properties" />
- <property environment="env"/>
- <property file="build.properties"/>
- <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}"/>
- <property name="compile.optimize" value="off" />
- <property name="compile.debug" value="on" />
+ <copy todir="${destination}/WEB-INF/lib">
+ <fileset dir="lib" />
+ <fileset dir="etc/extralib" />
+ <fileset dir="${build.jars}" />
+ </copy>
+ </target>
+ <target name="clean">
+ <delete dir="${build}"/>
+ </target>
<!-- Construct the classpath -->
- <path id="project.class.path">
- <pathelement path="${deploy.home}"/>
- <pathelement path="${deploy.classes}"/>
- <pathelement path="source"/>
- <pathelement path="etc/extrasource"/>
+ <path id="project.classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
+ <fileset dir="etc/extralib">
+ <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.x.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>
+ <!-- for libs shared between webapps (tomcat 4.1.x) -->
+ <fileset dir="${tomcat.home}">
+ <include name="shared/lib/*.jar" />
+ </fileset>
+
+ <fileset dir="${tomcat.home}">
+ <include name="common/endorsed/*.jar" />
+ </fileset>
</path>
- <target name="prepare">
- <mkdir dir="${deploy.home}"/>
- <mkdir dir="${deploy.webinf}"/>
- <mkdir dir="${deploy.classes}"/>
- <mkdir dir="${deploy.webinf}/log"/>
- <copy todir="${deploy.home}">
- <fileset dir="web"/>
- </copy>
+ <target name="prepare-compilation">
+ <mkdir dir="${build.classes}"/>
+ <mkdir dir="${build.jars}"/>
+ <uptodate property="up.to.date" targetfile="${build.jars}/mir.jar">
+ <srcfiles dir="source" includes="**/*.java"/>
+ <srcfiles dir="lib" includes="*.jar"/>
+ <srcfiles dir="etc/extrasource" includes="**/*"/>
+ <srcfiles dir="etc/extralib" includes="*"/>
+ </uptodate>
+ </target>
- <copy todir="${deploy.webinf}/etc">
- <fileset dir="etc" excludes="bundles/** web.xml"/>
- </copy>
- <copy todir="${deploy.classes}/bundles">
- <fileset dir="etc/bundles"/>
- </copy>
- <copy todir="${deploy.webinf}" file="etc/web.xml"/>
+ <!-- compile target: compiles all files into the build/classes dir -->
+ <target name="compile" depends="prepare-compilation" unless="up.to.date"
+ description="Creates the jars needed for a mir deployment">
+
+ <javac destdir="${build.classes}" debug="true" deprecation="off" source="1.3">
+ <src path="source"/>
+ <src path="etc/extrasource"/>
+ <classpath refid="project.classpath"/>
+ </javac>
- <copy todir="${deploy.webinf}/templates">
- <fileset dir="templates"/>
- </copy>
-
- <copy todir="${deploy.webinf}" file="source/default.properties" />
-
- <copy todir="${deploy.classes}/bundles">
- <fileset dir="bundles"/>
- </copy>
-
- <copy todir="${deploy.home}/WEB-INF/lib">
- <fileset dir="lib">
- <exclude name="ant.jar"/>
- <exclude name="xerces.jar"/>
- </fileset>
- </copy>
+ <delete file="${build.jars}/mir.jar"/>
+
+ <jar
+ jarfile="${build.jars}/mir.jar">
+ <fileset dir="${build.classes}" includes="**/*.class" />
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ </manifest>
+ </jar>
</target>
- <target name="clean">
- <delete dir="${deploy.classes}"/>
- <mkdir dir="${deploy.classes}"/>
- </target>
-
- <target name="mrproper">
- <delete dir="${deploy.home}"/>
- </target>
-
- <target name="compile" depends="prepare">
- <dependset>
- <srcfileset
- dir="source"
- includes="**/*.java"/>
- <!-- ML: now why can't this be added?
- <srcfileset
- dir="etc/extrasource"
- includes="**/*.java"/> -->
- <srcfileset
- dir="lib"
- includes="*.jar"/>
- <targetfileset
- dir="${deploy.classes}"
- includes="**/*.class"/>
- </dependset>
- <javac destdir="${deploy.classes}"
- debug="${compile.debug}" optimize="${compile.optimize}" deprecation="on">
+ <!-- compile a debuggable version -->
+ <target name="compile-debug" depends="prepare-compilation">
+ <javac destdir="${build.classes}"
+ debug="on" optimize="off" deprecation="on">
<src path="source"/>
<src path="etc/extrasource"/>
- <classpath refid="project.class.path"/>
+ <classpath refid="project.classpath"/>
</javac>
</target>
- <target name="perms">
- <exec executable="./perms.sh"/>
+
+ <!-- build the project's javadoc -->
+ <target name="javadoc" depends="prepare-javadoc">
+ <javadoc
+ destdir="${build.javadoc}"
+ author="true"
+ version="true"
+ use="true"
+ packagenames="mir.*,mircoders.*"
+ sourcepath="source"
+ sourcefiles="source/Mir.java,source/OpenMir.java"
+ windowtitle="Mir">
+
+ <classpath refid="project.classpath"/>
+ <link href="http://java.sun.com/j2se/1.3/docs/api"/>
+ </javadoc>
+ </target>
+
+ <target name="prepare-javadoc">
+ <mkdir dir="${build.javadoc}"/>
</target>
- <target name="javadoc" depends="prepare">
- <javadoc packagenames="mir.*, mircoders.*"
- sourcefiles="source/Mir.java,source/OpenMir.java"
- sourcepath="source"
- destdir="${javadoc.home}">
- <classpath refid="project.class.path"/>
- </javadoc>
+ <target name="prepare-distribution">
+ <mkdir dir="${distribution.home}"/>
+ <delete dir="${build}/dist"/>
+ <mkdir dir="${build}/dist"/>
</target>
- <target name="all" depends="clean,prepare,compile,javadoc"/>
+ <target name="distribution" depends="prepare-distribution">
+ <antcall target="generate-deployment-tree">
+ <param name="destination" value="${build}/dist"/>
+ </antcall>
+
+ <tar tarfile="${distribution.home}/mir-${version}.tar.gz" compression="gzip">
+ <tarfileset dir="${build}/dist" includes="**/*" />
+ </tar>
+ </target>
+
+ <target name="prepare-source-distribution">
+ <mkdir dir="${distribution.home}"/>
+ </target>
+
+ <target name="source-distribution" depends="prepare-source-distribution">
+ <!--<zip zipfile="${distribution.home}/mir-source-${version}.zip" >
+ <fileset dir="."
+ includes="bundles/**/*,source/**/*,etc/**/*,meta/**/*,web/**/*,templates/**/*,dbscripts/**/*,lib/**/*,doc/**/*,build.xml" />
+ </zip>-->
+ <tar tarfile="${distribution.home}/mir-source-${version}.tar.gz" compression="gzip">
+ <tarfileset dir="."
+ includes="bundles/**/*,source/**/*,etc/**/*,meta/**/*,web/**/*,templates/**/*,dbscripts/**/*,lib/**/*,doc/**/*,build.xml" />
+ </tar>
+
+ </target>
+
+<!--
+
+ <target name="documentation-pdf" description="generates documentation into html form">
+ <xslt in="${temp}/docs/pdf/${document}.xml"
+ out="${temp}/docs/pdf/${document}.fo"
+ style=""/>
+
+ <java classname="org.apache.fop.apps.Fop" fork="yes">
+ <classpath>
+ <fileset dir="lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+
+ <arg value="-fo"/>
+ <arg file="${temp}/docs/pdf/${document}.fo"/>
+ <arg file="${build}/pdfdocs/${document}.pdf"/>
+ </java>
+ </target>
+-->
+ <target name="prepare-html">
+ <mkdir dir="${build}/xslt"/>
+
+ <unzip dest="${build}/xslt" src="doc/lib/docbook-xsl-1.70.1.zip"/>
+
+ <copy todir="${build}/xslt">
+ <fileset dir="doc/style">
+ <include name="*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="documentation-html" description="generates documentation into html form" depends="prepare-html">
+ <mkdir dir="${build}/htmldocs"/>
+
+ <xslt basedir="doc/installation" includes="*.xml"
+ destdir="${build}/htmldocs"
+ style="${build}/xslt/html.xsl"/>
+ </target>
+
+ <target name="full-distribution" depends="prepare-distribution,deploy,source-distribution">
+ <copy todir="${destination}/WEB-INF">
+ <fileset file="${distribution.home}/mir-source-${version}.tar.gz"/>
+ </copy>
+ <tar tarfile="${distribution.home}/mir-${version}.tar.gz" compression="gzip">
+ <tarfileset dir="bin" includes="**/*" />
+ </tar>
+ </target>
</project>