<!--
  Copyright IBM Corp. 2015, 2015 All Rights Reserved
  Copyright (c) 2010-2016 OpenStack Foundation
  Licensed 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>
    <!-- Bring build Dependencies-->
    <target name="dependencies" >
        <mkdir dir="dependencies" />
        <get src="https://repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar"
            dest="dependencies/json-simple-1.1.1.jar"
            verbose="true"
            usetimestamp="true"/>
        <get src="https://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.4.14/logback-classic-1.4.14.jar"
            dest="dependencies/logback-classic-1.4.14.jar"
            verbose="true"
            usetimestamp="true"/>
        <get src="https://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.4.14/logback-core-1.4.14.jar"
            dest="dependencies/logback-core-1.4.14.jar"
            verbose="true"
            usetimestamp="true"/>
        <get src="https://repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.12/slf4j-api-2.0.12.jar"
            dest="dependencies/slf4j-api-2.0.12.jar"
            verbose="true"
            usetimestamp="true"/>
    </target>
    <!-- Install build Dependencies-->
    <target name="install_dependencies" depends="dependencies">
        <copy todir="/usr/local/lib/storlets/java">
            <fileset dir="dependencies" />
        </copy>
    </target>
    <!-- Storlets Engine build -->
    <macrodef name="iterate_engine">
        <attribute name="target" />
        <sequential>
            <subant target="@{target}">
                <fileset dir="SBus" includes="build.xml" />
                <fileset dir="SCommon" includes="build.xml" />
                <fileset dir="SDaemon" includes="build.xml" />
            </subant>
        </sequential>
    </macrodef>
    <target name="build" depends="dependencies">
        <iterate_engine target="build" />
    </target>
    <target name="clean">
        <iterate_engine target="clean" />
        <delete dir="dependencies" />
    </target>
    <target name="install" depends="install_dependencies">
        <iterate_engine target="install" />
    </target>
    <target name="uninstall">
        <iterate_engine target="uninstall" />
    </target>
</project>
