<!-- 
  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>
    <property name="jarname" value="SDaemon.jar"/>
    <property name="libdir" value="/usr/local/lib/storlets/java"/>

    <target name="clean">
        <delete dir="bin" />
    </target>

    <target name="java">
        <mkdir dir="bin" />
        <javac srcdir="src/main" destdir="bin" includeantruntime="false">
            <classpath>
                <pathelement
                    path="../SBus/bin/SBusJavaFacade.jar"/>
                <pathelement
                    path="../SCommon/bin/SCommon.jar"/>
                <pathelement
                    path="../dependencies/json-simple-1.1.1.jar"/>
                <pathelement
                    path="../dependencies/slf4j-api-2.0.12.jar"/>
                <pathelement
                    path="../dependencies/logback-classic-1.4.14.jar"/>
                <pathelement
                    path="../dependencies/logback-core-1.4.14.jar"/>
                <pathelement path="."/>
            </classpath>
            <compilerarg value="-Xlint"/>
        </javac>
    </target>

    <target name="jar" depends="java">
        <jar destfile="bin/${jarname}"
             basedir="bin">
            <manifest>
                <attribute
                 name="Main-Class"
                 value="org.openstack.storlet.daemon.SDaemon" />
            </manifest>
        </jar>
    </target>

    <target name="build" depends="clean, jar">
    </target>

    <target name="install" depends="build">
        <mkdir dir="${libdir}"/>
        <copy file="bin/${jarname}" todir="${libdir}"/>
    </target>

    <target name="uninstall">
        <delete file="${libdir}/${jarname}"/>
    </target>
</project>
