introduction of the change engine
[mir.git] / build.xml
1 <project name="Mir" default="deploy" basedir=".">
2   <!--
3     - Build script for the Mir project
4     -
5     - usefull tasks are:
6     -   * compile
7     -        Creates the jars needed for a mir deployment
8     -   * deploy
9     -        Sets up a deployment directory
10     -   * binary-distribution
11     -        Sets up a distributable version of mir in the
12     -        form of a war file
13     -   * source-distribution
14     -        Sets up a distributable version of mir as a
15     -        zipped version of the source tree
16     -   * javadoc
17     -        Generates the project's javadoc
18     -->
19
20   <property name="version"        value="1.1.0rc0"/>
21
22   <property name="app.name"       value="mir"/>
23
24   <!-- -->
25   <property name="deploy.home"    value="./bin/${app.name}"/>
26
27   <!-- The distribution will be built here: -->
28   <property name="distribution.home"      value="./dist"/>
29
30
31
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"/>
38
39   <!-- retrieve environment variables -->
40   <property environment="env"/>
41
42   <property name="tomcat.home"    value="${env.TOMCAT_HOME}"/>
43
44 <!--
45   <property name="compile.optimize" value="off" />
46   <property name="compile.debug" value="on" />
47   -->
48
49   <target name="deploy" depends="compile,generate-deployment-tree" 
50       description="Sets up a deployment directory">
51   </target>
52
53   <target name="debug" depends="compile-debug,generate-deployment-tree"
54       description="Sets up a deployment directory with debug enabled">
55   </target>
56
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"/>
64
65     <copy todir="${destination}">
66       <fileset dir="web"/>
67     </copy>
68
69     <copy todir="${destination}/WEB-INF/etc">
70       <fileset dir="etc" excludes="extrasource,extralib"/>
71     </copy>
72
73     <copy todir="${destination}/WEB-INF">
74       <fileset dir="meta"/>
75     </copy>
76
77     <copy todir="${destination}/WEB-INF/templates">
78       <fileset dir="templates"/>
79     </copy>
80
81     <copy todir="${destination}/WEB-INF/bundles">
82       <fileset dir="bundles"/>
83     </copy>
84
85     <copy todir="${destination}/WEB-INF" file="source/default.properties" />
86
87     <copy todir="${destination}/WEB-INF/lib">
88       <fileset dir="lib" />
89       <fileset dir="etc/extralib" />
90       <fileset dir="${build.jars}" />
91     </copy>
92   </target>
93
94   <target name="clean">
95     <delete dir="${build}"/>
96   </target>
97
98   <!-- Construct the classpath -->
99   <path id="project.classpath">
100     <fileset dir="lib">
101       <include name="*.jar"/>
102     </fileset>
103     <fileset dir="etc/extralib">
104       <include name="*.jar"/>
105     </fileset>
106
107     <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
108
109     <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
110     <fileset dir="${tomcat.home}">
111                   <include name="lib/common/*.jar" />
112           </fileset>
113     <!-- for libs shared between webapps (tomcat 3.3.x) -->
114           <fileset dir="${tomcat.home}">
115                   <include name="lib/apps/*.jar" />
116           </fileset>
117     <!-- for libs shared between tomcat and webapps (tomcat 4.x.x) -->
118           <fileset dir="${tomcat.home}">
119                   <include name="common/lib/*.jar" />
120           </fileset>
121     <!-- for libs shared between webapps (tomcat 4.0.x) -->
122           <fileset dir="${tomcat.home}">
123                   <include name="lib/*.jar" />
124           </fileset>
125     <!-- for libs shared between webapps (tomcat 4.1.x) -->
126           <fileset dir="${tomcat.home}">
127                   <include name="shared/lib/*.jar" />
128           </fileset>
129
130           <fileset dir="${tomcat.home}">
131                   <include name="common/endorsed/*.jar" />
132           </fileset>
133   </path>
134
135
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="*"/>
144     </uptodate>
145   </target>
146
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">
150           
151     <javac destdir="${build.classes}" debug="true" deprecation="off" source="1.3">
152       <src path="source"/>
153       <src path="etc/extrasource"/>
154       <classpath refid="project.classpath"/>
155     </javac>
156
157     <delete file="${build.jars}/mir.jar"/>
158
159     <jar
160        jarfile="${build.jars}/mir.jar">
161       <fileset dir="${build.classes}" includes="**/*.class" />
162       <manifest>
163         <attribute name="Built-By" value="${user.name}"/>
164       </manifest>
165     </jar>
166   </target>
167
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">
172       <src path="source"/>
173       <src path="etc/extrasource"/>
174       <classpath refid="project.classpath"/>
175     </javac>
176   </target>
177
178
179   <!-- build the project's javadoc -->
180   <target name="javadoc" depends="prepare-javadoc">
181     <javadoc
182         destdir="${build.javadoc}"
183         author="true"
184         version="true"
185         use="true"
186         packagenames="mir.*,mircoders.*"
187         sourcepath="source"
188         sourcefiles="source/Mir.java,source/OpenMir.java"
189         windowtitle="Mir">
190
191       <classpath refid="project.classpath"/>
192       <link href="http://java.sun.com/j2se/1.3/docs/api"/>
193     </javadoc>
194   </target>
195
196   <target name="prepare-javadoc">
197     <mkdir  dir="${build.javadoc}"/>
198   </target>
199
200   <target name="prepare-distribution">
201     <mkdir  dir="${distribution.home}"/>
202     <delete dir="${build}/dist"/>
203     <mkdir  dir="${build}/dist"/>
204   </target>
205
206   <target name="distribution" depends="prepare-distribution">
207     <antcall target="generate-deployment-tree">
208       <param name="destination" value="${build}/dist"/>
209     </antcall>
210
211     <tar tarfile="${distribution.home}/mir-${version}.tar.gz" compression="gzip">
212       <tarfileset dir="${build}/binarydist" includes="**/*" />
213     </tar>
214   </target>
215
216   <target name="prepare-source-distribution">
217     <mkdir  dir="${distribution.home}"/>
218   </target>
219
220   <target name="source-distribution" depends="prepare-source-distribution">
221     <zip zipfile="${distribution.home}/source.zip" >
222       <fileset dir="."
223         includes="bundles/**/*,source/**/*,etc/**/*,meta/**/*,web/**/*,templates/**/*,dbscripts/**/*,lib/**/*,doc/**/*,build.xml" />
224     </zip>
225
226   </target>
227   
228 <!--  
229   
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"
233             style=""/>
234
235       <java classname="org.apache.fop.apps.Fop" fork="yes">
236           <classpath>
237               <fileset dir="lib">
238                   <include name="*.jar"/>
239               </fileset>
240           </classpath>
241
242           <arg value="-fo"/>
243           <arg file="${temp}/docs/pdf/${document}.fo"/>
244           <arg file="${build}/pdfdocs/${document}.pdf"/>
245       </java>
246   </target>
247 -->  
248   <target name="prepare-html">
249     <mkdir dir="${build}/xslt"/>
250  
251     <unzip dest="${build}/xslt" src="doc/lib/docbook-xsl-1.66.1.zip"/>
252  
253     <copy todir="${build}/xslt">
254       <fileset dir="doc/style">
255         <include name="*"/>
256       </fileset>
257     </copy>
258   </target>
259   
260   <target name="documentation-html" description="generates documentation into html form" depends="prepare-html">
261     <mkdir dir="${build}/htmldocs"/>
262
263     <xslt basedir="doc/installation" includes="*.xml"
264           destdir="${build}/htmldocs"
265           style="${build}/xslt/html.xsl"/>
266   </target>
267   
268
269 </project>