<?xml version='1.0'?>
<!--

 Licensed to the Apache Software Foundation (ASF) under one   *
 or more contributor license agreements.  See the NOTICE file *
 distributed with this work for additional information        *
 regarding copyright ownership.  The ASF licenses this file   *
 to you 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="AntUnit Tests for Rat Ant Tasks"
         default="antunit">

  <property name="jar.name" location="target/classes"/>
  <property name="antunit.dir"
            location="src/test/resources/antunit"/>
  <path id="test-classpath">
    <pathelement location="${jar.name}"/>
    <pathelement location="../apache-rat-core/target/classes"/>
    <pathelement location="../apache-rat-api/target/classes"/>
    <pathelement location="target/test-classes"/>
    <pathelement location="${user.home}/.m2/repository/org/apache/ant/ant-antunit/1.4/ant-antunit-1.4.jar"/>
    <pathelement location="${user.home}/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"/>
    <pathelement location="${user.home}/.m2/repository/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar"/>
    <pathelement location="${user.home}/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar"/>
    <pathelement location="${user.home}/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar"/>
  </path>
  <property name="test.classpath" refid="test-classpath"/>

  <target name="antunit">
    <subant>
      <fileset dir="${antunit.dir}"
                    includes="report-*.xml"/>
      <property name="jar.name" value="${jar.name}"/>
      <property name="test.classpath" value="${test.classpath}"/>
    </subant>
  </target>

  <target name="prepare-ant-run">
    <fail unless="file">Must specify "file" property</fail>
    <ant antfile="${file}">
      <property name="jar.name" value="${jar.name}"/>
      <property name="test.classpath" value="${test.classpath}"/>
    </ant>
  </target>

  <target name="run-single-test">
    <ant antfile="${antunit.dir}/${file}"
         dir="${antunit.dir}"
         target="${target}">
      <property name="jar.name" value="${jar.name}"/>
      <property name="test.classpath" value="${test.classpath}"/>
    </ant>
  </target>
</project>
