preliminary checkin of documentation files
[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">
152       <src path="source"/>
153       <src path="etc/extrasource"/>
154       <classpath refid="project.classpath"/>
155     </javac>
156
157     <jar
158        jarfile="${build.jars}/mir.jar">
159       <fileset dir="${build.classes}" includes="**/*.class" />
160       <manifest>
161         <attribute name="Built-By" value="${user.name}"/>
162       </manifest>
163     </jar>
164   </target>
165
166   <!-- compile a debuggable version -->
167   <target name="compile-debug" depends="prepare-compilation">
168     <javac destdir="${build.classes}"
169            debug="on" optimize="off" deprecation="on">
170       <src path="source"/>
171       <src path="etc/extrasource"/>
172       <classpath refid="project.classpath"/>
173     </javac>
174   </target>
175
176
177   <!-- build the project's javadoc -->
178   <target name="javadoc" depends="prepare-javadoc">
179     <javadoc
180         destdir="${build.javadoc}"
181         author="true"
182         version="true"
183         use="true"
184         packagenames="mir.*,mircoders.*"
185         sourcepath="source"
186         sourcefiles="source/Mir.java,source/OpenMir.java"
187         windowtitle="Mir">
188
189       <classpath refid="project.classpath"/>
190       <link href="http://java.sun.com/j2se/1.3/docs/api"/>
191     </javadoc>
192   </target>
193
194   <target name="prepare-javadoc">
195     <mkdir  dir="${build.javadoc}"/>
196   </target>
197
198   <target name="prepare-binary-distribution">
199     <mkdir  dir="${distribution.home}"/>
200     <delete dir="${build}/binarydist"/>
201     <mkdir  dir="${build}/binarydist"/>
202   </target>
203
204   <target name="binary-distribution" depends="prepare-binary-distribution">
205     <antcall target="generate-deployment-tree">
206       <param name="destination" value="${build}/binarydist"/>
207     </antcall>
208
209     <zip zipfile="${distribution.home}/binary.zip" >
210       <fileset dir="${build}/binarydist" includes="**/*" />
211     </zip>
212   </target>
213
214   <target name="prepare-source-distribution">
215     <mkdir  dir="${distribution.home}"/>
216   </target>
217
218   <target name="source-distribution" depends="prepare-source-distribution">
219     <zip zipfile="${distribution.home}/source.zip" >
220       <fileset dir="."
221         includes="bundles/**/*,source/**/*,etc/**/*,meta/**/*,web/**/*,templates/**/*,dbscripts/**/*,lib/**/*,doc/**/*,build.xml" />
222     </zip>
223
224   </target>
225   
226 <!--  
227   
228   <target name="documentation-pdf" description="generates documentation into html form">
229       <xslt in="${temp}/docs/pdf/${document}.xml"
230             out="${temp}/docs/pdf/${document}.fo"
231             style=""/>
232
233       <java classname="org.apache.fop.apps.Fop" fork="yes">
234           <classpath>
235               <fileset dir="lib">
236                   <include name="*.jar"/>
237               </fileset>
238           </classpath>
239
240           <arg value="-fo"/>
241           <arg file="${temp}/docs/pdf/${document}.fo"/>
242           <arg file="${build}/pdfdocs/${document}.pdf"/>
243       </java>
244   </target>
245 -->  
246   <target name="prepare-html">
247     <mkdir dir="${build}/xslt"/>
248  
249     <unzip dest="${build}/xslt" src="doc/lib/docbook-xsl-1.66.1.zip"/>
250  
251     <copy todir="${build}/xslt">
252       <fileset dir="doc/style">
253         <include name="*"/>
254       </fileset>
255     </copy>
256   </target>
257   
258   <target name="documentation-html" description="generates documentation into html form" depends="prepare-html">
259     <mkdir dir="${build}/htmldocs"/>
260
261     <xslt basedir="doc/installation" includes="*.xml"
262           destdir="${build}/htmldocs"
263           style="${build}/xslt/html.xsl"/>
264   </target>
265   
266
267 </project>