2023-07-21 17:45:07 +03:00
|
|
|
#!/usr/bin/env bash
|
2021-09-09 02:38:07 +03:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
CALLER_DIR=$( pwd )
|
|
|
|
|
|
|
|
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
|
|
|
|
|
|
|
WIN_SDK_MAJOR_VERSION="10"
|
|
|
|
WIN_SDK_FULL_VERSION="10.0.17763.0"
|
|
|
|
|
2022-08-29 16:13:25 +03:00
|
|
|
if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
|
|
|
|
PRODUCT_NAME="VSCodium - Insiders"
|
2022-09-28 13:32:19 +03:00
|
|
|
PRODUCT_CODE="VSCodiumInsiders"
|
2022-08-30 14:55:17 +03:00
|
|
|
PRODUCT_UPGRADE_CODE="1C9B7195-5A9A-43B3-B4BD-583E20498467"
|
2022-08-29 16:13:25 +03:00
|
|
|
ICON_DIR="..\\..\\..\\src\\insider\\resources\\win32"
|
2022-08-30 14:55:17 +03:00
|
|
|
SETUP_RESOURCES_DIR=".\\resources\\insider"
|
2022-08-29 16:13:25 +03:00
|
|
|
else
|
|
|
|
PRODUCT_NAME="VSCodium"
|
2022-09-28 13:32:19 +03:00
|
|
|
PRODUCT_CODE="VSCodium"
|
2022-08-30 14:55:17 +03:00
|
|
|
PRODUCT_UPGRADE_CODE="965370CD-253C-4720-82FC-2E6B02A53808"
|
2022-08-29 16:13:25 +03:00
|
|
|
ICON_DIR="..\\..\\..\\src\\stable\\resources\\win32"
|
2022-08-30 14:55:17 +03:00
|
|
|
SETUP_RESOURCES_DIR=".\\resources\\stable"
|
2022-08-29 16:13:25 +03:00
|
|
|
fi
|
|
|
|
|
2021-09-09 02:38:07 +03:00
|
|
|
PRODUCT_ID=$( powershell.exe -command "[guid]::NewGuid().ToString().ToUpper()" )
|
|
|
|
PRODUCT_ID="${PRODUCT_ID%%[[:cntrl:]]}"
|
|
|
|
|
|
|
|
CULTURE="en-us"
|
|
|
|
LANGIDS="1033"
|
|
|
|
|
|
|
|
SETUP_RELEASE_DIR=".\\releasedir"
|
|
|
|
BINARY_DIR="..\\..\\..\\VSCode-win32-${VSCODE_ARCH}"
|
|
|
|
LICENSE_DIR="..\\..\\..\\vscode"
|
|
|
|
PROGRAM_FILES_86=$( env | sed -n 's/^ProgramFiles(x86)=//p' )
|
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
if [[ -z "${1}" ]]; then
|
2022-08-30 14:55:17 +03:00
|
|
|
OUTPUT_BASE_FILENAME="VSCodium-${VSCODE_ARCH}-${RELEASE_VERSION}"
|
2021-09-09 02:38:07 +03:00
|
|
|
else
|
2022-08-30 14:55:17 +03:00
|
|
|
OUTPUT_BASE_FILENAME="VSCodium-${VSCODE_ARCH}-${1}-${RELEASE_VERSION}"
|
2021-09-09 02:38:07 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${VSCODE_ARCH}" == "ia32" ]]; then
|
|
|
|
export PLATFORM="x86"
|
|
|
|
else
|
|
|
|
export PLATFORM="${VSCODE_ARCH}"
|
|
|
|
fi
|
|
|
|
|
2022-08-30 14:55:17 +03:00
|
|
|
sed -i "s|@@PRODUCT_UPGRADE_CODE@@|${PRODUCT_UPGRADE_CODE}|g" .\\includes\\vscodium-variables.wxi
|
|
|
|
sed -i "s|@@PRODUCT_NAME@@|${PRODUCT_NAME}|g" .\\vscodium.xsl
|
|
|
|
|
2023-07-23 19:35:27 +03:00
|
|
|
find i18n -name '*.wxl' -print0 | xargs -0 sed -i "s|@@PRODUCT_NAME@@|${PRODUCT_NAME}|g"
|
2022-08-29 22:56:51 +03:00
|
|
|
|
2021-09-09 02:38:07 +03:00
|
|
|
BuildSetupTranslationTransform() {
|
2022-06-05 22:30:23 +03:00
|
|
|
local CULTURE=${1}
|
|
|
|
local LANGID=${2}
|
2021-09-09 02:38:07 +03:00
|
|
|
|
|
|
|
LANGIDS="${LANGIDS},${LANGID}"
|
|
|
|
|
|
|
|
echo "Building setup translation for culture \"${CULTURE}\" with LangID \"${LANGID}\"..."
|
2022-08-16 14:51:45 +03:00
|
|
|
|
2022-08-30 14:55:17 +03:00
|
|
|
"${WIX}bin\\light.exe" vscodium.wixobj "Files-${OUTPUT_BASE_FILENAME}.wixobj" -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -spdb -cc "${TEMP}\\vscodium-cab-cache\\${PLATFORM}" -reusecab -out "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" -loc "i18n\\vscodium.${CULTURE}.wxl" -cultures:"${CULTURE}" -sice:ICE60 -sice:ICE69
|
2022-08-16 14:51:45 +03:00
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\WiLangId.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" Product "${LANGID}"
|
2022-08-16 14:51:45 +03:00
|
|
|
|
2021-09-09 02:38:07 +03:00
|
|
|
"${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\x86\\msitran" -g "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst"
|
2022-08-16 14:51:45 +03:00
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst" "${LANGID}"
|
2022-08-16 14:51:45 +03:00
|
|
|
|
2022-06-05 22:30:23 +03:00
|
|
|
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\wisubstg.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi"
|
2021-09-09 02:38:07 +03:00
|
|
|
|
|
|
|
rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi"
|
|
|
|
rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst"
|
|
|
|
}
|
|
|
|
|
2022-09-28 13:32:19 +03:00
|
|
|
"${WIX}bin\\heat.exe" dir "${BINARY_DIR}" -out "Files-${OUTPUT_BASE_FILENAME}.wxs" -t vscodium.xsl -gg -sfrag -scom -sreg -srd -ke -cg "AppFiles" -var var.ManufacturerName -var var.AppName -var var.AppCodeName -var var.ProductVersion -var var.IconDir -var var.LicenseDir -var var.BinaryDir -dr APPLICATIONFOLDER -platform "${PLATFORM}"
|
|
|
|
"${WIX}bin\\candle.exe" -arch "${PLATFORM}" vscodium.wxs "Files-${OUTPUT_BASE_FILENAME}.wxs" -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -dManufacturerName="VSCodium" -dAppCodeName="${PRODUCT_CODE}" -dAppName="${PRODUCT_NAME}" -dProductVersion="${RELEASE_VERSION%-insider}" -dProductId="${PRODUCT_ID}" -dBinaryDir="${BINARY_DIR}" -dIconDir="${ICON_DIR}" -dLicenseDir="${LICENSE_DIR}" -dSetupResourcesDir="${SETUP_RESOURCES_DIR}" -dCulture="${CULTURE}"
|
2022-08-29 22:56:51 +03:00
|
|
|
"${WIX}bin\\light.exe" vscodium.wixobj "Files-${OUTPUT_BASE_FILENAME}.wixobj" -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -spdb -cc "${TEMP}\\vscodium-cab-cache\\${PLATFORM}" -out "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" -loc "i18n\\vscodium.${CULTURE}.wxl" -cultures:"${CULTURE}" -sice:ICE60 -sice:ICE69
|
2021-09-09 02:38:07 +03:00
|
|
|
|
|
|
|
BuildSetupTranslationTransform de-de 1031
|
|
|
|
BuildSetupTranslationTransform es-es 3082
|
|
|
|
BuildSetupTranslationTransform fr-fr 1036
|
|
|
|
BuildSetupTranslationTransform it-it 1040
|
|
|
|
# WixUI_Advanced bug: https://github.com/wixtoolset/issues/issues/5909
|
|
|
|
# BuildSetupTranslationTransform ja-jp 1041
|
|
|
|
BuildSetupTranslationTransform ko-kr 1042
|
|
|
|
BuildSetupTranslationTransform ru-ru 1049
|
|
|
|
BuildSetupTranslationTransform zh-cn 2052
|
|
|
|
BuildSetupTranslationTransform zh-tw 1028
|
|
|
|
|
|
|
|
# Add all supported languages to MSI Package attribute
|
|
|
|
cscript "${PROGRAM_FILES_86}\\Windows Kits\\${WIN_SDK_MAJOR_VERSION}\\bin\\${WIN_SDK_FULL_VERSION}\\${PLATFORM}\\WiLangId.vbs" "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.msi" Package "${LANGIDS}"
|
|
|
|
|
|
|
|
# Remove files we do not need any longer.
|
|
|
|
rm -rf "${TEMP}\\vscodium-cab-cache"
|
|
|
|
rm -f "Files-${OUTPUT_BASE_FILENAME}.wxs"
|
|
|
|
rm -f "Files-${OUTPUT_BASE_FILENAME}.wixobj"
|
|
|
|
rm -f "vscodium.wixobj"
|
|
|
|
|
|
|
|
cd "${CALLER_DIR}"
|