blob: 477874a1c779e6046f7b0319a8a75496fa1c5474 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright 2005-2006 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="common">
<target name="setup-properties">
<property file="build.properties"/>
<property name="build" value="build"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.testclasses" value="${build}/test-classes"/>
<property name="build.lib" value="${build}/lib"/>
<property name="jarname" value="${build.lib}/ant-${ant.project.name}.jar"/>
</target>
<target name="setup" depends="setup-properties">
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.testclasses}"/>
<mkdir dir="${build.lib}"/>
</target>
<target name="compile" depends="setup">
<javac
srcdir="src/main"
destdir="${build.classes}"
debug="true"
/>
</target>
<target name="antlib" depends="compile">
<copy todir="${build.classes}">
<fileset dir="src/main" includes="**/antlib.xml"/>
</copy>
<jar
destfile="${jarname}"
basedir="${build.classes}"
/>
</target>
<target name="setup-for-tests" depends="setup">
<available classname="org.apache.tools.ant.BuildFileTest"
property="testutil-present?"
classpath="${ant-testutil.jar}"/>
<fail unless="testutil-present?">Expected to find ant-testutil.jar
in ${ant-testutil.jar}, please set the property ant-testutil.jar
to the correct location.</fail>
</target>
<target name="compile-tests" depends="setup-for-tests, antlib">
<javac
srcdir="src/testcases"
destdir="${build.testclasses}"
debug="true"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="${ant-testutil.jar}"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile-tests">
<junit
printsummary="false"
haltonfailure="false"
failureproperty="tests.failed"
filtertrace="false"
fork="true"
forkmode="once"
>
<classpath>
<pathelement location="${jarname}"/>
<pathelement location="${ant-testutil.jar}"/>
<pathelement location="${build.testclasses}"/>
</classpath>
<batchtest>
<fileset dir="src/testcases"/>
</batchtest>
<formatter type="plain" usefile="false"/>
</junit>
<fail if="tests.failed">At least one test has failed.</fail>
</target>
<target name="clean" depends="setup-properties">
<delete dir="${build}"/>
</target>
</project>