<?xml version="1.0" encoding="utf-8" ?>
 <!--
 * 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="etch-dependencies" basedir="." default="check-all">
    <description>Etch Dependencies</description>
    <property name="Etch.basedir" location="${basedir}/.." />
    
    <!-- Load Environment -->
    <property environment="env" />
    
    <!-- Load dependencies -->
    <property file="${Etch.basedir}/build.dependencies" prefix="file" />
    
    <!-- Pull properties from commandline -->
    <condition property="build.javacc.home" value="${javacc.home}" >
        <isset property="javacc.home" />
    </condition>

    <condition property="build.junit.lib" value="${junit.lib}" >
        <isset property="junit.lib" />
    </condition>

    <condition property="build.velocity.lib" value="${velocity.lib}" >
        <isset property="velocity.lib" />
    </condition>
    
    <property file="${Etch.basedir}/build.dependencies" prefix="build" />

    <target name="check-javacc" >
        <echo message="javacc.home = ${build.javacc.home}" />
        <fail message="'javacc.jar' cannot be found. Please set 'javacc.home' in build.dependencies or specify value for 'javacc.home' on command-line">
            <condition>
                <and>
                <not><available file="${build.javacc.home}/JavaCC.zip" /></not>
                <not><available file="${build.javacc.home}/bin/lib/JavaCC.zip" /></not>
                <not><available file="${build.javacc.home}/javacc.jar" /></not>
                <not><available file="${build.javacc.home}/bin/lib/javacc.jar" /></not>
                </and>
            </condition>
        </fail>
    </target>
    
    <target name="check-junit">
        <fail message="'junit-4.3.1.jar' cannot be found. Please set 'junit.lib' in build.dependencies or specify value for 'junit.lib' onthe command-line">
            <condition>
                <not><available file="${build.junit.lib}/junit-4.3.1.jar" /></not>
            </condition>
        </fail>        
    </target>
    
    <target name="check-velocity">
        <fail message="'velocity-dep-1.5.jar' cannot be found. Please set 'velocity.lib' in build.dependencies or specify value for 'velocity.lib' on the command-line">
            <condition>
                <not><available file="${build.velocity.lib}/velocity-dep-1.5.jar" /></not>
            </condition>
        </fail>        
    </target>
    
    <target name="check-dotnet" >
        <echo message="ANT-DOTNET" />
    </target>
    
    <target name="check-all" depends="check-javacc,check-junit,check-velocity,check-dotnet" />

</project>
