PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/bin/compile

https://github.com/codepants/heroku-buildpack-vertx-jdk7
#! | 71 lines | 57 code | 14 blank | 0 comment | 0 complexity | 1a392ff1c5e63a0630ad4dc49ff6eaee MD5 | raw file
  1. #!/usr/bin/env bash
  2. # bin/compile <build-dir> <cache-dir>
  3. # fail fast
  4. set -e
  5. BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
  6. # parse args
  7. BUILD_DIR=$1
  8. CACHE_DIR=$2
  9. #create the cache dir if it doesn't exist
  10. mkdir -p $CACHE_DIR
  11. cd $BUILD_DIR
  12. if [ -d "$CACHE_DIR/.jdk7" ]; then
  13. echo -n "copying jdk to app"
  14. cp -r "$CACHE_DIR/.jdk7" $BUILD_DIR
  15. echo "done"
  16. fi
  17. ORACLEJDK7_URL="https://s3.amazonaws.com/tarballz/jdk-7u9-linux-x64.tar.gz"
  18. if [ ! -d "$BUILD_DIR/.jdk7" ]; then
  19. echo -n "-----> Installing JDK7u9 build (to .jdk7)....."
  20. mkdir "$BUILD_DIR/.jdk7"
  21. cd "$BUILD_DIR/.jdk7"
  22. curl --max-time 180 --location $ORACLEJDK7_URL | tar xz
  23. cd $BUILD_DIR
  24. cp -r .jdk7 $CACHE_DIR/.jdk7
  25. echo " done"
  26. fi
  27. if [ -d "$CACHE_DIR/.vertx" ]; then
  28. echo -n "copying vertx to app"
  29. cp -r "$CACHE_DIR/.vertx" $BUILD_DIR
  30. echo "done"
  31. fi
  32. VERTX_URL="http://vertx.io/downloads/vert.x-1.3.0.final.tar.gz"
  33. if [ ! -d "$BUILD_DIR/.vertx" ]; then
  34. echo -n "-----> Installing Vert.x build (to .vertx)....."
  35. curl --max-time 320 --location $VERTX_URL | tar xz
  36. mv vert* .vertx
  37. rm '.vertx/bin/vertx.bat'
  38. cd $BUILD_DIR
  39. cp -r .vertx $CACHE_DIR/.vertx
  40. echo " done"
  41. fi
  42. cd $BUILD_DIR
  43. export JAVA_HOME="$BUILD_DIR/.jdk7"
  44. export VERTX_HOME="$BUILD_DIR/.vertx"
  45. export PATH=$PATH:$JAVA_HOME/bin:$VERTX_HOME/bin
  46. echo "Path is set to"
  47. echo $PATH
  48. if [ -f compile.sh ]; then
  49. echo 'compile.sh file found, executing...'
  50. chmod 700 compile.sh
  51. ./compile.sh
  52. fi
  53. # Warn if no Procfile is present
  54. if [ ! -f Procfile ]; then
  55. echo "-----> No Procfile found. Will use the following default process: "
  56. echo " vertx run server.groovy"
  57. fi