<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
 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.    
-->

<!--
  This file contains all the jar download targets to build Velocity.
  Its tasks are referenced from the build.xml file and should not be
  called directly.

  This is here so that the main build file is not cluttered any further.
-->

<project name="Velocity" basedir="..">
  <target name="build-download" description="Download all the Velocity dependencies from the central repository">
   <mkdir dir="${build.lib}" />
   <antcall target="antlr-download" />
   <antcall target="avalon-logkit-download" />
   <antcall target="commons-collections-download" />
   <antcall target="commons-lang-download" />
   <antcall target="commons-logging-download" />
   <antcall target="jdom-download" />
   <antcall target="log4j-download" />
   <antcall target="oro-download" />
   <antcall target="servletapi-download" />
   <antcall target="werken-xpath-download" />
   <antcall target="maven-ant-task-download"/>

   <mkdir dir="${build.test.lib}" />
   <antcall target="hsqldb-download" />
   <antcall target="junit-download" />
  </target>

  <target name="http-m1-download">
    <condition property="skip-download">
      <or>
        <istrue value="${skip.jar.loading}"/>
        <and>
          <isfalse value="${force.jar.loading}"/>
          <available file="${build.lib}/${download.artifactId}-${download.version}.jar"/>
        </and>
      </or>
    </condition>
    <antcall target="do-http-m1-download"/>
  </target>

  <target name="do-http-m1-download" unless="skip-download">
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
    <get src="${repo.m1.url}/${download.groupId}/jars/${download.artifactId}-${download.version}.jar"
         dest="${build.lib}/${download.artifactId}-${download.version}.jar"
         usetimestamp="true"
         verbose="false"
         ignoreerrors="false" />
  </target>

  <target name="http-test-m1-download">
    <condition property="skip-download">
      <or>
        <istrue value="${skip.jar.loading}"/>
        <and>
          <isfalse value="${force.jar.loading}"/>
          <available file="${build.test.lib}/${download.artifactId}-${download.version}.jar"/>
        </and>
      </or>
    </condition>
    <antcall target="do-http-test-m1-download"/>
  </target>

  <target name="do-http-test-m1-download" unless="skip-download">
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
    <get src="${repo.m1.url}/${download.groupId}/jars/${download.artifactId}-${download.version}.jar"
         dest="${build.test.lib}/${download.artifactId}-${download.version}.jar"
         usetimestamp="true"
         verbose="false"
         ignoreerrors="false" />
  </target>

  <target name="http-m2-download">
    <condition property="skip-download">
      <or>
        <istrue value="${skip.jar.loading}"/>
        <and>
          <isfalse value="${force.jar.loading}"/>
          <available file="${build.lib}/${download.artifactId}-${download.version}.jar"/>
        </and>
      </or>
    </condition>
    <antcall target="do-http-m2-download"/>
  </target>

  <target name="do-http-m2-download" unless="skip-download">
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
    <get src="${repo.m2.url}/${download.groupId}/${download.artifactId}/${download.version}/${download.artifactId}-${download.version}.jar"
         dest="${build.lib}/${download.artifactId}-${download.version}.jar"
         usetimestamp="true"
         verbose="false"
         ignoreerrors="false" />
  </target>

  <target name="antlr-download">
   <property name="download.groupId" value="antlr" />
   <property name="download.artifactId" value="antlr" />
   <property name="download.version" value="${jar.antlr.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="avalon-logkit-download">
   <property name="download.groupId" value="avalon-logkit" />
   <property name="download.artifactId" value="avalon-logkit" />
   <property name="download.version" value="${jar.avalon-logkit.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="commons-collections-download">
   <property name="download.groupId" value="${jar.commons-collections.name}" />
   <property name="download.artifactId" value="${jar.commons-collections.name}" />
   <property name="download.version" value="${jar.commons-collections.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="commons-lang-download">
   <property name="download.groupId" value="${jar.commons-lang.name}" />
   <property name="download.artifactId" value="${jar.commons-lang.name}" />
   <property name="download.version" value="${jar.commons-lang.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="commons-logging-download">
   <property name="download.groupId" value="commons-logging" />
   <property name="download.artifactId" value="commons-logging" />
   <property name="download.version" value="${jar.commons-logging.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="jdom-download">
   <property name="download.groupId" value="jdom" />
   <property name="download.artifactId" value="jdom" />
   <property name="download.version" value="${jar.jdom.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="log4j-download">
   <property name="download.groupId" value="log4j" />
   <property name="download.artifactId" value="log4j" />
   <property name="download.version" value="${jar.log4j.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="oro-download">
   <property name="download.groupId" value="${jar.oro.name}" />
   <property name="download.artifactId" value="${jar.oro.name}" />
   <property name="download.version" value="${jar.oro.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="servletapi-download">
   <property name="download.groupId" value="servletapi" />
   <property name="download.artifactId" value="servletapi" />
   <property name="download.version" value="${jar.servletapi.version}" />
   <antcall target="http-m1-download"/>
  </target>

  <target name="werken-xpath-download">
   <property name="download.groupId" value="werken-xpath" />
   <property name="download.artifactId" value="werken-xpath" />
   <property name="download.version" value="${jar.werken-xpath.version}" />
   <antcall target="http-m1-download"/>
  </target>

<!-- Test Dependencies -->

  <target name="junit-download">
   <property name="download.groupId" value="junit" />
   <property name="download.artifactId" value="junit" />
   <property name="download.version" value="${jar.junit.version}" />
   <antcall target="http-test-m1-download"/>
  </target>

  <target name="hsqldb-download">
   <property name="download.groupId" value="hsqldb" />   
   <property name="download.artifactId" value="hsqldb" />
   <property name="download.version" value="${jar.hsqldb.version}" />
   <antcall target="http-test-m1-download"/>
  </target>

 <!-- Maven related dependencies -->

  <target name="maven-ant-task-download">
   <property name="download.groupId" value="org/apache/maven" />
   <property name="download.artifactId" value="maven-ant-tasks" />
   <property name="download.version" value="${jar.maven.ant.version}" />
   <antcall target="http-m2-download"/>
  </target>


</project>

