forked from mthenw/heroku-buildpack-vertx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile
executable file
·70 lines (57 loc) · 1.62 KB
/
compile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
# fail fast
set -e
OPENJDK7_URL="https://s3.amazonaws.com/heroku-jvm-langpack-java/openjdk7-u2-heroku-temaki.tar.gz"
VERTX_URL="http://dl.bintray.com/vertx/downloads/vert.x-2.0.2-final.tar.gz"
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2
#create the cache dir if it doesn't exist
mkdir -p $CACHE_DIR
cd $BUILD_DIR
if [ -d "$CACHE_DIR/.jdk7" ]; then
echo -n "Copying JDK to app directory"
cp -r "$CACHE_DIR/.jdk7" $BUILD_DIR
echo "done"
fi
if [ ! -d "$BUILD_DIR/.jdk7" ]; then
echo -n "-----> Installing OpenJDK7u2....."
mkdir "$BUILD_DIR/.jdk7"
cd "$BUILD_DIR/.jdk7"
curl --max-time 180 --location $OPENJDK7_URL | tar xz
cd $BUILD_DIR
cp -r .jdk7 $CACHE_DIR/.jdk7
echo " done"
fi
if [ -d "$CACHE_DIR/.vertx" ]; then
echo -n "Copying Vert.x to app direcotry"
cp -r "$CACHE_DIR/.vertx" $BUILD_DIR
echo " done"
fi
if [ ! -d "$BUILD_DIR/.vertx" ]; then
echo -n "-----> Installing Vert.x....."
curl --max-time 320 --location $VERTX_URL | tar xz
mv vert* .vertx
rm '.vertx/bin/vertx.bat'
cd $BUILD_DIR
cp -r .vertx $CACHE_DIR/.vertx
echo " done"
fi
cd $BUILD_DIR
export JAVA_HOME="$BUILD_DIR/.jdk7"
export VERTX_HOME="$BUILD_DIR/.vertx"
export PATH=$PATH:$JAVA_HOME/bin:$VERTX_HOME/bin
echo "Path is set to"
echo $PATH
if [ -f compile.sh ]; then
echo 'compile.sh file found, executing...'
chmod 700 compile.sh
./compile.sh
fi
# Warn if no Procfile is present
if [ ! -f Procfile ]; then
echo "-----> No Procfile found. Will use the following default process: "
echo " vertx run server.js"
fi