no stacktrace in logs, copyright header
[ical4j.git] / build.xml
blob85bc2fd8da14652ae18a8af94356dcf487e7cf6c
1 <?xml version="1.0"?>
3 <!--
4   - $Id: build.xml,v 1.26 2009/09/06 06:03:00 fortuna Exp $
5   -
6   - Ant build script for iCal4j project.
7   -->
8 <project name="iCal4j" basedir="." default="package">
10         <!-- Project details -->
11         <property name="project.version" value="1.0-beta2" />
13         <!-- Load overrides for library paths -->
14         <property file="build.properties" />
16         <!-- Project paths -->
17         <property name="source.dir" location="source" />
18         <property name="test.source.dir" location="test" />
19         <property name="output.dir" location="bin" />
20         <property name="package.dir" location="build" />
21         <property name="package.file" value="ical4j.jar" />
22         <property name="javadoc.dir" location="docs/api" />
23         <property name="javadoc.packages" value="net.fortuna.ical4j.*" />
24         <property name="dist.dir" location=".." />
25         <property name="dist.name" value="ical4j" />
26         <property name="dist.maven.file" value="${dist.name}-${project.version}-bundle.jar" />
28         <!-- Library paths -->
29         <property name="j2se.apiurl" value="http://java.sun.com/j2se/1.4/docs/api/" />
30         <property name="jakarta-commons-logging.apiurl" value="http://jakarta.apache.org/commons/logging/apidocs/" />
31         <property name="jakarta-commons-codec.apiurl" value="http://jakarta.apache.org/commons/codec/apidocs/" />
33         <!-- External tools -->
34         <property name="vzic.home" location="C:/Libs/vzic-1.3/" />
36         <path id="project.classpath">
37                 <pathelement location="lib/commons-logging.jar" />
38                 <pathelement location="lib/commons-codec.jar" />
39                 <pathelement location="lib/commons-lang.jar" />
40         <pathelement location="lib/backport-util-concurrent.jar" />
41                 <!--
42                 <pathelement location="${output.dir}"/>
43                 -->
44         </path>
46         <path id="coverage.classpath">
47                 <path refid="project.classpath" />
48                 <pathelement location="${output.dir}" />
49                 <pathelement location="etc" />
50         </path>
52         <!-- output directory used for EMMA coverage reports: -->
53         <property name="coverage.dir" value="${basedir}/coverage" />
54         <property name="out.instr.dir" value="${coverage.dir}/instr" />
56         <!-- directory that contains emma.jar and emma_ant.jar: -->
57         <property name="emma.dir" value="C:/Tools/emma-2.0.5312/lib" />
59         <!-- path element used by EMMA taskdef below: -->
60         <path id="emma.lib">
61                 <pathelement location="${emma.dir}/emma.jar" />
62                 <pathelement location="${emma.dir}/emma_ant.jar" />
63         </path>
65         <!-- this loads <emma> and <emmajava> custom tasks: -->
66         <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
68         <!-- Targets -->
70         <target name="emma" description="turns on EMMA's on-the-fly instrumentation mode">
71                 <property name="emma.enabled" value="false" />
73                 <!-- this property, if overriden via -Demma.filter=<list of filter specs>
74                  on ANT's command line, will set the coverage filter; by default,
75                  all classes found in 'run.classpath' pathref will be instrumented:
76             -->
77                 <property name="emma.filter" value="" />
78         </target>
80         <target name="clean-compile" description="Remove the result of compilation">
81                 <mkdir dir="${output.dir}" />
82                 <delete>
83                         <fileset dir="${output.dir}" />
84                 </delete>
85         </target>
87         <target name="clean-coverage" description="Remove the result of the coverage target">
88                 <mkdir dir="${coverage.dir}" />
89                 <delete>
90                         <fileset dir="${coverage.dir}" />
91                 </delete>
92                 <mkdir dir="${out.instr.dir}" />
93                 <delete>
94                         <fileset dir="${out.instr.dir}" />
95                 </delete>
96         </target>
98         <target name="compile" description="Compile the program">
99                 <echo message="Compiling source from classpath: ${project.classpath}" />
100                 <mkdir dir="${output.dir}" />
102                 <copy file="${source.dir}/net/fortuna/ical4j/model/tz.alias" todir="${output.dir}/net/fortuna/ical4j/model" />
104                 <javac source="1.4" target="1.4" srcdir="${source.dir}" destdir="${output.dir}" debug="true" debuglevel="lines,source,vars" deprecation="true" classpathref="project.classpath" />
105         </target>
107         <target name="compile-tests" description="Compile the tests">
108                 <echo message="Compiling tests from classpath: ${project.classpath}" />
109                 <javac srcdir="${test.source.dir}" destdir="${output.dir}" debug="false" deprecation="true" classpathref="project.classpath" />
110         </target>
112         <target name="clean-package" description="Remove the results of the package target">
113                 <mkdir dir="${package.dir}" />
114                 <delete>
115                         <fileset dir="${package.dir}" />
116                 </delete>
117         </target>
119         <target name="package" depends="compile, clean-package"
120                 description="Create the .jar file">
121                 <manifest file="etc/manifest.mf">
122                         <!-- Add manifest attributes here.. -->
123                         <attribute name="Class-Path" value="commons-logging.jar,commons-codec.jar,commons-lang.jar" />
124                 </manifest>
125                 <jar basedir="${output.dir}" compress="true" jarfile="${package.dir}/${package.file}" manifest="etc/manifest.mf">
126                         <zipfileset dir="etc/zoneinfo" prefix="zoneinfo" excludes="zones.h,zones.tab" />
127                 </jar>
128         </target>
130         <target name="clean-javadoc" description="Remove the Javadoc files">
131                 <mkdir dir="${javadoc.dir}" />
132                 <delete>
133                         <fileset dir="${javadoc.dir}" />
134                 </delete>
135         </target>
137         <target name="javadoc" depends="clean-javadoc" description="Create the Javadoc API documentation">
138                 <echo message="Generating Javadocs from classpath: ${project.classpath}" />
139                 <javadoc sourcepath="${source.dir}" destdir="${javadoc.dir}" packagenames="${javadoc.packages}" Windowtitle="${ant.project.name}" Doctitle="${ant.project.name}" Overview="etc/overview.html" classpathref="project.classpath">
140                         <link href="${j2se.apiurl}" />
141                         <link href="${jakarta-commons-logging.apiurl}" />
142                         <link href="${jakarta-commons-codec.apiurl}" />
143                 </javadoc>
144         </target>
146         <!-- Source distribution -->
147         <target name="dist-src" depends="clean-compile, clean-package, javadoc"
148                 description="Create the source distribution">
149                 <zip zipfile="${dist.dir}/${dist.name}-${project.version}-src.zip">
150                         <zipfileset dir="." prefix="${dist.name}-${project.version}" excludes="coverage/**/*" />
151                 </zip>
152         </target>
154         <!-- Binary distribution -->
155         <target name="dist" depends="clean-compile, package, javadoc"
156                 description="Create the binary distribution">
157                 <zip zipfile="${dist.dir}/${dist.name}-${project.version}.zip">
158                         <zipfileset dir="." prefix="${dist.name}-${project.version}" includes="LICENSE,CHANGELOG,README" />
159                         <zipfileset dir="docs" prefix="${dist.name}-${project.version}/docs" />
160                         <zipfileset dir="etc" prefix="${dist.name}-${project.version}/etc" includes="FAQ,TODO,rfc2445.txt,samples/**" />
161                         <zipfileset dir="${package.dir}" prefix="${dist.name}-${project.version}/lib" />
162                         <zipfileset dir="lib" prefix="${dist.name}-${project.version}/lib" />
163                 </zip>
164         </target>
166         <!-- Maven distribution -->
167         <target name="dist-maven" depends="clean-compile, package"
168                 description="Create the Maven distribution">
169                 <jar jarfile="${dist.dir}/${dist.maven.file}">
170                         <zipfileset dir="." includes="LICENSE" fullpath="LICENSE.txt" />
171                         <zipfileset dir="etc" includes="project.xml" />
172                         <zipfileset dir="build" includes="${package.file}" fullpath="${dist.name}-${project.version}.jar" />
173                 </jar>
174         </target>
176         <!-- Detailed changelog -->
177         <target name="changelog" description="Generate XML report of CVS change logs">
178                 <cvschangelog destfile="CHANGES" />
179         </target>
181         <!-- JUnit tests -->
182         <target name="run-tests" depends="compile, compile-tests"
183                 description="Run JUint tests">
184                 <echo message="Running unit tests with classpath: ${project.classpath}" />
186                 <emma enabled="${emma.enabled}">
187                         <instr instrpathref="coverage.classpath" destdir="${out.instr.dir}" metadatafile="${coverage.dir}/metadata.emma" merge="true" />
188                 </emma>
190                 <junit printsummary="withOutAndErr" showoutput="yes" fork="yes">
191                         <!--
192             <classpath path="${project.classpath}"/>
193             -->
194                         <classpath>
195                                 <pathelement location="${out.instr.dir}" />
196                                 <path refid="coverage.classpath" />
197                                 <path refid="emma.lib" />
198                         </classpath>
199                         <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma" />
200                         <jvmarg value="-Demma.coverage.out.merge=false" />
201                         <test name="net.fortuna.ical4j.AllTests" />
202                         <!--
203             <batchtest>
204                 <fileset dir="${test.source.dir}">
205                     <include name="**/*Test.java"/>
206                 </fileset>
207             </batchtest>
208             -->
210                         <!--
211             <test name="net.fortuna.ical4j.data.CalendarOutputterTest"/>
212             <test name="net.fortuna.ical4j.model.component.VTimeZoneTest"/>
213             <test name="net.fortuna.ical4j.model.component.VEventTest"/>
214             <test name="net.fortuna.ical4j.data.CalendarBuilderTest"/>
215             -->
216                 </junit>
218                 <emma enabled="${emma.enabled}">
219                         <report sourcepath="${src.dir}">
220                                 <fileset dir="${coverage.dir}">
221                                         <include name="*.emma" />
222                                 </fileset>
224                                 <txt outfile="${coverage.dir}/coverage.txt" />
225                                 <html outfile="${coverage.dir}/coverage.html" />
226                         </report>
227                 </emma>
228         </target>
230         <!-- Generate timezone data -->
231         <target name="generateTzData" description="Generate timezone data">
232                 <!-- Default -->
233                 <echo message="Executing: ${vzic.home}/vzic.exe" />
234                 <exec executable="${vzic.home}/vzic.exe" dir="${vzic.home}" output="${basedir}/etc/vzic.log">
235                         <arg value="--output-dir ${basedir}/etc/zoneinfo" />
236                         <arg value="--pure" />
237                 </exec>
239                 <!-- Outlook-compatible -->
240                 <exec executable="${vzic.home}/vzic.exe" dir="${vzic.home}" output="${basedir}/etc/vzic.log">
241                         <arg value="--output-dir ${basedir}/etc/zoneinfo-outlook" />
242                 </exec>
243         </target>
244 </project>