package_linux_reh.sh 2.9 KB

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