| #!/bin/bash |
| |
| # |
| # 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. |
| # |
| |
| # |
| # From https://github.com/apache/spark/blob/branch-0.9/sbt/sbt |
| # |
| |
| # This script launches sbt for this project. If present it uses the system |
| # version of sbt. If there is no system version of sbt it attempts to download |
| # sbt locally. |
| SBT_VERSION=`awk -F "=" '/sbt\\.version/ {print $2}' ./project/build.properties` |
| URL1=http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/${SBT_VERSION}/sbt-launch.jar |
| URL2=http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/${SBT_VERSION}/sbt-launch.jar |
| JAR=sbt/sbt-launch-${SBT_VERSION}.jar |
| |
| # Download sbt launch jar if it hasn't been downloaded yet |
| if [ ! -f ${JAR} ]; then |
| # Download |
| printf "Attempting to fetch sbt\n" |
| if hash curl 2>/dev/null; then |
| curl --fail --location --progress-bar ${URL1} > ${JAR} || curl --fail --location --progress-bar ${URL2} > ${JAR} |
| elif hash wget 2>/dev/null; then |
| wget --progress=bar ${URL1} -O ${JAR} || wget --progress=bar ${URL2} -O ${JAR} |
| else |
| printf "You do not have curl or wget installed, please install sbt manually from http://www.scala-sbt.org/\n" |
| exit -1 |
| fi |
| fi |
| if [ ! -f ${JAR} ]; then |
| # We failed to download |
| printf "Our attempt to download sbt locally to ${JAR} failed. Please install sbt manually from http://www.scala-sbt.org/\n" |
| exit -1 |
| fi |
| printf "Launching sbt from ${JAR}\n" |
| java \ |
| -Xmx1200m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=256m \ |
| -jar ${JAR} \ |
| "$@" |
| |