build.sh 2.5 KB

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