The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

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