2023-07-20 14:25:13 -04:00
#!/usr/bin/env bash
# shellcheck disable=SC1091,2154
2020-03-11 22:47:05 -04:00
2020-09-14 12:57:19 -04:00
set -e
2022-08-16 07:51:45 -04:00
# include common functions
. ./utils.sh
2022-08-29 09:13:25 -04:00
if [ [ " ${ VSCODE_QUALITY } " = = "insider" ] ] ; then
cp -rp src/insider/* vscode/
else
cp -rp src/stable/* vscode/
fi
2021-09-08 19:38:07 -04:00
cp -f LICENSE vscode/LICENSE.txt
2022-06-08 16:03:44 -04:00
cd vscode || { echo "'vscode' dir not found" ; exit 1; }
2020-03-11 22:47:05 -04:00
2020-09-18 16:59:41 -04:00
../update_settings.sh
2020-03-11 22:47:05 -04:00
# apply patches
2021-08-22 23:05:01 -04:00
{ set +x; } 2>/dev/null
2021-07-29 06:31:54 -04:00
for file in ../patches/*.patch; do
2023-07-20 14:25:13 -04:00
if [ [ -f " ${ file } " ] ] ; then
2022-06-05 15:30:23 -04:00
echo applying patch: " ${ file } " ;
2023-11-15 14:45:18 -05:00
# grep '^+++' "${file}" | sed -e 's#+++ [ab]/#./vscode/#' | while read line; do shasum -a 256 "${line}"; done
if ! git apply --ignore-whitespace " ${ file } " ; then
2023-07-23 12:35:27 -04:00
echo failed to apply patch " ${ file } " >& 2
2023-08-04 05:02:12 -04:00
exit 1
2021-07-29 06:31:54 -04:00
fi
fi
done
2022-08-29 09:13:25 -04:00
if [ [ " ${ VSCODE_QUALITY } " = = "insider" ] ] ; then
for file in ../patches/insider/*.patch; do
2023-07-20 14:25:13 -04:00
if [ [ -f " ${ file } " ] ] ; then
2022-08-29 09:13:25 -04:00
echo applying patch: " ${ file } " ;
2023-07-20 14:25:13 -04:00
if ! git apply --ignore-whitespace " ${ file } " ; then
2023-07-23 12:35:27 -04:00
echo failed to apply patch " ${ file } " >& 2
2023-08-04 05:02:12 -04:00
exit 1
2022-08-29 09:13:25 -04:00
fi
fi
done
fi
2021-06-20 23:19:41 -04:00
for file in ../patches/user/*.patch; do
2023-07-20 14:25:13 -04:00
if [ [ -f " ${ file } " ] ] ; then
2022-06-05 15:30:23 -04:00
echo applying user patch: " ${ file } " ;
2023-07-20 14:25:13 -04:00
if ! git apply --ignore-whitespace " ${ file } " ; then
2023-07-23 12:35:27 -04:00
echo failed to apply patch " ${ file } " >& 2
2023-08-04 05:02:12 -04:00
exit 1
2021-06-20 23:19:41 -04:00
fi
fi
done
2020-03-11 22:47:05 -04:00
2021-08-22 23:05:01 -04:00
set -x
2023-06-02 10:32:07 -04:00
export ELECTRON_SKIP_BINARY_DOWNLOAD = 1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1
2023-09-07 11:35:38 -04:00
if [ [ " ${ OS_NAME } " = = "linux" ] ] ; then
export VSCODE_SKIP_NODE_VERSION_CHECK = 1
2024-02-06 18:51:19 -05:00
2024-02-06 21:50:19 -05:00
if [ [ -f "../.nvmrc.linux" ] ] ; then
mv ../.nvmrc.linux ../.nvmrc
fi
2024-02-06 18:51:19 -05:00
for file in ../patches/linux/*.patch; do
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
2023-09-07 11:35:38 -04:00
fi
2022-05-14 12:44:59 -04:00
if [ [ " ${ OS_NAME } " = = "osx" ] ] ; then
2023-10-10 07:49:41 -04:00
CHILD_CONCURRENCY = 1 yarn --frozen-lockfile --network-timeout 180000
2023-06-02 10:32:07 -04:00
2022-06-09 16:19:30 -04:00
yarn postinstall
2020-09-16 14:45:51 -04:00
else
2023-10-05 10:44:52 -04:00
if [ [ " ${ OS_NAME } " = = "windows" ] ] ; then
2023-06-02 10:32:07 -04:00
# TODO: Should be replaced with upstream URL once https://github.com/nodejs/node-gyp/pull/2825
# gets merged.
rm -rf .build/node-gyp
mkdir -p .build/node-gyp
cd .build/node-gyp
2023-10-05 11:25:23 -04:00
git config --global user.email " $( echo " ${ GITHUB_USERNAME } " | awk '{print tolower($0)}' ) -ci@not-real.com "
git config --global user.name " ${ GITHUB_USERNAME } CI "
2023-10-05 10:44:52 -04:00
git clone https://github.com/nodejs/node-gyp.git .
git checkout v9.4.0
git am --3way --whitespace= fix ../../build/npm/gyp/patches/gyp_spectre_mitigation_support.patch
2023-06-02 10:32:07 -04:00
npm install
2023-10-10 07:49:41 -04:00
npm_config_node_gyp = " $( pwd ) /bin/node-gyp.js "
2023-07-20 14:25:13 -04:00
export npm_config_node_gyp
2023-06-02 10:32:07 -04:00
cd ../..
fi
2023-10-05 10:44:52 -04:00
if [ [ " ${ npm_config_arch } " = = "arm" ] ] ; then
export npm_config_arm_version = 7
fi
2023-10-10 07:49:41 -04:00
CHILD_CONCURRENCY = 1 yarn --frozen-lockfile --check-files --network-timeout 180000
2020-09-16 14:45:51 -04:00
fi
2020-06-19 18:39:56 -04:00
2022-08-29 09:13:25 -04:00
setpath( ) {
2023-07-20 14:25:13 -04:00
local jsonTmp
2022-08-29 10:06:56 -04:00
{ set +x; } 2>/dev/null
2023-07-20 14:25:13 -04:00
jsonTmp = $( jq --arg 'path' " ${ 2 } " --arg 'value' " ${ 3 } " 'setpath([$path]; $value)' " ${ 1 } .json " )
echo " ${ jsonTmp } " > " ${ 1 } .json "
2022-08-29 10:06:56 -04:00
set -x
2022-08-29 09:13:25 -04:00
}
setpath_json( ) {
2023-07-20 14:25:13 -04:00
local jsonTmp
2022-08-29 10:06:56 -04:00
{ set +x; } 2>/dev/null
2023-07-20 14:25:13 -04:00
jsonTmp = $( jq --arg 'path' " ${ 2 } " --argjson 'value' " ${ 3 } " 'setpath([$path]; $value)' " ${ 1 } .json " )
echo " ${ jsonTmp } " > " ${ 1 } .json "
2022-08-29 10:06:56 -04:00
set -x
2022-08-29 09:13:25 -04:00
}
2020-03-11 22:47:05 -04:00
2022-09-11 07:08:41 -04:00
# product.json
2023-07-23 12:35:27 -04:00
cp product.json{ ,.bak}
2022-09-11 07:08:41 -04:00
2022-08-29 09:13:25 -04:00
setpath "product" "checksumFailMoreInfoUrl" "https://go.microsoft.com/fwlink/?LinkId=828886"
setpath "product" "documentationUrl" "https://go.microsoft.com/fwlink/?LinkID=533484#vscode"
setpath_json "product" "extensionsGallery" '{"serviceUrl": "https://open-vsx.org/vscode/gallery", "itemUrl": "https://open-vsx.org/vscode/item"}'
setpath "product" "introductoryVideosUrl" "https://go.microsoft.com/fwlink/?linkid=832146"
setpath "product" "keyboardShortcutsUrlLinux" "https://go.microsoft.com/fwlink/?linkid=832144"
setpath "product" "keyboardShortcutsUrlMac" "https://go.microsoft.com/fwlink/?linkid=832143"
setpath "product" "keyboardShortcutsUrlWin" "https://go.microsoft.com/fwlink/?linkid=832145"
setpath "product" "licenseUrl" "https://github.com/VSCodium/vscodium/blob/master/LICENSE"
2022-10-17 05:11:34 -04:00
setpath_json "product" "linkProtectionTrustedDomains" '["https://open-vsx.org"]'
2022-08-29 09:13:25 -04:00
setpath "product" "releaseNotesUrl" "https://go.microsoft.com/fwlink/?LinkID=533483#vscode"
setpath "product" "reportIssueUrl" "https://github.com/VSCodium/vscodium/issues/new"
setpath "product" "requestFeatureUrl" "https://go.microsoft.com/fwlink/?LinkID=533482"
setpath "product" "tipsAndTricksUrl" "https://go.microsoft.com/fwlink/?linkid=852118"
setpath "product" "twitterUrl" "https://go.microsoft.com/fwlink/?LinkID=533687"
2022-09-26 03:30:43 -04:00
if [ [ " ${ DISABLE_UPDATE } " != "yes" ] ] ; then
setpath "product" "updateUrl" "https://vscodium.now.sh"
2023-03-26 03:41:43 -04:00
setpath "product" "downloadUrl" "https://github.com/VSCodium/vscodium/releases"
2022-09-26 05:13:10 -04:00
fi
2022-08-29 09:13:25 -04:00
if [ [ " ${ VSCODE_QUALITY } " = = "insider" ] ] ; then
setpath "product" "nameShort" "VSCodium - Insiders"
setpath "product" "nameLong" "VSCodium - Insiders"
setpath "product" "applicationName" "codium-insiders"
setpath "product" "dataFolderName" ".vscodium-insiders"
setpath "product" "linuxIconName" "vscodium-insiders"
setpath "product" "quality" "insider"
setpath "product" "urlProtocol" "vscodium-insiders"
setpath "product" "serverApplicationName" "codium-server-insiders"
setpath "product" "serverDataFolderName" ".vscodium-server-insiders"
setpath "product" "darwinBundleIdentifier" "com.vscodium.VSCodiumInsiders"
setpath "product" "win32AppUserModelId" "VSCodium.VSCodiumInsiders"
setpath "product" "win32DirName" "VSCodium Insiders"
setpath "product" "win32MutexName" "vscodiuminsiders"
setpath "product" "win32NameVersion" "VSCodium Insiders"
setpath "product" "win32RegValueName" "VSCodiumInsiders"
setpath "product" "win32ShellNameShort" "VSCodium Insiders"
setpath "product" "win32AppId" "{{EF35BB36-FA7E-4BB9-B7DA-D1E09F2DA9C9}"
setpath "product" "win32x64AppId" "{{B2E0DDB2-120E-4D34-9F7E-8C688FF839A2}"
setpath "product" "win32arm64AppId" "{{44721278-64C6-4513-BC45-D48E07830599}"
setpath "product" "win32UserAppId" "{{ED2E5618-3E7E-4888-BF3C-A6CCC84F586F}"
setpath "product" "win32x64UserAppId" "{{20F79D0D-A9AC-4220-9A81-CE675FFB6B41}"
setpath "product" "win32arm64UserAppId" "{{2E362F92-14EA-455A-9ABD-3E656BBBFE71}"
else
setpath "product" "nameShort" "VSCodium"
setpath "product" "nameLong" "VSCodium"
setpath "product" "applicationName" "codium"
setpath "product" "linuxIconName" "vscodium"
setpath "product" "quality" "stable"
setpath "product" "urlProtocol" "vscodium"
setpath "product" "serverApplicationName" "codium-server"
setpath "product" "serverDataFolderName" ".vscodium-server"
setpath "product" "darwinBundleIdentifier" "com.vscodium"
setpath "product" "win32AppUserModelId" "VSCodium.VSCodium"
setpath "product" "win32DirName" "VSCodium"
setpath "product" "win32MutexName" "vscodium"
setpath "product" "win32NameVersion" "VSCodium"
setpath "product" "win32RegValueName" "VSCodium"
setpath "product" "win32ShellNameShort" "VSCodium"
setpath "product" "win32AppId" "{{763CBF88-25C6-4B10-952F-326AE657F16B}"
setpath "product" "win32x64AppId" "{{88DA3577-054F-4CA1-8122-7D820494CFFB}"
setpath "product" "win32arm64AppId" "{{67DEE444-3D04-4258-B92A-BC1F0FF2CAE4}"
setpath "product" "win32UserAppId" "{{0FD05EB4-651E-4E78-A062-515204B47A3A}"
setpath "product" "win32x64UserAppId" "{{2E1F05D1-C245-4562-81EE-28188DB6FD17}"
setpath "product" "win32arm64UserAppId" "{{57FD70A5-1B8D-4875-9F40-C5553F094828}"
fi
2023-07-20 14:25:13 -04:00
jsonTmp = $( jq -s '.[0] * .[1]' product.json ../product.json )
2023-07-26 20:11:09 -04:00
echo " ${ jsonTmp } " > product.json && unset jsonTmp
2022-04-07 17:15:32 -04:00
2020-03-11 22:47:05 -04:00
cat product.json
2022-09-11 07:08:41 -04:00
# package.json
2023-07-23 12:35:27 -04:00
cp package.json{ ,.bak}
2022-09-11 07:08:41 -04:00
2023-07-20 14:25:13 -04:00
setpath "package" "version" " $( echo " ${ RELEASE_VERSION } " | sed -n -E " s/^(.*)\.([0-9]+)(-insider)? $/\1/p " ) "
setpath "package" "release" " $( echo " ${ RELEASE_VERSION } " | sed -n -E " s/^(.*)\.([0-9]+)(-insider)? $/\2/p " ) "
2022-08-16 07:51:45 -04:00
2022-09-11 07:08:41 -04:00
replace 's|Microsoft Corporation|VSCodium|' package.json
2022-10-04 13:01:54 -04:00
# announcements
2023-07-20 14:25:13 -04:00
replace " s|\\[\\/\\* BUILTIN_ANNOUNCEMENTS \\*\\/\\]| $( tr -d '\n' < ../announcements-builtin.json ) | " src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
2022-10-04 13:01:54 -04:00
2020-09-18 16:59:41 -04:00
../undo_telemetry.sh
2020-03-11 22:47:05 -04:00
2022-09-11 07:08:41 -04:00
replace 's|Microsoft Corporation|VSCodium|' build/lib/electron.js
replace 's|Microsoft Corporation|VSCodium|' build/lib/electron.ts
replace 's|([0-9]) Microsoft|\1 VSCodium|' build/lib/electron.js
replace 's|([0-9]) Microsoft|\1 VSCodium|' build/lib/electron.ts
2022-06-05 15:30:23 -04:00
if [ [ " ${ OS_NAME } " = = "linux" ] ] ; then
2020-03-11 22:47:05 -04:00
# microsoft adds their apt repo to sources
# unless the app name is code-oss
# as we are renaming the application to vscodium
# we need to edit a line in the post install template
2022-08-29 09:13:25 -04:00
if [ [ " ${ VSCODE_QUALITY } " = = "insider" ] ] ; then
sed -i "s/code-oss/codium-insiders/" resources/linux/debian/postinst.template
else
sed -i "s/code-oss/codium/" resources/linux/debian/postinst.template
fi
2021-06-20 23:19:41 -04:00
2020-12-21 09:26:30 -05:00
# fix the packages metadata
# code.appdata.xml
2021-01-12 16:56:52 -05:00
sed -i 's|Visual Studio Code|VSCodium|g' resources/linux/code.appdata.xml
sed -i 's|https://code.visualstudio.com/docs/setup/linux|https://github.com/VSCodium/vscodium#download-install|' resources/linux/code.appdata.xml
2020-12-21 09:26:30 -05:00
sed -i 's|https://code.visualstudio.com/home/home-screenshot-linux-lg.png|https://vscodium.com/img/vscodium.png|' resources/linux/code.appdata.xml
sed -i 's|https://code.visualstudio.com|https://vscodium.com|' resources/linux/code.appdata.xml
2021-06-20 23:19:41 -04:00
2020-12-21 09:26:30 -05:00
# control.template
sed -i 's|Microsoft Corporation <vscode-linux@microsoft.com>|VSCodium Team https://github.com/VSCodium/vscodium/graphs/contributors|' resources/linux/debian/control.template
sed -i 's|https://code.visualstudio.com|https://vscodium.com|' resources/linux/debian/control.template
sed -i 's|Visual Studio Code|VSCodium|g' resources/linux/debian/control.template
sed -i 's|https://code.visualstudio.com/docs/setup/linux|https://github.com/VSCodium/vscodium#download-install|' resources/linux/debian/control.template
2021-06-20 23:19:41 -04:00
2020-12-21 09:26:30 -05:00
# code.spec.template
sed -i 's|https://code.visualstudio.com/docs/setup/linux|https://github.com/VSCodium/vscodium#download-install|' resources/linux/rpm/code.spec.template
sed -i 's|Microsoft Corporation|VSCodium Team|' resources/linux/rpm/code.spec.template
sed -i 's|Visual Studio Code Team <vscode-linux@microsoft.com>|VSCodium Team https://github.com/VSCodium/vscodium/graphs/contributors|' resources/linux/rpm/code.spec.template
sed -i 's|https://code.visualstudio.com|https://vscodium.com|' resources/linux/rpm/code.spec.template
sed -i 's|Visual Studio Code|VSCodium|' resources/linux/rpm/code.spec.template
2021-06-20 23:19:41 -04:00
2020-12-21 09:26:30 -05:00
# snapcraft.yaml
sed -i 's|Visual Studio Code|VSCodium|' resources/linux/rpm/code.spec.template
2022-09-11 07:08:41 -04:00
elif [ [ " ${ OS_NAME } " = = "windows" ] ] ; then
# code.iss
sed -i 's|https://code.visualstudio.com|https://vscodium.com|' build/win32/code.iss
sed -i 's|Microsoft Corporation|VSCodium|' build/win32/code.iss
2020-03-11 22:47:05 -04:00
fi
2020-09-18 15:40:54 -04:00
cd ..