The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

57 lines
1.8 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. # Sets the Bubble version number in various source files.
  6. #
  7. # Usage:
  8. #
  9. # _set_version [ReleaseName x.y.z]
  10. #
  11. # ReleaseName : a Bubble release, like Adventure
  12. # x.y.z : the version number, like 1.5.2
  13. #
  14. SCRIPT="${0}"
  15. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  16. . "${SCRIPT_DIR}"/bubble_common
  17. V_NAME="${1:?no release specified}"
  18. V_NUMBER="${2:?no version specified}"
  19. if [[ -n "$(echo "${V_NAME}" | awk -F ' ' '{print $2}')" ]] ; then
  20. die "ReleaseName cannot contain spaces"
  21. fi
  22. if [[ "$(echo "${V_NUMBER}" | tr -cd '[[:digit:]].')" != "${V_NUMBER}" ]] ; then
  23. die "Invalid version number: ${V_NUMBER}"
  24. fi
  25. function process_pom () {
  26. V_NUMBER="${1}"
  27. POM="${2}"
  28. T_FILE=$(mktemp "/tmp/$(basename "${POM}").XXXXXXX")
  29. FOUND_VERSION=0
  30. IFS=''
  31. cat "${POM}" | while read -r line ; do
  32. if [[ ${FOUND_VERSION} -eq 1 ]] ; then
  33. echo "${line}" | tr -d '[:digit:].' | sed -e "s/></>${V_NUMBER}</" >> "${T_FILE}"
  34. FOUND_VERSION=0
  35. continue
  36. elif [[ -n "$(echo "${line}" | grep "@@BUBBLE_VERSION@@")" ]] ; then
  37. FOUND_VERSION=1
  38. fi
  39. echo "${line}" >> "${T_FILE}"
  40. done
  41. mv "${T_FILE}" "${POM}" || die "Error moving ${T_FILE} -> ${POM}"
  42. }
  43. cd "${SCRIPT_DIR}/.." || die "Error changing to Bubble main directory"
  44. process_pom "${V_NUMBER}" pom.xml
  45. process_pom "${V_NUMBER}" bubble-server/pom.xml
  46. process_pom "${V_NUMBER}" utils/pom.xml
  47. VERSION_PROP_FILE="bubble-server/src/main/resources/META-INF/bubble/bubble.properties"
  48. P_TEMP=$(mktemp /tmp/bubble.properties.XXXXXXX)
  49. cat "${VERSION_PROP_FILE}" | sed -e "s/bubble.version=.*/bubble.version=${V_NAME} ${V_NUMBER}/" > "${P_TEMP}"
  50. mv "${P_TEMP}" ${VERSION_PROP_FILE} || die "Error moving ${P_TEMP} -> ${VERSION_PROP_FILE}"