2023-07-21 10:45:07 -04:00
|
|
|
#!/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"
|
|
|
|
|
2023-07-21 10:45:07 -04:00
|
|
|
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"
|
|
|
|
;;
|
2022-10-02 04:39:39 -04:00
|
|
|
o)
|
|
|
|
export SKIP_BUILD="yes"
|
|
|
|
;;
|
2022-08-29 11:53:29 -04:00
|
|
|
p)
|
2022-10-06 16:15:41 -04:00
|
|
|
export SKIP_ASSETS="no"
|
2022-08-29 11:53:29 -04:00
|
|
|
;;
|
2023-01-29 10:34:54 -05:00
|
|
|
s)
|
|
|
|
export SKIP_SOURCE="yes"
|
|
|
|
;;
|
2023-07-21 10:45:07 -04:00
|
|
|
*)
|
|
|
|
;;
|
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
|
|
|
|
|
2022-08-30 07:55:17 -04:00
|
|
|
echo "OS_NAME=\"${OS_NAME}\""
|
2023-01-29 10:34:54 -05:00
|
|
|
echo "SKIP_SOURCE=\"${SKIP_SOURCE}\""
|
2022-10-02 04:39:39 -04:00
|
|
|
echo "SKIP_BUILD=\"${SKIP_BUILD}\""
|
2022-10-06 16:15:41 -04:00
|
|
|
echo "SKIP_ASSETS=\"${SKIP_ASSETS}\""
|
2022-08-30 07:55:17 -04:00
|
|
|
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
|
2022-10-02 04:39:39 -04:00
|
|
|
rm -rf vscode* VSCode*
|
|
|
|
|
|
|
|
. get_repo.sh
|
2022-11-04 07:48:12 -04:00
|
|
|
. version.sh
|
2022-10-02 04:39:39 -04:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2022-10-02 04:39:39 -04:00
|
|
|
. build.env
|
2022-08-29 09:13:25 -04:00
|
|
|
|
2022-10-02 04:39:39 -04:00
|
|
|
echo "MS_TAG=\"${MS_TAG}\""
|
|
|
|
echo "MS_COMMIT=\"${MS_COMMIT}\""
|
|
|
|
echo "RELEASE_VERSION=\"${RELEASE_VERSION}\""
|
|
|
|
echo "BUILD_SOURCEVERSION=\"${BUILD_SOURCEVERSION}\""
|
2022-09-04 14:50:52 -04:00
|
|
|
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
|
2023-07-21 10:45:07 -04:00
|
|
|
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
|
2022-08-29 11:53:29 -04:00
|
|
|
if [[ "${OS_NAME}" == "windows" ]]; then
|
|
|
|
rm -rf build/windows/msi/releasedir
|
|
|
|
fi
|
|
|
|
|
2022-10-06 16:15:41 -04:00
|
|
|
. prepare_assets.sh
|
2022-08-29 11:53:29 -04:00
|
|
|
fi
|