aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Karau <holden@pigscanfly.ca>2014-01-04 20:08:35 -0800
committerHolden Karau <holden@pigscanfly.ca>2014-01-04 20:08:35 -0800
commit9e9a913c2ffe0b01f051c18018740934a6a8691e (patch)
tree2d65e857007c8954ef0e1bbc80f7dc6aa062fff7
parentd43ad3ef2c3d4b690ba1d053729daefb507cd23c (diff)
downloadspark-9e9a913c2ffe0b01f051c18018740934a6a8691e.tar.gz
spark-9e9a913c2ffe0b01f051c18018740934a6a8691e.tar.bz2
spark-9e9a913c2ffe0b01f051c18018740934a6a8691e.zip
Add a script to download sbt if not present on the system
-rw-r--r--.gitignore1
-rw-r--r--project/build.properties2
-rwxr-xr-xsbt48
3 files changed, 51 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 399362f7d3..1692bde20f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.iml
*.iws
.idea/
+.sbtlib/*.jar
.settings
.cache
/build/
diff --git a/project/build.properties b/project/build.properties
index 9647277162..059edac7d4 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -15,4 +15,6 @@
# limitations under the License.
#
+# Note: If you change the sbt version please also change the sbt download
+# script in the root directory of the project called sbt.
sbt.version=0.12.4
diff --git a/sbt b/sbt
new file mode 100755
index 0000000000..e04a20c48a
--- /dev/null
+++ b/sbt
@@ -0,0 +1,48 @@
+#!/bin/bash
+# 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=0.12.4
+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=.sbtlib/sbt-launch-${SBT_VERSION}.jar
+
+printf "Checking for system sbt ["
+if hash sbt 2>/dev/null; then
+ printf "FOUND]\n"
+ # Use System SBT
+ sbt
+else
+ printf "NOT FOUND]\n"
+ # Download sbt or use allready downloaded
+ if [ ! -d .sbtlib ]; then
+ mkdir .sbtlib
+ fi
+ if [ ! -f ${JAR} ]; then
+ # Download
+ printf "Attempting to fetch sbt\n"
+ if hash curl 2>/dev/null; then
+ curl --progress-bar ${URL1} > ${JAR} || curl --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
+ 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
+ fi
+ printf "Launching sbt from .sbtlib\n"
+ java \
+ -Duser.timezone=UTC \
+ -Djava.awt.headless=true \
+ -Dfile.encoding=UTF-8 \
+ -XX:MaxPermSize=256m \
+ -Xmx1g \
+ -noverify \
+ -jar ${JAR} \
+ "$@"
+fi