<?xml version="1.0" encoding="UTF-8"?>
<!--
 * 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.
-->

<!-- ***NOTE*** temporary hack till can work out how to use the Maven assembly plugin -->

<project name="Create-bsf-all">

    <property name="bsf.version" value="3.0-beta2"/>

    <target name="create-bsf-all">

        <mkdir dir="${basedir}/target/bsf-all"/>
        <unzip src="${localRepository}/org/apache/bsf/bsf-api/${bsf.version}/bsf-api-${bsf.version}.jar" dest="${basedir}/target/bsf-all" overwrite="false"/>
        <unzip src="${localRepository}/org/apache/bsf/bsf-engines/${bsf.version}/bsf-engines-${bsf.version}.jar" dest="${basedir}/target/bsf-all" overwrite="false"/>
        <unzip src="${localRepository}/org/apache/bsf/bsf-utils/${bsf.version}/bsf-utils-${bsf.version}.jar" dest="${basedir}/target/bsf-all" overwrite="false"/>

        <copy file="${basedir}/src/bin/LICENSE" tofile="${basedir}/target/bsf-all/LICENSE" overwrite="true" />
        <copy file="${basedir}/src/bin/NOTICE" tofile="${basedir}/target/bsf-all/NOTICE" overwrite="true" />

        <zip destfile="${basedir}/target/bsf-all-${bsf.version}.jar" basedir="${basedir}/target/bsf-all" />

        <!-- these are required for the mvn install command to work correctly -->
        <condition property="maven.suffix" value="">
            <os family="unix"/>
        </condition>
        <condition property="maven.suffix" value=".bat">
            <os family="windows"/>
        </condition>

        <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="true">
            <arg line="install:install-file -DgroupId=org.apache.bsf -DartifactId=bsf-all -Dversion=${bsf.version} -Dpackaging=jar -DgeneratePom=false -Dfile=${basedir}/target/bsf-all-${bsf.version}.jar"/>
        </exec>

    </target>

</project>
