2024-02-21 19:19:36 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
if [[ "${CI_BUILD}" == "no" ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-21 23:48:39 +03:00
|
|
|
tar -xzf ./vscode.tar.gz
|
2024-02-21 19:19:36 +03:00
|
|
|
|
2024-02-22 03:07:03 +03:00
|
|
|
chown -R root:root vscode
|
|
|
|
|
2024-02-21 19:19:36 +03:00
|
|
|
cd vscode || { echo "'vscode' dir not found"; exit 1; }
|
|
|
|
|
2024-02-22 01:16:19 +03:00
|
|
|
export VSCODE_SKIP_NODE_VERSION_CHECK=1
|
2024-02-21 19:19:36 +03:00
|
|
|
export VSCODE_SYSROOT_PREFIX='-glibc-2.17'
|
|
|
|
|
2024-11-04 14:14:15 +03:00
|
|
|
if [[ "${VSCODE_ARCH}" == "arm64" || "${VSCODE_ARCH}" == "armhf" ]]; then
|
|
|
|
export VSCODE_SKIP_SYSROOT=1
|
|
|
|
export USE_GNUPP2A=1
|
|
|
|
elif [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
|
|
|
|
export VSCODE_SYSROOT_REPOSITORY='VSCodium/vscode-linux-build-agent'
|
2024-06-11 17:56:15 +03:00
|
|
|
export VSCODE_SYSROOT_VERSION='20240129-253798'
|
|
|
|
export VSCODE_SYSROOT_PREFIX='-glibc-2.28'
|
2024-11-04 14:14:15 +03:00
|
|
|
export USE_GNUPP2A=1
|
|
|
|
elif [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
|
|
|
|
export VSCODE_ELECTRON_REPOSITORY='riscv-forks/electron-riscv-releases'
|
2024-06-11 19:41:17 +03:00
|
|
|
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
|
|
|
|
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
2024-11-04 14:14:15 +03:00
|
|
|
export VSCODE_SKIP_SETUPENV=1
|
2024-11-04 20:54:40 +03:00
|
|
|
fi
|
2024-10-07 17:33:38 +03:00
|
|
|
|
2024-11-04 20:54:40 +03:00
|
|
|
if [[ -f "../electron_linux_${VSCODE_ARCH}.sh" ]]; then
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "../electron_linux_${VSCODE_ARCH}.sh"
|
2024-10-07 17:33:38 +03:00
|
|
|
|
2024-11-04 20:54:40 +03:00
|
|
|
if [[ "${ELECTRON_VERSION}" != "$( yarn config get target )" ]]; then
|
2024-08-12 13:04:31 +03:00
|
|
|
# Fail the pipeline if electron target doesn't match what is used.
|
2024-11-04 20:54:40 +03:00
|
|
|
echo "Electron ${VSCODE_ARCH} binary version doesn't match target electron version!"
|
2024-11-04 14:14:15 +03:00
|
|
|
echo "Releases available at: https://github.com/${VSCODE_ELECTRON_REPOSITORY}/releases"
|
2024-07-21 11:26:38 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-06-11 19:41:17 +03:00
|
|
|
fi
|
|
|
|
|
2024-07-08 18:17:26 +03:00
|
|
|
if [[ -d "../patches/linux/client/" ]]; then
|
|
|
|
for file in "../patches/linux/client/"*.patch; do
|
2024-02-22 12:13:27 +03:00
|
|
|
if [[ -f "${file}" ]]; then
|
|
|
|
echo applying patch: "${file}";
|
|
|
|
if ! git apply --ignore-whitespace "${file}"; then
|
|
|
|
echo failed to apply patch "${file}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2024-02-22 11:43:59 +03:00
|
|
|
|
2024-11-04 14:14:15 +03:00
|
|
|
if [[ -n "${USE_GNUPP2A}" ]]; then
|
|
|
|
INCLUDES=$(cat <<EOF
|
|
|
|
{
|
|
|
|
"target_defaults": {
|
|
|
|
"conditions": [
|
|
|
|
["OS=='linux'", {
|
|
|
|
'cflags_cc!': [ '-std=gnu++20' ],
|
|
|
|
'cflags_cc': [ '-std=gnu++2a' ],
|
|
|
|
}]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ ! -d "$HOME/.gyp" ]; then
|
|
|
|
mkdir -p "$HOME/.gyp"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "${INCLUDES}" > "$HOME/.gyp/include.gypi"
|
|
|
|
fi
|
|
|
|
|
2024-02-21 19:19:36 +03:00
|
|
|
for i in {1..5}; do # try 5 times
|
2024-10-07 17:33:38 +03:00
|
|
|
npm ci --prefix build && break
|
2024-02-21 19:19:36 +03:00
|
|
|
if [[ $i == 3 ]]; then
|
2024-10-07 17:33:38 +03:00
|
|
|
echo "Npm install failed too many times" >&2
|
2024-02-21 19:19:36 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-10-07 17:33:38 +03:00
|
|
|
echo "Npm install failed $i, trying again..."
|
2024-02-21 19:19:36 +03:00
|
|
|
done
|
|
|
|
|
2024-11-04 14:14:15 +03:00
|
|
|
if [[ -z "${VSCODE_SKIP_SETUPENV}" ]]; then
|
|
|
|
if [[ -n "${VSCODE_SKIP_SYSROOT}" ]]; then
|
|
|
|
source ./build/azure-pipelines/linux/setup-env.sh --skip-sysroot
|
|
|
|
else
|
|
|
|
source ./build/azure-pipelines/linux/setup-env.sh
|
|
|
|
fi
|
2024-06-11 17:56:15 +03:00
|
|
|
fi
|
2024-04-05 00:14:54 +03:00
|
|
|
|
|
|
|
for i in {1..5}; do # try 5 times
|
2024-10-07 17:33:38 +03:00
|
|
|
npm ci && break
|
|
|
|
if [[ $i -eq 3 ]]; then
|
|
|
|
echo "Npm install failed too many times" >&2
|
2024-04-05 00:14:54 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-10-07 17:33:38 +03:00
|
|
|
echo "Npm install failed $i, trying again..."
|
2024-04-05 00:14:54 +03:00
|
|
|
done
|
2024-02-21 19:19:36 +03:00
|
|
|
|
|
|
|
node build/azure-pipelines/distro/mixin-npm
|
|
|
|
|
|
|
|
yarn gulp "vscode-linux-${VSCODE_ARCH}-min-ci"
|
|
|
|
|
|
|
|
find "../VSCode-linux-${VSCODE_ARCH}" -print0 | xargs -0 touch -c
|
|
|
|
|
|
|
|
cd ..
|