vscodium/build/build.sh

121 lines
2.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# shellcheck disable=SC1091,SC2129
2022-08-29 16:13:25 +03:00
### Windows
# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build.sh
###
2022-10-06 23:15:41 +03:00
export APP_NAME="VSCodium"
2024-02-07 02:51:19 +03:00
export BINARY_NAME="codium"
2022-08-29 22:56:51 +03:00
export CI_BUILD="no"
export SHOULD_BUILD="yes"
2022-10-06 23:15:41 +03:00
export SKIP_ASSETS="yes"
2023-01-29 18:34:54 +03:00
export SKIP_BUILD="no"
export SKIP_SOURCE="no"
2022-08-29 16:13:25 +03:00
export VSCODE_LATEST="no"
export VSCODE_QUALITY="stable"
2024-02-07 02:51:19 +03:00
export VSCODE_SKIP_NODE_VERSION_CHECK="yes"
2022-08-29 16:13:25 +03:00
while getopts ":ilops" opt; do
2022-08-29 16:13:25 +03:00
case "$opt" in
i)
2024-02-07 02:51:19 +03:00
export BINARY_NAME="codium-insiders"
2022-08-29 16:13:25 +03:00
export VSCODE_QUALITY="insider"
;;
l)
export VSCODE_LATEST="yes"
;;
o)
export SKIP_BUILD="yes"
;;
p)
2022-10-06 23:15:41 +03:00
export SKIP_ASSETS="no"
;;
2023-01-29 18:34:54 +03:00
s)
export SKIP_SOURCE="yes"
;;
*)
;;
2022-08-29 16:13:25 +03:00
esac
done
case "${OSTYPE}" in
darwin*)
export OS_NAME="osx"
;;
msys* | cygwin*)
export OS_NAME="windows"
;;
*)
export OS_NAME="linux"
;;
esac
UNAME_ARCH=$( uname -m )
if [[ "${UNAME_ARCH}" == "arm64" ]]; then
export VSCODE_ARCH="arm64"
2023-06-05 09:50:34 +03:00
elif [[ "${UNAME_ARCH}" == "ppc64le" ]]; then
export VSCODE_ARCH="ppc64le"
2022-08-29 16:13:25 +03:00
else
export VSCODE_ARCH="x64"
fi
echo "OS_NAME=\"${OS_NAME}\""
2023-01-29 18:34:54 +03:00
echo "SKIP_SOURCE=\"${SKIP_SOURCE}\""
echo "SKIP_BUILD=\"${SKIP_BUILD}\""
2022-10-06 23:15:41 +03:00
echo "SKIP_ASSETS=\"${SKIP_ASSETS}\""
echo "VSCODE_ARCH=\"${VSCODE_ARCH}\""
echo "VSCODE_LATEST=\"${VSCODE_LATEST}\""
echo "VSCODE_QUALITY=\"${VSCODE_QUALITY}\""
2022-08-29 16:13:25 +03:00
2023-01-29 18:34:54 +03:00
if [[ "${SKIP_SOURCE}" == "no" ]]; then
rm -rf vscode* VSCode*
. get_repo.sh
2022-11-04 14:48:12 +03:00
. version.sh
# save variables for later
echo "MS_TAG=\"${MS_TAG}\"" > build.env
echo "MS_COMMIT=\"${MS_COMMIT}\"" >> build.env
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\"" >> build.env
echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\"" >> build.env
else
2023-01-29 18:34:54 +03:00
if [[ "${SKIP_ASSETS}" != "no" ]]; then
rm -rf VSCode*
fi
. build.env
2022-08-29 16:13:25 +03:00
echo "MS_TAG=\"${MS_TAG}\""
echo "MS_COMMIT=\"${MS_COMMIT}\""
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\""
echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\""
fi
2023-01-29 18:34:54 +03:00
if [[ "${SKIP_BUILD}" == "no" ]]; then
if [[ "${SKIP_SOURCE}" != "no" ]]; then
cd vscode || { echo "'vscode' dir not found"; exit 1; }
git add .
git reset -q --hard HEAD
cd ..
fi
. build.sh
2023-11-15 19:31:04 +03:00
if [[ "${VSCODE_LATEST}" == "yes" ]]; then
jsonTmp=$( cat "${VSCODE_QUALITY}.json" | jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. | .tag=$tag | .commit=$commit' )
echo "${jsonTmp}" > "${VSCODE_QUALITY}.json" && unset jsonTmp
2023-01-29 18:34:54 +03:00
fi
fi
2022-10-06 23:15:41 +03:00
if [[ "${SKIP_ASSETS}" == "no" ]]; then
if [[ "${OS_NAME}" == "windows" ]]; then
rm -rf build/windows/msi/releasedir
fi
2022-10-06 23:15:41 +03:00
. prepare_assets.sh
fi