Skip to content

Commit

Permalink
Fixed sbt bootstrap startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Naaman Newbold committed Dec 7, 2013
1 parent e66871f commit 989d04f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/compile
Expand Up @@ -13,7 +13,8 @@ OPT_DIR=$BP_DIR/opt
APP_BUILD_DIR=$(cd $1; pwd)
CACHE_DIR=$2

BUILD_DIR="/tmp/build_dir"
# Move app to a static build dir to keep paths the same between builds
BUILD_DIR="/tmp/scala_buildpack_build_dir"
mv $APP_BUILD_DIR $BUILD_DIR

curl --silent --location http://heroku-jvm-common.s3.amazonaws.com/jvm-buildpack-common.tar.gz | tar xz
Expand Down Expand Up @@ -47,7 +48,7 @@ SBT_BINDIR="$SBT_USER_HOME"/bin
cd $BUILD_DIR

# unpack cache
CACHED_DIRS="$SBT_USER_HOME/.ivy2 $SBT_BINDIR target project/target"
CACHED_DIRS="$SBT_USER_HOME/.ivy2 $SBT_BINDIR target project/target project/boot"
for DIR in $CACHED_DIRS; do
cache_copy $DIR $CACHE_DIR $BUILD_DIR
done
Expand Down Expand Up @@ -87,8 +88,9 @@ if [ ! -f "$SBT_BINDIR"/"$SBT_JAR" ]; then
## clean up any old versions
/bin/rm -f sbt sbt-launch-*.jar || true

echo "-----> Building app with sbt"
echo -n "-----> Downloading SBT..."
curl --silent --max-time 60 -O --location $SBT_URL --fail || error "Failed to download $SBT_JAR"
echo "done"

echo "#!/usr/bin/env bash" > sbt
echo "/usr/bin/java -Dsbt.boot.properties=/app/.sbt_home/bin/sbt.boot.properties -Duser.home=/app/.sbt_home -Divy.default.ivy.user.dir=/app/.sbt_home/.ivy2 -jar /app/.sbt_home/bin/$SBT_JAR \"\$@\"" >> sbt
Expand All @@ -111,7 +113,7 @@ cp -p $OPT_DIR/$HEROKU_PLUGIN $SBT_USER_HOME/.sbt/plugins/$HEROKU_PLUGIN
# build app
echo "-----> Running: sbt $SBT_TASKS"
test -e "$SBT_BINDIR"/sbt.boot.properties && PROPS_OPTION="-Dsbt.boot.properties=$SBT_BINDIR/sbt.boot.properties"
HOME="$SBT_USER_HOME_ABSOLUTE" java -Xms768M -Xmx1024M -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF8 -Duser.home="$SBT_USER_HOME_ABSOLUTE" -Dsbt.log.noformat=true -Divy.default.ivy.user.dir="$SBT_USER_HOME_ABSOLUTE/.ivy2" -Dsbt.global.base=$SBT_USER_HOME_ABSOLUTE $PROPS_OPTION -jar "$SBT_BINDIR"/$SBT_JAR compile 2>&1 | sed -u 's/^/ /'
HOME="$SBT_USER_HOME_ABSOLUTE" java -Xms768M -Xmx1024M -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF8 -Duser.home="$SBT_USER_HOME_ABSOLUTE" -Dsbt.log.noformat=true -Divy.default.ivy.user.dir="$SBT_USER_HOME_ABSOLUTE/.ivy2" -Dsbt.global.base="$SBT_USER_HOME_ABSOLUTE" $PROPS_OPTION -jar "$SBT_BINDIR"/$SBT_JAR $SBT_TASKS 2>&1 | sed -u 's/^/ /'
if [ "${PIPESTATUS[*]}" != "0 0" ]; then
echo " ! Failed to build app with sbt"
exit 1
Expand Down Expand Up @@ -145,4 +147,5 @@ if is_play $BUILD_DIR ; then
fi
fi

# Move compiled app back to where Heroku expects it
mv $BUILD_DIR $APP_BUILD_DIR

0 comments on commit 989d04f

Please sign in to comment.