#!/usr/bin/env bash

#
# Copyright 2018 Analytics Zoo Authors.
#
# 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.
#

set -e
RUN_SCRIPT_DIR=$(cd $(dirname $0) ; pwd)
echo $RUN_SCRIPT_DIR

if (( $# < 2)); then
  echo "Usage: build.sh platform version quick_build mvn_parameters"
  echo "Usage example: bash build.sh linux default true"
  echo "Usage example: bash build.sh linux 0.12.0.dev0 false"
  echo "If needed, you can also add other profiles such as: -Dspark.version=2.4.6 -Dbigdl.artifactId=bigdl-SPARK_2.4 -P spark_2.4+"
  exit -1
fi

platform=$1
version=$2
quick=$3
profiles=${*:4}

bash ${RUN_SCRIPT_DIR}/release.sh ${platform} ${version} ${quick} false ${profiles}
