001 <?xml version="1.0" encoding="ISO-8859-1"?> 002 003 <!-- 004 - Copyright 2005-2006 Jens Voß. 005 - 006 - Licensed under the GNU Lesser General Public License (the "License"); 007 - you may not use this file except in compliance with the License. 008 - You may obtain a copy of the License at 009 - 010 - http://opensource.org/licenses/lgpl-license.php 011 - 012 - Unless required by applicable law or agreed to in writing, software 013 - distributed under the License is distributed on an "AS IS" BASIS, 014 - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 - See the License for the specific language governing permissions and 016 - limitations under the License. 017 - 018 --> 019 020 <!--- 021 - This is the main ant build file for the XDC project. 022 --> 023 <project name="xdc" basedir="." default="build.all"> 024 025 <property name="srcdir" value="${basedir}/src"/> 026 <property name="builddir" value="${basedir}/classes"/> 027 <property name="libdir" value="${basedir}/lib"/> 028 <property name="distdir" value="${basedir}/dist"/> 029 030 <property name="testdir" value="${basedir}/test"/> 031 <property name="testsrcdir" value="${testdir}/src"/> 032 <property name="testbuilddir" value="${testdir}/classes"/> 033 <property name="testresultdir" value="${testdir}/results"/> 034 035 <property name="docdir" value="${basedir}/doc"/> 036 <property name="apidir" value="${docdir}/build/api"/> 037 <property name="xdcdir" value="${docdir}/build/xdc"/> 038 039 <property file="${basedir}/etc/buildNumber.properties"/> 040 <property name="version" value="${number.major}.${number.minor}.${number.build}"/> 041 042 <property name="compile.debug" value="false"/> 043 044 <path id="cp"> 045 <fileset dir="${libdir}"/> 046 </path> 047 048 <!-- *********************************************************** --> 049 <!-- *************** targets related to building *************** --> 050 <!-- *********************************************************** --> 051 052 <!--- 053 - The <code>clean</code> target removes all class files and copied 054 - resources from the build directory. 055 --> 056 <target name="clean" description="Clean XDC build directory"> 057 <mkdir dir="${builddir}"/> 058 <delete includeemptydirs="yes"> 059 <fileset dir="${builddir}"> 060 <include name="**/*"/> 061 </fileset> 062 </delete> 063 </target> 064 065 <!--- 066 - This target compiles all Java sources of the XDC project. It also 067 - copies all other resources (like XSLT and CSS stylesheets) from the 068 - source directory to the build directory. 069 --> 070 <target name="compile" description="Compile the XDC sources"> 071 <mkdir dir="${builddir}"/> 072 <javac srcdir="${srcdir}" destdir="${builddir}" 073 source="1.4" target="1.4" 074 encoding="ISO-8859-1" 075 debug="${compile.debug}" classpathref="cp"/> 076 <copy todir="${builddir}"> 077 <fileset dir="${srcdir}"> 078 <include name="**/resources/*"/> 079 <include name="**/xsl/*.x*l"/> 080 </fileset> 081 </copy> 082 </target> 083 084 <!--- 085 - This target compiles all sources "from scratch". 086 --> 087 <target name="compile.all" 088 description="Compile the XDC sources into a 'clean' directory" 089 depends="clean,compile"/> 090 091 <!--- 092 - The <code>jar</code> target combines all class and resource files 093 - from the build directory in a JAR archive. 094 --> 095 <target name="jar" description="Package classes and resources in a JAR file" 096 depends="compile"> 097 <mkdir dir="${distdir}"/> 098 <delete file="${distdir}/xdc.jar"/> 099 <jar destfile="${distdir}/xdc.jar"> 100 <fileset dir="${basedir}/classes"/> 101 <manifest> 102 <attribute name="Built-By" value="${user.name}"/> 103 <attribute name="Implementation-Title" value="XDC"/> 104 <attribute name="Implementation-Version" value="${version}"/> 105 <attribute name="Implementation-URL" value="http://xdc.sourceforge.net"/> 106 </manifest> 107 </jar> 108 </target> 109 110 <!-- *********************************************************** --> 111 <!-- *************** targets related to testing *************** --> 112 <!-- *********************************************************** --> 113 114 <!--- 115 - This target cleans all class and result files from the XDC unit tests. 116 --> 117 <target name="clean.test" description="Clean test class directory"> 118 <mkdir dir="${testbuilddir}"/> 119 <delete includeemptydirs="yes"> 120 <fileset dir="${testbuilddir}"> 121 <include name="**/*"/> 122 </fileset> 123 </delete> 124 </target> 125 126 <!--- 127 - This target deletes all previously generated JUnit and Alster test 128 - results. 129 --> 130 <target name="clean.testresults" description="Clean test result directory"> 131 <mkdir dir="${testresultdir}"/> 132 <delete includeemptydirs="yes"> 133 <fileset dir="${testresultdir}"> 134 <include name="**/*"/> 135 </fileset> 136 </delete> 137 </target> 138 139 <!--- 140 - This target is used to compile the JUnit test sources. 141 --> 142 <target name="compile.test" description="Compile the XDC test sources"> 143 <mkdir dir="${testbuilddir}"/> 144 <javac srcdir="${testsrcdir}" destdir="${testbuilddir}" 145 source="1.4" target="1.4" 146 encoding="ISO-8859-1" 147 debug="${compile.debug}"> 148 <classpath> 149 <path refid="cp"/> 150 <pathelement path="${builddir}"/> 151 </classpath> 152 </javac> 153 <copy todir="${testbuilddir}"> 154 <fileset dir="${testsrcdir}"> 155 <include name="**/*.txt"/> 156 <include name="**/*.css"/> 157 <include name="**/*.xml"/> 158 <include name="**/*.xsl"/> 159 </fileset> 160 </copy> 161 </target> 162 163 <!--- 164 - This target executes all JUnit tests. 165 --> 166 <target name="junit" description="Run all JUnit tests"> 167 <delete includeemptydirs="yes"> 168 <fileset dir="${testresultdir}"> 169 <include name="**/*"/> 170 </fileset> 171 </delete> 172 <junit fork="yes" printsummary="yes" haltonfailure="no" haltonerror="yes" 173 failureproperty="test.failed"> 174 <classpath> 175 <path refid="cp"/> 176 <pathelement path="${builddir}"/> 177 <pathelement path="${testbuilddir}"/> 178 </classpath> 179 <batchtest todir="${testresultdir}"> 180 <formatter type="plain"/> 181 <fileset dir="${testbuilddir}"> 182 <include name="**/*Test.class"/> 183 </fileset> 184 </batchtest> 185 </junit> 186 <fail if="test.failed" message="Not all JUnit tests passed!"/> 187 </target> 188 189 <!--- 190 - This target executes all Alster tests. Alster is an XSLT unit testing 191 - framework. 192 - 193 - @see <a href="http://sourceforge.net/projects/alster">Alster framework</a> 194 --> 195 <target name="alster" description="Run all Alster tests"> 196 <taskdef name="alster" classname="net.sf.alster.AlsterTextTask"> 197 <classpath> 198 <path refid="cp"/> 199 <fileset dir="${libdir}"> 200 <include name="*.jar"/> 201 <exclude name="log4j.jar"/> 202 </fileset> 203 <pathelement location="${builddir}"/> 204 </classpath> 205 </taskdef> 206 <alster dir="${testsrcdir}" failonerror="yes" recurse="yes" resultdir="${testresultdir}"> 207 <classpath> 208 <path refid="cp"/> 209 <pathelement location="${builddir}"/> 210 </classpath> 211 </alster> 212 </target> 213 214 <!--- 215 - The <code>test</code> target performs all steps necessary for running 216 - all (JUnit ans Alster) unit tests. 217 --> 218 <target name="test" description="Run all tests" 219 depends="clean.test,clean.testresults,compile.test,junit,alster"/> 220 221 <!-- *********************************************************** --> 222 <!-- ************* targets related to documenting ************* --> 223 <!-- *********************************************************** --> 224 225 <property name="titleText" value="XDC - the XML Documentation Generator"/> 226 <property name="headerText" value="XDC - v. ${number.major}.${number.minor}.${number.build}"/> 227 228 <!--- 229 - This target deletes all Javadoc generated documentation. 230 --> 231 <target name="clean.javadoc" description="Clean the generated Javadoc documentation"> 232 <mkdir dir="${apidir}"/> 233 <delete includeemptydirs="yes"> 234 <fileset dir="${apidir}"> 235 <include name="**/*"/> 236 </fileset> 237 </delete> 238 </target> 239 240 <!--- 241 - The <code>javadoc</code> target generates Javadoc documentation from the 242 - Java source files of the XDC application. 243 --> 244 <target name="javadoc" description="Generate Javadoc documentation from XDC source Java files"> 245 <mkdir dir="${apidir}"/> 246 <javadoc classpathref="cp" 247 locale="de_DE" 248 encoding="ISO-8859-1" 249 destdir="${apidir}" 250 linksource="yes" 251 windowtitle="${titleText}" 252 doctitle="${titleText}" 253 header="${headerText}" 254 footer="${headerText}"> 255 <packageset dir="${srcdir}" defaultexcludes="yes"/> 256 </javadoc> 257 </target> 258 259 <!--- 260 - This target deletes all XDC generated documentation. 261 --> 262 <target name="clean.xdc" description="Clean the generated XDC documentation"> 263 <mkdir dir="${xdcdir}"/> 264 <delete includeemptydirs="yes"> 265 <fileset dir="${xdcdir}"> 266 <include name="**/*"/> 267 </fileset> 268 </delete> 269 </target> 270 271 <!--- 272 - The <code>xdc</code> target generates XDC documentation from the XML 273 - source files of the XDC application. 274 --> 275 <target name="xdc" 276 description="Generate XDC documentation from XDC source XML files" 277 depends="jar"> 278 <path id="cpx"> 279 <path refid="cp"/> 280 <pathelement path="${distdir}/xdc.jar"/> 281 </path> 282 <taskdef name="xdc" classname="net.sf.xdc.XdcTask" classpathref="cpx"/> 283 <mkdir dir="${xdcdir}"/> 284 <xdc classpathref="cpx" 285 sourcepath="${basedir};${srcdir}" 286 destdir="${xdcdir}" 287 subpackages="net.sf.xdc.resources:net.sf.xdc.xsl" 288 extensions="xml,xsl" 289 notimestamp="no" 290 overview="${srcdir}/xdc-overview.html" 291 linksource="yes" 292 defaultexcludes="yes" 293 author="yes" 294 nosince="yes" 295 version="yes" 296 windowtitle="${titleText}" 297 doctitle="${titleText}" 298 header="${headerText}" 299 footer="${headerText}" 300 charset="latin1" 301 encoding="latin1" 302 docencoding="latin1" 303 locale="en" 304 reportmissing="yes"> 305 <!--<jvmarg value="-Dlog4j.rootLogger=debug, stdout"/>--> 306 <bottom> 307 <![CDATA[<i>Copyright © 2005 - 2006 Jens Voß</i>.]]> 308 </bottom> 309 <arg value="build.xml"/> 310 </xdc> 311 </target> 312 313 <!--- 314 - This target produces the XDC Reference Guide. 315 --> 316 <target name="generate.reference" description="Create reference guide list"> 317 <mkdir dir="${docdir}/build/reference"/> 318 <copy file="${docdir}/src/reference/frameset.html" 319 tofile="${docdir}/build/reference/index.html" 320 overwrite="yes"/> 321 <xslt in="${docdir}/src/reference/xdcDoc.xml" 322 style="${docdir}/etc/xdcDoc.xsl" 323 out="${docdir}/build/reference/main.html" force="yes"/> 324 <xslt in="${docdir}/src/reference/xdcDoc.xml" 325 style="${docdir}/etc/toc.xsl" 326 out="${docdir}/build/reference/toc.html" force="yes"> 327 <param name="targetFile" expression="main.html"/> 328 <param name="targetFrame" expression="main"/> 329 </xslt> 330 </target> 331 332 <!--- 333 - This target prepares the sources from which the XDC Developers' 334 - Handbook is generated. 335 --> 336 <target name="preprocess.developer" description="Generate material for developers' handbook"> 337 <mkdir dir="${docdir}/generated"/> 338 <mkdir dir="${docdir}/build/developer"/> 339 <xslt in="${basedir}/etc/libraries.xml" 340 style="${docdir}/etc/libraries.xsl" 341 out="${docdir}/generated/libraries.xml" force="yes"> 342 <outputproperty name="method" value="xml"/> 343 <outputproperty name="encoding" value="iso8859_1"/> 344 <outputproperty name="indent" value="yes"/> 345 </xslt> 346 <copy todir="${docdir}/build/developer"> 347 <fileset dir="${basedir}/etc"> 348 <include name="*license*"/> 349 </fileset> 350 </copy> 351 </target> 352 353 <!--- 354 - This target generates the XDC Developers' Handbook. 355 --> 356 <target name="generate.developer" description="Generate developers' handbook" 357 depends="preprocess.developer"> 358 <mkdir dir="${docdir}/build/developer"/> 359 <xslt in="${docdir}/src/developer/developer.xml" 360 style="${docdir}/etc/xdcDoc.xsl" 361 out="${docdir}/build/developer/index.html" force="yes"> 362 <outputproperty name="encoding" value="iso8859_1"/> 363 </xslt> 364 </target> 365 366 <!--- 367 - This target generates the <code>xdc</code> Ant task description. 368 --> 369 <target name="generate.ant" description="Generate Ant task description"> 370 <mkdir dir="${docdir}/build/ant"/> 371 <xslt in="${docdir}/src/ant/xdcAntTask.xml" 372 style="${docdir}/etc/xdcDoc.xsl" 373 out="${docdir}/build/ant/index.html" force="yes"> 374 <outputproperty name="encoding" value="iso8859_1"/> 375 </xslt> 376 </target> 377 378 <!--- 379 - The <code>document</code> target performs all build steps to 380 - generate the complete set of XDC documentation. 381 --> 382 <target name="document" description="Generate all documentation" 383 depends="javadoc,xdc,generate.reference,generate.developer,generate.ant"> 384 <copy file="${docdir}/src/index.html" todir="${docdir}/build"/> 385 </target> 386 387 <!--- 388 - This target performs all compile, archive, test and documentation 389 - build steps. 390 --> 391 <target name="build.all"> 392 <splash imageurl="file:/${basedir}/hp/xdc-logo.png"/> 393 <antcall target="compile.all"/> 394 <antcall target="jar"/> 395 <antcall target="test"/> 396 <antcall target="document"/> 397 </target> 398 399 </project>