The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

59 lignes
2.2 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. #
  6. # Prepares the bubble.jar file for active usage.
  7. #
  8. # 1. Copy scripts to bubble-server/target/classes/scripts
  9. #
  10. # 2. If the environment variable INSTALL_WEB is equal to "web", also build and install the bubble-web
  11. # site to bubble-server/target/classes/site
  12. #
  13. # Usage:
  14. #
  15. # prep_bubble_jar
  16. #
  17. # Environment variables:
  18. #
  19. # INSTALL_WEB : if this is equal to 'web' then the frontend will be built and included in the jar
  20. # DEBUG_BUILD : if this is equal to 'debug' then nothing will be done, the jar will be left as-is
  21. # BUBBLE_PRODUCTION : if this is set to anything, then a production build will be made.
  22. #
  23. SCRIPT="${0}"
  24. SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd)
  25. . ${SCRIPT_DIR}/bubble_common
  26. if [[ ! -z "${DEBUG_BUILD}" && "${DEBUG_BUILD}" == "debug" ]] ; then
  27. echo "DEBUG_BUILD is set, not doing anything further"
  28. exit 0
  29. fi
  30. BUBBLE_SERVER="$(cd "${SCRIPT_DIR}/../bubble-server" && pwd)"
  31. CLASSES_DIR="${BUBBLE_SERVER}/target/classes"
  32. if [[ -z "${BUBBLE_JAR}" ]] ; then
  33. die "bubble jar not found: ${BUBBLE_JAR}"
  34. fi
  35. mkdir -p ${CLASSES_DIR}/scripts
  36. for script in $(cat ${BUBBLE_SERVER}/src/main/resources/ansible/bubble_scripts.txt) ; do
  37. cp ${SCRIPT_DIR}/${script} ${CLASSES_DIR}/scripts || die "Error copying ${SCRIPT_DIR}/${script} -> ${CLASSES_DIR}/scripts"
  38. done
  39. cd ${CLASSES_DIR} && jar uvf ${BUBBLE_JAR} scripts || die "Error updating ${BUBBLE_JAR} with scripts"
  40. if [[ ! -z "${BUBBLE_PRODUCTION}" || ( ! -z "${INSTALL_WEB}" && "${INSTALL_WEB}" == "web" ) ]] ; then
  41. mkdir -p ${CLASSES_DIR}/site
  42. BUBBLE_WEB="$(cd "${SCRIPT_DIR}/../bubble-web" && pwd)"
  43. if [[ ! -z "${BUBBLE_PRODUCTION}" ]] ; then
  44. WEBPACK_OPTIONS="--mode=production"
  45. else
  46. WEBPACK_OPTIONS=""
  47. fi
  48. cd ${BUBBLE_WEB} && npm install && webpack ${WEBPACK_OPTIONS} || die "Error building bubble-web"
  49. cp -R ${BUBBLE_WEB}/dist/* ${CLASSES_DIR}/site/ || die "Error copying ${BUBBLE_WEB}/dist/* -> ${CLASSES_DIR}/site/"
  50. cd ${CLASSES_DIR} && jar uvf ${BUBBLE_JAR} site || die "Error updating ${BUBBLE_JAR} with site"
  51. echo "Installed bubble-web to ${CLASSES_DIR}/site/"
  52. fi