<!--
   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 build script is used to download dependencies for a freshly downloaded
	binary distribution of Ivy without dependencies.
	
	To use it, you only need to have this script in the directory where you
	have unzipped your binary distribution of Ivy, and to call it using
	ant -f build-install.xml
	
	If you don't want to download all optional dependencies, you can set
	the conf attribute value in the ivy:retrieve task, to select only
	the configuration you want (check the ivy.xml for details about
	which configurations are available, and what they are useful for).
-->
<project name="ivy-bin-install" default="download-deps" 
		xmlns:ivy="antlib:org.apache.ivy.ant">
	<target name="init-ivy-settings">
		<echo file="${basedir}/ivysettings.xml">
		<![CDATA[
<ivysettings>
	<include url="${ivy.default.conf.dir}/ivyconf-local.xml"/>
	<settings defaultResolver="public" />
	<resolvers>
		<!--  
			we use ivyrep for ivy and some artifacts, and ibiblio for other artifacts
			The reason for that is that commons vfs is still not released, thus we depend on an integration
			version only available on ivyrep, but not on ivyrep
			As soon as vfs will be available on ibiblio, the default configuration could be used again
			-->
		<url name="public">
			<ivy pattern="http://ivyrep.jayasoft.org/[organisation]/[module]/ivy-[revision].xml"/>
			<artifact pattern="http://ivyrep.jayasoft.org/[organisation]/[module]/[revision]/[artifact].[ext]"/>
			<artifact pattern="http://repo1.maven.org/maven/[module]/[type]s/[artifact]-[revision].[ext]"/>
		</url>
	</resolvers>
</ivysettings>
		]]>  
		</echo>
	</target>
	
	<target name="init-ivy" depends="init-ivy-settings">
    	<path id="ivy.lib.path">
    	    <fileset dir="${basedir}" includes="*.jar" excludes="ivy-core-*.jar"/>
    	</path>
    	<taskdef resource="org/apache/ivy/ant/antlib.xml"
    	          uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
	</target>
	
	<target name="download-deps" depends="init-ivy">
		<ivy:retrieve 
				conf="*" 
				pattern="${basedir}/lib/[conf]/[artifact]-[revision].[ext]"/>
	</target>
</project>
