1 <project name="Mir" default="deploy" basedir=".">
3 - Build script for the Mir project
7 - Creates the jars needed for a mir deployment
9 - Sets up a deployment directory
10 - * binary-distribution
11 - Sets up a distributable version of mir in the
13 - * source-distribution
14 - Sets up a distributable version of mir as a
15 - zipped version of the source tree
17 - Generates the project's javadoc
20 <property name="version" value="1.1.0rc0"/>
22 <property name="app.name" value="mir"/>
25 <property name="deploy.home" value="./bin/${app.name}"/>
27 <!-- The distribution will be built here: -->
28 <property name="distribution.home" value="./dist"/>
32 <!-- The temporary files made during the build process
33 will be created here: -->
34 <property name="build" value="./build"/>
35 <property name="build.classes" value="./${build}/classes"/>
36 <property name="build.jars" value="./${build}/jars"/>
37 <property name="build.javadoc" value="${build}/javadoc"/>
39 <!-- retrieve environment variables -->
40 <property environment="env"/>
42 <property name="tomcat.home" value="${env.TOMCAT_HOME}"/>
45 <property name="compile.optimize" value="off" />
46 <property name="compile.debug" value="on" />
49 <target name="deploy" depends="compile,generate-deployment-tree"
50 description="Sets up a deployment directory">
53 <target name="debug" depends="compile-debug,generate-deployment-tree"
54 description="Sets up a deployment directory with debug enabled">
57 <target name="generate-deployment-tree">
58 <property name="destination" value="${deploy.home}"/>
59 <mkdir dir="${destination}"/>
60 <mkdir dir="${destination}/WEB-INF"/>
61 <delete dir="${destination}/WEB-INF/lib"/>
62 <mkdir dir="${destination}/WEB-INF/lib"/>
63 <mkdir dir="${destination}/WEB-INF/log"/>
65 <copy todir="${destination}">
69 <copy todir="${destination}/WEB-INF/etc">
70 <fileset dir="etc" excludes="extrasource,extralib"/>
73 <copy todir="${destination}/WEB-INF">
77 <copy todir="${destination}/WEB-INF/templates">
78 <fileset dir="templates"/>
81 <copy todir="${destination}/WEB-INF/bundles">
82 <fileset dir="bundles"/>
85 <copy todir="${destination}/WEB-INF" file="source/default.properties" />
87 <copy todir="${destination}/WEB-INF/lib">
89 <fileset dir="etc/extralib" />
90 <fileset dir="${build.jars}" />
95 <delete dir="${build}"/>
98 <!-- Construct the classpath -->
99 <path id="project.classpath">
101 <include name="*.jar"/>
103 <fileset dir="etc/extralib">
104 <include name="*.jar"/>
107 <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
109 <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
110 <fileset dir="${tomcat.home}">
111 <include name="lib/common/*.jar" />
113 <!-- for libs shared between webapps (tomcat 3.3.x) -->
114 <fileset dir="${tomcat.home}">
115 <include name="lib/apps/*.jar" />
117 <!-- for libs shared between tomcat and webapps (tomcat 4.x.x) -->
118 <fileset dir="${tomcat.home}">
119 <include name="common/lib/*.jar" />
121 <!-- for libs shared between webapps (tomcat 4.0.x) -->
122 <fileset dir="${tomcat.home}">
123 <include name="lib/*.jar" />
125 <!-- for libs shared between webapps (tomcat 4.1.x) -->
126 <fileset dir="${tomcat.home}">
127 <include name="shared/lib/*.jar" />
130 <fileset dir="${tomcat.home}">
131 <include name="common/endorsed/*.jar" />
136 <target name="prepare-compilation">
137 <mkdir dir="${build.classes}"/>
138 <mkdir dir="${build.jars}"/>
139 <uptodate property="up.to.date" targetfile="${build.jars}/mir.jar">
140 <srcfiles dir="source" includes="**/*.java"/>
141 <srcfiles dir="lib" includes="*.jar"/>
142 <srcfiles dir="etc/extrasource" includes="**/*"/>
143 <srcfiles dir="etc/extralib" includes="*"/>
147 <!-- compile target: compiles all files into the build/classes dir -->
148 <target name="compile" depends="prepare-compilation" unless="up.to.date"
149 description="Creates the jars needed for a mir deployment">
151 <javac destdir="${build.classes}" debug="true" deprecation="off" source="1.3">
153 <src path="etc/extrasource"/>
154 <classpath refid="project.classpath"/>
157 <delete file="${build.jars}/mir.jar"/>
160 jarfile="${build.jars}/mir.jar">
161 <fileset dir="${build.classes}" includes="**/*.class" />
163 <attribute name="Built-By" value="${user.name}"/>
168 <!-- compile a debuggable version -->
169 <target name="compile-debug" depends="prepare-compilation">
170 <javac destdir="${build.classes}"
171 debug="on" optimize="off" deprecation="on">
173 <src path="etc/extrasource"/>
174 <classpath refid="project.classpath"/>
179 <!-- build the project's javadoc -->
180 <target name="javadoc" depends="prepare-javadoc">
182 destdir="${build.javadoc}"
186 packagenames="mir.*,mircoders.*"
188 sourcefiles="source/Mir.java,source/OpenMir.java"
191 <classpath refid="project.classpath"/>
192 <link href="http://java.sun.com/j2se/1.3/docs/api"/>
196 <target name="prepare-javadoc">
197 <mkdir dir="${build.javadoc}"/>
200 <target name="prepare-distribution">
201 <mkdir dir="${distribution.home}"/>
202 <delete dir="${build}/dist"/>
203 <mkdir dir="${build}/dist"/>
206 <target name="distribution" depends="prepare-distribution">
207 <antcall target="generate-deployment-tree">
208 <param name="destination" value="${build}/dist"/>
211 <tar tarfile="${distribution.home}/mir-${version}.tar.gz" compression="gzip">
212 <tarfileset dir="${build}/binarydist" includes="**/*" />
216 <target name="prepare-source-distribution">
217 <mkdir dir="${distribution.home}"/>
220 <target name="source-distribution" depends="prepare-source-distribution">
221 <zip zipfile="${distribution.home}/source.zip" >
223 includes="bundles/**/*,source/**/*,etc/**/*,meta/**/*,web/**/*,templates/**/*,dbscripts/**/*,lib/**/*,doc/**/*,build.xml" />
230 <target name="documentation-pdf" description="generates documentation into html form">
231 <xslt in="${temp}/docs/pdf/${document}.xml"
232 out="${temp}/docs/pdf/${document}.fo"
235 <java classname="org.apache.fop.apps.Fop" fork="yes">
238 <include name="*.jar"/>
243 <arg file="${temp}/docs/pdf/${document}.fo"/>
244 <arg file="${build}/pdfdocs/${document}.pdf"/>
248 <target name="prepare-html">
249 <mkdir dir="${build}/xslt"/>
251 <unzip dest="${build}/xslt" src="doc/lib/docbook-xsl-1.66.1.zip"/>
253 <copy todir="${build}/xslt">
254 <fileset dir="doc/style">
260 <target name="documentation-html" description="generates documentation into html form" depends="prepare-html">
261 <mkdir dir="${build}/htmldocs"/>
263 <xslt basedir="doc/installation" includes="*.xml"
264 destdir="${build}/htmldocs"
265 style="${build}/xslt/html.xsl"/>