123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- #!/usr/bin/env bash
- # shellcheck disable=SC1091,2154
- set -e
- # include common functions
- . ./utils.sh
- if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
- cp -rp src/insider/* vscode/
- else
- cp -rp src/stable/* vscode/
- fi
- cp -f LICENSE vscode/LICENSE.txt
- cd vscode || { echo "'vscode' dir not found"; exit 1; }
- ../update_settings.sh
- # apply patches
- { set +x; } 2>/dev/null
- echo "APP_NAME=\"${APP_NAME}\""
- echo "APP_NAME_LC=\"${APP_NAME_LC}\""
- echo "BINARY_NAME=\"${BINARY_NAME}\""
- echo "GH_REPO_PATH=\"${GH_REPO_PATH}\""
- echo "ORG_NAME=\"${ORG_NAME}\""
- for file in ../patches/*.patch; do
- if [[ -f "${file}" ]]; then
- apply_patch "${file}"
- fi
- done
- if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
- for file in ../patches/insider/*.patch; do
- if [[ -f "${file}" ]]; then
- apply_patch "${file}"
- fi
- done
- fi
- if [[ -d "../patches/${OS_NAME}/" ]]; then
- for file in "../patches/${OS_NAME}/"*.patch; do
- if [[ -f "${file}" ]]; then
- apply_patch "${file}"
- fi
- done
- fi
- for file in ../patches/user/*.patch; do
- if [[ -f "${file}" ]]; then
- apply_patch "${file}"
- fi
- done
- set -x
- export ELECTRON_SKIP_BINARY_DOWNLOAD=1
- export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
- if [[ "${OS_NAME}" == "linux" ]]; then
- export VSCODE_SKIP_NODE_VERSION_CHECK=1
- if [[ "${npm_config_arch}" == "arm" ]]; then
- export npm_config_arm_version=7
- fi
- elif [[ "${OS_NAME}" == "windows" ]]; then
- if [[ "${npm_config_arch}" == "arm" ]]; then
- export npm_config_arm_version=7
- fi
- else
- if [[ "${CI_BUILD}" != "no" ]]; then
- clang++ --version
- fi
- fi
- mv .npmrc .npmrc.bak
- cp ../npmrc .npmrc
- for i in {1..5}; do # try 5 times
- if [[ "${CI_BUILD}" != "no" && "${OS_NAME}" == "osx" ]]; then
- CXX=clang++ npm ci && break
- else
- npm ci && break
- fi
- if [[ $i == 3 ]]; then
- echo "Npm install failed too many times" >&2
- exit 1
- fi
- echo "Npm install failed $i, trying again..."
- sleep $(( 15 * (i + 1)))
- done
- mv .npmrc.bak .npmrc
- setpath() {
- local jsonTmp
- { set +x; } 2>/dev/null
- jsonTmp=$( jq --arg 'path' "${2}" --arg 'value' "${3}" 'setpath([$path]; $value)' "${1}.json" )
- echo "${jsonTmp}" > "${1}.json"
- set -x
- }
- setpath_json() {
- local jsonTmp
- { set +x; } 2>/dev/null
- jsonTmp=$( jq --arg 'path' "${2}" --argjson 'value' "${3}" 'setpath([$path]; $value)' "${1}.json" )
- echo "${jsonTmp}" > "${1}.json"
- set -x
- }
- # product.json
- cp product.json{,.bak}
- 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", "extensionUrlTemplate": "https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest", "controlUrl": "https://raw.githubusercontent.com/EclipseFdn/publish-extensions/refs/heads/master/extension-control/extensions.json"}'
- 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"
- setpath_json "product" "linkProtectionTrustedDomains" '["https://open-vsx.org"]'
- 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"
- if [[ "${DISABLE_UPDATE}" != "yes" ]]; then
- setpath "product" "updateUrl" "https://raw.githubusercontent.com/VSCodium/versions/refs/heads/master"
- if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
- setpath "product" "downloadUrl" "https://github.com/VSCodium/vscodium-insiders/releases"
- else
- setpath "product" "downloadUrl" "https://github.com/VSCodium/vscodium/releases"
- fi
- fi
- 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}"
- setpath "product" "tunnelApplicationName" "codium-tunnel-insiders"
- setpath "product" "win32TunnelServiceMutex" "vscodiuminsiders-tunnelservice"
- setpath "product" "win32TunnelMutex" "vscodiuminsiders-tunnel"
- 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}"
- setpath "product" "tunnelApplicationName" "codium-tunnel"
- setpath "product" "win32TunnelServiceMutex" "vscodium-tunnelservice"
- setpath "product" "win32TunnelMutex" "vscodium-tunnel"
- fi
- jsonTmp=$( jq -s '.[0] * .[1]' product.json ../product.json )
- echo "${jsonTmp}" > product.json && unset jsonTmp
- cat product.json
- # package.json
- cp package.json{,.bak}
- setpath "package" "version" "${RELEASE_VERSION%-insider}"
- replace 's|Microsoft Corporation|VSCodium|' package.json
- cp resources/server/manifest.json{,.bak}
- if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
- setpath "resources/server/manifest" "name" "VSCodium - Insiders"
- setpath "resources/server/manifest" "short_name" "VSCodium - Insiders"
- else
- setpath "resources/server/manifest" "name" "VSCodium"
- setpath "resources/server/manifest" "short_name" "VSCodium"
- fi
- # announcements
- replace "s|\\[\\/\\* BUILTIN_ANNOUNCEMENTS \\*\\/\\]|$( tr -d '\n' < ../announcements-builtin.json )|" src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
- ../undo_telemetry.sh
- 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
- if [[ "${OS_NAME}" == "linux" ]]; then
- # 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
- 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
- # fix the packages metadata
- # code.appdata.xml
- 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
- 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
- # 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|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
- sed -i 's|https://code.visualstudio.com|https://vscodium.com|' resources/linux/debian/control.template
- # 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|Visual Studio Code|VSCodium|' resources/linux/rpm/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|https://code.visualstudio.com|https://vscodium.com|' resources/linux/rpm/code.spec.template
- # snapcraft.yaml
- sed -i 's|Visual Studio Code|VSCodium|' resources/linux/rpm/code.spec.template
- 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
- fi
- cd ..
|