vscodium/build/build.sh

118 lines
2.5 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# shellcheck disable=SC1091,SC2129
2022-08-29 09:13:25 -04:00
### Windows
# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build.sh
###
2022-10-06 16:15:41 -04:00
export APP_NAME="VSCodium"
2022-08-29 15:56:51 -04:00
export CI_BUILD="no"
export SHOULD_BUILD="yes"
2022-10-06 16:15:41 -04:00
export SKIP_ASSETS="yes"
2023-01-29 10:34:54 -05:00
export SKIP_BUILD="no"
export SKIP_SOURCE="no"
2022-08-29 09:13:25 -04:00
export VSCODE_LATEST="no"
export VSCODE_QUALITY="stable"
while getopts ":ilops" opt; do
2022-08-29 09:13:25 -04:00
case "$opt" in
i)
export VSCODE_QUALITY="insider"
;;
l)
export VSCODE_LATEST="yes"
;;
o)
export SKIP_BUILD="yes"
;;
p)
2022-10-06 16:15:41 -04:00
export SKIP_ASSETS="no"
;;
2023-01-29 10:34:54 -05:00
s)
export SKIP_SOURCE="yes"
;;
*)
;;
2022-08-29 09:13:25 -04: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 02:50:34 -04:00
elif [[ "${UNAME_ARCH}" == "ppc64le" ]]; then
export VSCODE_ARCH="ppc64le"
2022-08-29 09:13:25 -04:00
else
export VSCODE_ARCH="x64"
fi
echo "OS_NAME=\"${OS_NAME}\""
2023-01-29 10:34:54 -05:00
echo "SKIP_SOURCE=\"${SKIP_SOURCE}\""
echo "SKIP_BUILD=\"${SKIP_BUILD}\""
2022-10-06 16:15:41 -04:00
echo "SKIP_ASSETS=\"${SKIP_ASSETS}\""
echo "VSCODE_ARCH=\"${VSCODE_ARCH}\""
echo "VSCODE_LATEST=\"${VSCODE_LATEST}\""
echo "VSCODE_QUALITY=\"${VSCODE_QUALITY}\""
2022-08-29 09:13:25 -04:00
2023-01-29 10:34:54 -05:00
if [[ "${SKIP_SOURCE}" == "no" ]]; then
rm -rf vscode* VSCode*
. get_repo.sh
2022-11-04 07:48:12 -04: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 10:34:54 -05:00
if [[ "${SKIP_ASSETS}" != "no" ]]; then
rm -rf VSCode*
fi
. build.env
2022-08-29 09:13:25 -04: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 10:34:54 -05: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
if [[ "${VSCODE_QUALITY}" == "insider" && "${VSCODE_LATEST}" == "yes" ]]; then
jsonTmp=$( jq --arg 'tag' "${MS_TAG/\-insider/}" --arg 'commit' "${MS_COMMIT}" '. "insider.json" | .tag=$tag | .commit=$commit' )
echo "${jsonTmp}" > "insider.json" && unset jsonTmp
2023-01-29 10:34:54 -05:00
fi
fi
2022-10-06 16:15:41 -04:00
if [[ "${SKIP_ASSETS}" == "no" ]]; then
if [[ "${OS_NAME}" == "windows" ]]; then
rm -rf build/windows/msi/releasedir
fi
2022-10-06 16:15:41 -04:00
. prepare_assets.sh
fi