build.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. ### Windows
  3. # to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build.sh
  4. ###
  5. export APP_NAME="VSCodium"
  6. export CI_BUILD="no"
  7. export SHOULD_BUILD="yes"
  8. export SKIP_ASSETS="yes"
  9. export SKIP_BUILD="no"
  10. export SKIP_SOURCE="no"
  11. export VSCODE_LATEST="no"
  12. export VSCODE_QUALITY="stable"
  13. while getopts ":ilop" opt; do
  14. case "$opt" in
  15. i)
  16. export VSCODE_QUALITY="insider"
  17. ;;
  18. l)
  19. export VSCODE_LATEST="yes"
  20. ;;
  21. o)
  22. export SKIP_BUILD="yes"
  23. ;;
  24. p)
  25. export SKIP_ASSETS="no"
  26. ;;
  27. s)
  28. export SKIP_SOURCE="yes"
  29. ;;
  30. esac
  31. done
  32. case "${OSTYPE}" in
  33. darwin*)
  34. export OS_NAME="osx"
  35. ;;
  36. msys* | cygwin*)
  37. export OS_NAME="windows"
  38. ;;
  39. *)
  40. export OS_NAME="linux"
  41. ;;
  42. esac
  43. UNAME_ARCH=$( uname -m )
  44. if [[ "${UNAME_ARCH}" == "arm64" ]]; then
  45. export VSCODE_ARCH="arm64"
  46. else
  47. export VSCODE_ARCH="x64"
  48. fi
  49. echo "OS_NAME=\"${OS_NAME}\""
  50. echo "SKIP_SOURCE=\"${SKIP_SOURCE}\""
  51. echo "SKIP_BUILD=\"${SKIP_BUILD}\""
  52. echo "SKIP_ASSETS=\"${SKIP_ASSETS}\""
  53. echo "VSCODE_ARCH=\"${VSCODE_ARCH}\""
  54. echo "VSCODE_LATEST=\"${VSCODE_LATEST}\""
  55. echo "VSCODE_QUALITY=\"${VSCODE_QUALITY}\""
  56. if [[ "${SKIP_SOURCE}" == "no" ]]; then
  57. rm -rf vscode* VSCode*
  58. . get_repo.sh
  59. . version.sh
  60. # save variables for later
  61. echo "MS_TAG=\"${MS_TAG}\"" > build.env
  62. echo "MS_COMMIT=\"${MS_COMMIT}\"" >> build.env
  63. echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" >> build.env
  64. echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\"" >> build.env
  65. else
  66. if [[ "${SKIP_ASSETS}" != "no" ]]; then
  67. rm -rf VSCode*
  68. fi
  69. . build.env
  70. echo "MS_TAG=\"${MS_TAG}\""
  71. echo "MS_COMMIT=\"${MS_COMMIT}\""
  72. echo "RELEASE_VERSION=\"${RELEASE_VERSION}\""
  73. echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\""
  74. fi
  75. if [[ "${SKIP_BUILD}" == "no" ]]; then
  76. if [[ "${SKIP_SOURCE}" != "no" ]]; then
  77. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  78. git add .
  79. git reset -q --hard HEAD
  80. cd ..
  81. fi
  82. . build.sh
  83. if [[ "${VSCODE_QUALITY}" == "insider" && "${VSCODE_LATEST}" == "yes" ]]; then
  84. echo "$( cat "insider.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )" > "insider.json"
  85. fi
  86. fi
  87. if [[ "${SKIP_ASSETS}" == "no" ]]; then
  88. if [[ "${OS_NAME}" == "windows" ]]; then
  89. rm -rf build/windows/msi/releasedir
  90. fi
  91. . prepare_assets.sh
  92. fi