commons-collections/build.xml

428 lines
16 KiB
XML
Raw Normal View History

<project name="commons-collections" default="compile" basedir=".">
<!-- ========== Properties ================================================ -->
<property file="build.properties"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="commons-collections"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.collections"/>
<!-- The short title of this component -->
<property name="component.title" value="Commons Collections"/>
<!-- The full title of this component -->
<property name="component.title.full" value="Apache Jakarta Commons Collections"/>
<!-- The current version number of this component -->
<property name="component.version" value="3.1-dev"/>
<!-- The base directory for component configuration files -->
<property name="source.conf" value="src/conf"/>
<!-- The base directory for component sources -->
<property name="source.java" value="src/java"/>
<!-- The base directory for unit test sources -->
<property name="source.test" value="src/test"/>
<!-- The directories for compilation targets -->
<property name="build.home" value="build"/>
<property name="build.conf" value="${build.home}/conf"/>
<property name="build.classes" value="${build.home}/classes"/>
<property name="build.tests" value="${build.home}/tests"/>
<property name="build.docs" value="${build.home}/docs/apidocs"/>
<!-- The name/location of the jar file to build -->
<property name="jar.name" value="${component.name}-${component.version}.jar"/>
<property name="build.jar.name" value="${build.home}/${jar.name}"/>
<!-- The name/location of the zip files to build -->
<property name="build.dist.bin" value="${build.home}/bin"/>
<property name="build.dist.bin.work" value="${build.dist.bin}/${component.name}-${component.version}"/>
<property name="build.dist.src" value="${build.home}/src"/>
<property name="build.dist.src.work" value="${build.dist.src}/${component.name}-${component.version}"/>
<property name="build.dist" value="${build.home}/dist"/>
<property name="build.bin.tar.name" value="${build.dist}/${component.name}-${component.version}.tar"/>
<property name="build.bin.gz.name" value="${build.dist}/${component.name}-${component.version}.tar.gz"/>
<property name="build.bin.zip.name" value="${build.dist}/${component.name}-${component.version}.zip"/>
<property name="build.src.tar.name" value="${build.dist}/${component.name}-${component.version}-src.tar"/>
<property name="build.src.gz.name" value="${build.dist}/${component.name}-${component.version}-src.tar.gz"/>
<property name="build.src.zip.name" value="${build.dist}/${component.name}-${component.version}-src.zip"/>
<!-- ========== Settings ================================================== -->
<!-- Javac -->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.optimize" value="false"/>
<!-- Javadoc -->
<property name="javadoc.access" value="protected"/>
<property name="javadoc.links" value="http://java.sun.com/j2se/1.3/docs/api/"/>
<!-- JUnit -->
<property name="test.failonerror" value="true"/>
<!-- ====================================================================== -->
<!-- ========== Executable Targets ======================================== -->
<!-- ====================================================================== -->
<target name="clean"
description="Clean build and distribution directories">
<delete dir="${build.home}"/>
</target>
<!-- ====================================================================== -->
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="-------- ${component.name} ${component.version} --------"/>
</target>
<!-- ====================================================================== -->
<target name="prepare" depends="init"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
</target>
<!-- ====================================================================== -->
<target name="compile" depends="prepare"
description="Compile main code">
<mkdir dir="${build.classes}"/>
<javac srcdir="${source.java}"
destdir="${build.classes}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
</javac>
</target>
<!-- ====================================================================== -->
<target name="jar" depends="compile"
description="Create jar">
<mkdir dir="${build.classes}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${build.classes}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${build.classes}/META-INF/NOTICE.txt"/>
<tstamp/>
<mkdir dir="${build.conf}"/>
<copy todir="${build.conf}" filtering="on">
<filterset>
<filter token="name" value="${component.name}"/>
<filter token="title" value="${component.title}"/>
<filter token="package" value="${component.package}"/>
<filter token="version" value="${component.version}"/>
</filterset>
<fileset dir="${source.conf}" includes="*.MF"/>
</copy>
<!-- NOTE: A jar built using JDK1.4 is incompatible with JDK1.2 -->
<jar jarfile="${build.jar.name}"
basedir="${build.classes}"
manifest="${build.conf}/MANIFEST.MF"/>
</target>
<!-- ====================================================================== -->
<target name="compile.tests" depends="compile"
description="Compile unit test cases">
<mkdir dir="${build.tests}"/>
<javac srcdir="${source.test}"
destdir="${build.tests}"
debug="true"
deprecation="false"
optimize="false">
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${junit.jar}"/>
</classpath>
</javac>
</target>
<!-- ====================================================================== -->
<target name="test" depends="compile.tests"
description="Run all unit test cases">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${build.tests}"/>
<pathelement location="${junit.jar}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${source.test}">
<include name="**/TestAllPackages.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ====================================================================== -->
<target name="testjar" depends="compile.tests,jar"
description="Run all unit test cases">
<echo message="Running collections tests against built jar ..."/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement location="${build.jar.name}"/>
<pathelement location="${build.tests}"/>
<pathelement location="${junit.jar}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${source.test}">
<include name="**/TestAllPackages.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ====================================================================== -->
<target name="javadoc" depends="prepare"
description="Create component Javadoc documentation">
<tstamp><format property="year" pattern="yyyy"/></tstamp>
<delete dir="${build.docs}"/>
<mkdir dir="${build.docs}"/>
<javadoc sourcepath="${source.java}"
destdir="${build.docs}"
packagenames="${component.package}.*"
access="${javadoc.access}"
author="true"
version="true"
use="true"
link="${javadoc.links}"
overview="${source.java}/org/apache/commons/collections/overview.html"
doctitle="${component.title} ${component.version} API;"
windowtitle="${component.title} ${component.version} API"
bottom="Copyright &amp;copy; 2001-${year} Apache Software Foundation. All Rights Reserved.">
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- ========== Test framework ============================================ -->
<!-- ====================================================================== -->
<property name="tf.name" value="commons-collections-testframework"/>
<property name="tf.package" value="org.apache.commons.collections"/>
<property name="tf.title" value="Commons Collections Test Framework"/>
<property name="tf.title.full" value="Apache Jakarta Commons Collections Test Framework"/>
<property name="tf.version" value="${component.version}"/>
<property name="tf.build.conf" value="${build.home}/tfconf"/>
<property name="tf.build.tf" value="${build.home}/testframework"/>
<property name="tf.build.docs" value="${build.home}/docs/testframework"/>
<property name="tf.jar.name" value="${tf.name}-${tf.version}.jar"/>
<property name="tf.build.jar.name" value="${build.home}/${tf.jar.name}"/>
<!-- ====================================================================== -->
<!-- patternset describing test framework source not dependent on collections jar -->
<patternset id="tf.patternset.validate">
<include name="**/AbstractTestObject.java"/>
<include name="**/AbstractTestCollection.java"/>
<include name="**/AbstractTestSet.java"/>
<include name="**/AbstractTestSortedSet.java"/>
<include name="**/AbstractTestList.java"/>
<include name="**/AbstractTestMap.java"/>
<include name="**/AbstractTestSortedMap.java"/>
<include name="**/AbstractTestComparator.java"/>
<include name="**/AbstractTestIterator.java"/>
<include name="**/AbstractTestListIterator.java"/>
<include name="**/AbstractTestMapEntry.java"/>
<include name="**/BulkTest.java"/>
</patternset>
<target name="tf.validate" depends="prepare"
description="Testframework - Validate testframework independence">
<delete dir="${tf.build.tf}"/>
<mkdir dir="${tf.build.tf}"/>
<javac srcdir="${source.test}"
destdir="${tf.build.tf}"
debug="true"
deprecation="false"
optimize="false">
<patternset refid="tf.patternset.validate" />
<classpath>
<pathelement location="${junit.jar}"/>
</classpath>
</javac>
<delete dir="${tf.build.tf}"/>
</target>
<!-- ====================================================================== -->
<target name="tf.jar" depends="compile.tests"
description="Testframework - Create jar">
<mkdir dir="${tf.build.tf}"/>
<copy todir="${tf.build.tf}">
<fileset dir="${build.tests}">
<include name="**/AbstractTest*.class"/>
<include name="**/BulkTest*.class"/>
</fileset>
</copy>
<mkdir dir="${tf.build.tf}/META-INF"/>
<copy file="LICENSE.txt"
tofile="${tf.build.tf}/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt"
tofile="${tf.build.tf}/META-INF/NOTICE.txt"/>
<tstamp/>
<mkdir dir="${tf.build.conf}"/>
<copy todir="${tf.build.conf}" filtering="on">
<filterset>
<filter token="name" value="${tf.name}"/>
<filter token="title" value="${tf.title}"/>
<filter token="package" value="${tf.package}"/>
<filter token="version" value="${tf.version}"/>
</filterset>
<fileset dir="${source.conf}" includes="*.MF"/>
</copy>
<!-- NOTE: A jar built using JDK1.4 is incompatible with JDK1.2 -->
<jar jarfile="${tf.build.jar.name}"
basedir="${tf.build.tf}"
manifest="${tf.build.conf}/MANIFEST.MF"/>
</target>
<!-- ====================================================================== -->
<target name="tf.javadoc" depends="prepare"
description="Testframework - Create Javadoc documentation">
<tstamp><format property="year" pattern="yyyy"/></tstamp>
<delete dir="${tf.build.docs}"/>
<mkdir dir="${tf.build.docs}"/>
<javadoc destdir="${tf.build.docs}"
access="protected"
author="false"
version="false"
link="${javadoc.links}"
overview="${source.test}/org/apache/commons/collections/overview.html"
doctitle="${tf.title} ${tf.version} API;"
windowtitle="${tf.title} ${tf.version} API"
bottom="Copyright &amp;copy; 2001-${year} Apache Software Foundation. All Rights Reserved.">
<fileset dir="${source.test}">
<include name="**/AbstractTest*.java"/>
<include name="**/BulkTest*.java"/>
</fileset>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- ========== Distributions ============================================= -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<target name="dist" depends="jar,testjar,javadoc,tf.validate,tf.jar,dist.bin,dist.src"
description="Create distribution folders">
</target>
<target name="dist.bin">
<mkdir dir="${build.dist.bin.work}"/>
<copy todir="${build.dist.bin.work}">
<fileset dir=".">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
<include name="README.txt"/>
<include name="RELEASE-NOTES.html"/>
</fileset>
</copy>
<copy todir="${build.dist.bin.work}">
<fileset dir="${build.home}">
<include name="*.jar"/>
<include name="docs/**"/>
</fileset>
</copy>
</target>
<target name="dist.src">
<mkdir dir="${build.dist.src.work}"/>
<copy todir="${build.dist.src.work}">
<fileset dir=".">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
<include name="README.txt"/>
<include name="RELEASE-NOTES.html"/>
<include name="DEVELOPERS-GUIDE.html"/>
<include name="PROPOSAL.html"/>
<include name="STATUS.html"/>
<include name="build.properties.sample"/>
<include name="build.xml"/>
<include name="maven.xml"/>
<include name="project.xml"/>
<include name="project.properties"/>
</fileset>
</copy>
<copy todir="${build.dist.src.work}">
<fileset dir="${build.home}">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="${build.dist.src.work}">
<fileset dir=".">
<include name="data/**"/>
<include name="src/**"/>
<include name="xdocs/**"/>
</fileset>
</copy>
</target>
<!-- ====================================================================== -->
<target name="zip" depends="zip.bin,zip.src"
description="Create zipped distribution">
</target>
<target name="zip.bin">
<mkdir dir="${build.dist}"/>
<tar longfile="gnu" tarfile="${build.bin.tar.name}">
<tarfileset dir="${build.dist.bin}"/>
</tar>
<gzip zipfile="${build.bin.gz.name}" src="${build.bin.tar.name}"/>
<delete file="${build.bin.tar.name}" />
<zip zipfile="${build.bin.zip.name}" >
<zipfileset dir="${build.dist.bin}"/>
</zip>
<checksum file="${build.bin.gz.name}"/>
<checksum file="${build.bin.zip.name}"/>
</target>
<target name="zip.src">
<mkdir dir="${build.dist}"/>
<tar longfile="gnu" tarfile="${build.src.tar.name}">
<tarfileset dir="${build.dist.src}"/>
</tar>
<gzip zipfile="${build.src.gz.name}" src="${build.src.tar.name}"/>
<delete file="${build.src.tar.name}" />
<zip zipfile="${build.src.zip.name}" >
<zipfileset dir="${build.dist.src}"/>
</zip>
<checksum file="${build.src.gz.name}"/>
<checksum file="${build.src.zip.name}"/>
</target>
</project>