<!--
   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="target-platform" xmlns:ivy="ivy">

    <!-- Load Ivy ant tasks -->
    <taskdef uri="ivy" resource="org/apache/ivy/ant/antlib.xml"/>
    <!-- If Ivy is not in Ant's classpath, get the jar of Ivy and use the following -->
    <!-- taskdef rather than the above one -->
    <!--path id="ivy.classpath">
        <fileset dir="${basedir}">
            <include name="ivy.jar"/>
        </fileset>
    </path>
    <taskdef uri="ivy" resource="org/apache/ivy/ant/antlib.xml" classpathref="ivy.classpath" /-->

    <target name="update-dependencies" description="Update the dependencies">
        <ivy:configure file="${basedir}/ivysettings.xml"/>
        <ivy:resolve file="ivy.xml" conf="*"/>
        <ivy:fixdeps tofile="ivy-fixed.xml"/>
    </target>

    <!--
        Two choices: either the jars stays in the cache, or they are retrieved in a dedicated folder
        Having the bundle retrieved in a folder is helpful to manage target platforms with PDE
    -->

    <target name="generate-target-platform" description="Generate the obr.xml of the target platform">
        <ivy:configure file="${basedir}/ivysettings.xml"/>
        <ivy:resolve file="ivy-fixed.xml" conf="*"/>
        <ivy:buildobr out="obr.xml"/>
    </target>

    <target name="generate-retrieved-target-platform" description="Generate the obr.xml of the retrieved target platform">
        <ivy:configure file="${basedir}/ivysettings.xml"/>
        <ivy:resolve file="ivy-fixed.xml" conf="*"/>
        <ivy:retrieve pattern="${basedir}/bundles/[type]s/[artifact]_[revision].[ext]"/>
        <ivy:buildobr basedir="${basedir}/bundles" out="obr.xml"/>
    </target>

</project>
