<project default="clover" name="CloverAnt">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<taskdef resource="clovertasks"/>
<typedef resource="clovertypes"/>
<target name="setup">
<mkdir dir="clover-db"/>
<clover-setup initstring="clover-db/ant_coverage.db">
</clover-setup>
</target>
<target name="clover" depends="setup">
<ant antfile="build.xml" target="clean" inheritall="false"/>
<ant antfile="build.xml" target="build" inheritrefs="true"/>
<ant antfile="build.xml" target="compile-tests" inheritall="false"/>
<delete dir="${ant.install}"/>
<copy todir="${ant.install}/lib">
<fileset dir="lib">
<include name="*.jar"/>
<include name="optional/*.jar"/>
</fileset>
<mapper type="flatten"/>
</copy>
<ant antfile="build.xml" target="install-lite" inheritall="false"/>
<exec executable="ant">
<arg value="run-tests"/>
<arg value="-Dtest.haltonfailure=no"/>
<env key="CLASSPATH" value=""/>
<env key="ANT_HOME" value="${ant.install}"/>
</exec>
</target>
<target name="core">
<delete dir="clover-db"/>
<mkdir dir="clover-db"/>
<clover-setup initstring="clover-db/ant_coverage.db">
<files>
<exclude name="**/optional/**/*.java"/>
</files>
</clover-setup>
<ant antfile="build.xml" target="clean" inheritall="false"/>
<ant antfile="build.xml" target="build" inheritrefs="true"/>
<ant antfile="build.xml" target="compile-tests" inheritall="false"/>
<delete dir="${ant.install}"/>
<copy todir="${ant.install}/lib">
<fileset dir="lib">
<include name="*.jar"/>
<include name="optional/*.jar"/>
</fileset>
<mapper type="flatten"/>
</copy>
<ant antfile="build.xml" target="install-lite" inheritall="false"/>
<exec executable="ant">
<arg value="run-tests"/>
<arg value="-Dtest.haltonfailure=no"/>
<env key="CLASSPATH" value=""/>
<env key="ANT_HOME" value="${ant.install}"/>
</exec>
<clover-historypoint historyDir="ant-core-hist" dateFormat="yyyy-MM-dd"
date="${gendate}"/>
</target>
<target name="all">
<delete dir="clover-db"/>
<mkdir dir="clover-db"/>
<clover-setup initstring="clover-db/ant_coverage.db">
</clover-setup>
<ant antfile="build.xml" target="clean" inheritall="false"/>
<ant antfile="build.xml" target="build" inheritrefs="true"/>
<ant antfile="build.xml" target="compile-tests" inheritall="false"/>
<delete dir="${ant.install}"/>
<copy todir="${ant.install}/lib">
<fileset dir="lib">
<include name="*.jar"/>
<include name="optional/*.jar"/>
</fileset>
<mapper type="flatten"/>
</copy>
<ant antfile="build.xml" target="install-lite" inheritall="false"/>
<exec executable="ant">
<arg value="run-tests"/>
<arg value="-Dtest.haltonfailure=no"/>
<env key="CLASSPATH" value=""/>
<env key="ANT_HOME" value="${ant.install}"/>
</exec>
<clover-historypoint historyDir="ant-all-hist" dateFormat="yyyy-MM-dd"
date="${gendate}"/>
</target>
<target name="complete">
<tstamp>
<format property="gendate" pattern="yyyy-MM-dd"/>
</tstamp>
<antcall target="core"/>
<antcall target="all"/>
<antcall target="report"/>
</target>
<!-- =================================================================== -->
<!-- generate reports -->
<!-- =================================================================== -->
<target name="report" depends="setup">
<clover-format id="std.format" srclevel="true" type="html"/>
<property name="format" value="std.format"/>
<clover-report>
<historical historydir="ant-core-hist" outfile="report-core-history"
title="Ant 1.3 - Current Core">
<format refid="${format}"/>
</historical>
<historical historydir="ant-all-hist" outfile="report-all-history"
title="Ant 1.3 - Current Complete">
<format refid="${format}"/>
</historical>
<current outfile="report-current" title="Ant Coverage">
<format refid="${format}"/>
</current>
</clover-report>
</target>
<!-- =================================================================== -->
<!-- generate historical reports -->
<!-- =================================================================== -->
<target name="generate-history">
<delete dir="ant-core-hist"/>
<mkdir dir="ant-core-hist"/>
<delete dir="ant-all-hist"/>
<mkdir dir="ant-all-hist"/>
<foreach list="
2001-02-01,2001-03-01,2001-04-01,2001-05-01,
2001-06-01,2001-07-01,2001-08-01,2001-09-01,2001-10-01,
2001-11-01,2001-12-01,
2002-01-01,2002-02-01,2002-03-01,2002-04-01,2002-05-01,
2002-06-01,2002-07-01,2002-08-01,2002-09-01,2002-10-01,
2002-11-01,2002-12-01, 2003-01-01, 2003-02-01, 2003-03-01"
target="genfordate" param="gendate"/>
</target>
<target name="genfordate">
<echo message="Generating history for ${gendate}"/>
<cvs command="update" date="${gendate}"/>
<antcall target="core"/>
<antcall target="all"/>
</target>
</project>