package_linux_reh.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/usr/bin/env bash
  2. # shellcheck disable=SC1091
  3. set -ex
  4. if [[ "${CI_BUILD}" == "no" ]]; then
  5. exit 1
  6. fi
  7. tar -xzf ./vscode.tar.gz
  8. cd vscode || { echo "'vscode' dir not found"; exit 1; }
  9. GLIBC_VERSION="2.17"
  10. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  11. GLIBC_VERSION="2.28"
  12. fi
  13. export VSCODE_PLATFORM='linux'
  14. export VSCODE_SYSROOT_PREFIX="-glibc-${GLIBC_VERSION}"
  15. VSCODE_HOST_MOUNT="$( pwd )"
  16. export VSCODE_HOST_MOUNT
  17. if [[ "${VSCODE_ARCH}" == "x64" || "${VSCODE_ARCH}" == "arm64" ]]; then
  18. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:centos7-devtoolset8-${VSCODE_ARCH}"
  19. elif [[ "${VSCODE_ARCH}" == "armhf" ]]; then
  20. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-arm32v7"
  21. elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  22. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:bionic-devtoolset-ppc64le"
  23. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  24. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  25. elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
  26. VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME="vscodium/vscodium-linux-build-agent:focal-devtoolset-riscv64"
  27. export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  28. export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  29. # Unofficial RISC-V nodejs builds doesn't provide v16.x
  30. sed -i '/target/s/"16.*"/"18.18.1"/' remote/.yarnrc
  31. fi
  32. export VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME
  33. for i in {1..5}; do # try 5 times
  34. yarn --cwd build --frozen-lockfile --check-files && break
  35. if [[ $i == 3 ]]; then
  36. echo "Yarn failed too many times" >&2
  37. exit 1
  38. fi
  39. echo "Yarn failed $i, trying again..."
  40. done
  41. if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
  42. source ./build/azure-pipelines/linux/setup-env.sh
  43. else
  44. ./build/azure-pipelines/linux/setup-env.sh --only-remote
  45. fi
  46. for i in {1..5}; do # try 5 times
  47. yarn --frozen-lockfile --check-files && break
  48. if [ $i -eq 3 ]; then
  49. echo "Yarn failed too many times" >&2
  50. exit 1
  51. fi
  52. echo "Yarn failed $i, trying again..."
  53. done
  54. EXPECTED_GLIBC_VERSION="${GLIBC_VERSION}" EXPECTED_GLIBCXX_VERSION="3.4.22" ./build/azure-pipelines/linux/verify-glibc-requirements.sh
  55. node build/azure-pipelines/distro/mixin-npm
  56. export VSCODE_NODE_GLIBC="-glibc-${GLIBC_VERSION}"
  57. yarn gulp minify-vscode-reh
  58. yarn gulp "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-min-ci"
  59. cd ..
  60. APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
  61. mkdir -p assets
  62. echo "Building and moving REH"
  63. cd "vscode-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}"
  64. tar czf "../assets/${APP_NAME_LC}-reh-${VSCODE_PLATFORM}-${VSCODE_ARCH}-${RELEASE_VERSION}.tar.gz" .
  65. cd ..
  66. npm install -g checksum
  67. sum_file() {
  68. if [[ -f "${1}" ]]; then
  69. echo "Calculating checksum for ${1}"
  70. checksum -a sha256 "${1}" > "${1}".sha256
  71. checksum "${1}" > "${1}".sha1
  72. fi
  73. }
  74. cd assets
  75. for FILE in *; do
  76. if [[ -f "${FILE}" ]]; then
  77. sum_file "${FILE}"
  78. fi
  79. done
  80. cd ..