#!/bin/sh -e if [ ! $SBT_VERSION ]; then SBT_VERSION=0.11.0; fi if [ ! $SBT_DIR ]; then SBT_DIR=$HOME/.sbt; fi if [ ! $SBT_FILENAME ]; then SBT_FILENAME=sbt-launch-$SBT_VERSION.jar; fi if [ ! $SBT_LOCATION ]; then SBT_LOCATION=$SBT_DIR/$SBT_FILENAME; fi if expr match $SBT_VERSION "0.7" > /dev/null; then SBT_URL="http://simple-build-tool.googlecode.com/files/$SBT_FILENAME" else SBT_URL="http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/$SBT_VERSION/sbt-launch.jar" fi if [ ! -f $SBT_LOCATION ]; then echo "Could not find $SBT_FILENAME in $SBT_DIR, downloading..." mkdir -p $SBT_DIR if which wget > /dev/null; then CMD="wget --progress=bar $SBT_URL -O $SBT_LOCATION" elif which curl > /dev/null; then CMD="curl $SBT_URL -o $SBT_LOCATION" else echo "Could not find wget or curl." exit 1 fi if ! $CMD; then echo "Failed retrieving $SBT_URL ... cleaning up." if [ -f $SBT_LOCATION ]; then rm -r $SBT_LOCATION; fi exit 1 fi fi # Patch a broken dependency in SBT >= 0.10.0 COMMONS_LOGGING_DIR="$HOME/.m2/repository/commons-logging/commons-logging/1.0.4" COMMONS_LOGGING_LOCATION="$COMMONS_LOGGING_DIR/commons-logging-1.0.4.jar" COMMONS_LOGGING_URL="http://archive.apache.org/dist/commons/logging/binaries/commons-logging-1.0.4.tar.gz" if [ ! -f $COMMONS_LOGGING_LOCATION ]; then echo "commons-logging 1.0.4 is missing, downloading..." mkdir -p $COMMONS_LOGGING_DIR if which curl > /dev/null; then GET="curl $COMMONS_LOGGING_URL" elif which wget > /dev/null; then GET="wget -qO- $COMMONS_LOGGING_URL" fi if ! $GET | tar -xzO "commons-logging-1.0.4/commons-logging.jar" > $COMMONS_LOGGING_LOCATION; then echo "Failed retrieving $COMMONS_LOGGING_URL ... cleaning up. Will attempt to run SBT anyway." if [ -f $COMMONS_LOGGING_LOCATION ]; then rm -r $COMMONS_LOGGING_LOCATION; fi fi fi # Set SBT_OPTS in your shell profile or launch script. A good default # value is: # # export SBT_OPTS="-Dfile.encoding=UTF8 -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m" # java $SBT_OPTS -jar $SBT_LOCATION "$@" # vim:sw=4:sts=4:expandtab