You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by ch...@apache.org on 2017/02/15 15:44:26 UTC

incubator-toree git commit: Added sbt/sbt script from old Apache Spark modified to work with Toree

Repository: incubator-toree
Updated Branches:
  refs/heads/0.1.x eb770f758 -> 08f769018


Added sbt/sbt script from old Apache Spark modified to work with Toree


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/08f76901
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/08f76901
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/08f76901

Branch: refs/heads/0.1.x
Commit: 08f7690181082d9f1f9706b298bfe9d9b5793aa2
Parents: eb770f7
Author: Chip Senkbeil <ch...@gmail.com>
Authored: Wed Feb 15 09:44:10 2017 -0600
Committer: Chip Senkbeil <ch...@gmail.com>
Committed: Wed Feb 15 09:44:10 2017 -0600

----------------------------------------------------------------------
 .gitignore |  2 ++
 Makefile   | 11 ++++++-----
 sbt/sbt    | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/08f76901/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 4474cf0..c4c6ee9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,5 @@ dist/
 .ensime_cache/
 
 Untitled*.ipynb
+sbt/*.jar
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/08f76901/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 58f2933..c0aa7f2 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ else
 IS_SNAPSHOT?=true
 SNAPSHOT:=-SNAPSHOT
 endif
+SBT=sbt/sbt
 
 APACHE_SPARK_VERSION?=1.6.1
 IMAGE?=jupyter/pyspark-notebook:8dfd60b729bf
@@ -75,7 +76,7 @@ clean-dist:
 
 clean: VM_WORKDIR=/src/toree-kernel
 clean: clean-dist
-	$(call RUN,$(ENV_OPTS) sbt clean)
+	$(call RUN,$(ENV_OPTS) $(SBT) clean)
 	rm -r `find . -name target -type d`
 
 .example-image: EXTRA_CMD?=printf "deb http://cran.rstudio.com/bin/linux/debian jessie-cran3/" >> /etc/apt/sources.list; apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480; apt-get update; pip install jupyter_declarativewidgets==0.4.4; jupyter declarativewidgets install --user; jupyter declarativewidgets activate; pip install jupyter_dashboards; jupyter dashboards install --user; jupyter dashboards activate; apt-get update; apt-get install --yes curl; curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -; apt-get install --yes nodejs r-base r-base-dev; npm install -g bower;
@@ -100,7 +101,7 @@ target/scala-2.10/$(ASSEMBLY_JAR): VM_WORKDIR=/src/toree-kernel
 target/scala-2.10/$(ASSEMBLY_JAR): ${shell find ./*/src/main/**/*}
 target/scala-2.10/$(ASSEMBLY_JAR): ${shell find ./*/build.sbt}
 target/scala-2.10/$(ASSEMBLY_JAR): dist/toree-legal project/build.properties build.sbt project/common.scala project/plugins.sbt
-	$(call RUN,$(ENV_OPTS) sbt toree/assembly)
+	$(call RUN,$(ENV_OPTS) $(SBT) toree/assembly)
 
 build: target/scala-2.10/$(ASSEMBLY_JAR)
 
@@ -118,10 +119,10 @@ dev: .example-image dist
 
 test: VM_WORKDIR=/src/toree-kernel
 test:
-	$(call RUN,$(ENV_OPTS) JAVA_OPTS="-Xmx4096M" sbt compile test)
+	$(call RUN,$(ENV_OPTS) JAVA_OPTS="-Xmx4096M" $(SBT) compile test)
 
 sbt-%:
-	$(call RUN,$(ENV_OPTS) sbt $(subst sbt-,,$@) )
+	$(call RUN,$(ENV_OPTS) $(SBT) $(subst sbt-,,$@) )
 
 dist/toree/lib: target/scala-2.10/$(ASSEMBLY_JAR)
 	@mkdir -p dist/toree/lib
@@ -207,7 +208,7 @@ system-test: pip-release
 # Jars
 ################################################################################
 publish-jars:
-	@$(ENV_OPTS) GPG_PASSWORD='$(GPG_PASSWORD)' GPG=$(GPG) sbt publish-signed
+	@$(ENV_OPTS) GPG_PASSWORD='$(GPG_PASSWORD)' GPG=$(GPG) $(SBT) publish-signed
 
 ################################################################################
 # PIP PACKAGE

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/08f76901/sbt/sbt
----------------------------------------------------------------------
diff --git a/sbt/sbt b/sbt/sbt
new file mode 100755
index 0000000..7a278e8
--- /dev/null
+++ b/sbt/sbt
@@ -0,0 +1,55 @@
+#!/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} \
+  "$@"
+