build.sh 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. set -ex
  3. CALLER_DIR=$( pwd )
  4. cd "$( dirname "${BASH_SOURCE[0]}" )"
  5. WIN_SDK_MAJOR_VERSION="10"
  6. WIN_SDK_FULL_VERSION="10.0.17763.0"
  7. PRODUCT_NAME="VSCodium"
  8. PRODUCT_SKU="vscodium"
  9. PRODUCT_ID=$( powershell.exe -command "[guid]::NewGuid().ToString().ToUpper()" )
  10. PRODUCT_ID="${PRODUCT_ID%%[[:cntrl:]]}"
  11. CULTURE="en-us"
  12. LANGIDS="1033"
  13. SETUP_RELEASE_DIR=".\\releasedir"
  14. SETUP_RESOURCES_DIR=".\\resources"
  15. BINARY_DIR="..\\..\\..\\VSCode-win32-${VSCODE_ARCH}"
  16. ICON_DIR="..\\..\\..\\src\\resources\\win32"
  17. LICENSE_DIR="..\\..\\..\\vscode"
  18. PROGRAM_FILES_86=$( env | sed -n 's/^ProgramFiles(x86)=//p' )
  19. if [[ -z "${1}" ]]; then
  20. OUTPUT_BASE_FILENAME="${PRODUCT_NAME}-${VSCODE_ARCH}-${MS_TAG}"
  21. else
  22. OUTPUT_BASE_FILENAME="${PRODUCT_NAME}-${VSCODE_ARCH}-${1}-${MS_TAG}"
  23. fi
  24. if [[ "${VSCODE_ARCH}" == "ia32" ]]; then
  25. export PLATFORM="x86"
  26. else
  27. export PLATFORM="${VSCODE_ARCH}"
  28. fi
  29. BuildSetupTranslationTransform() {
  30. local CULTURE=${1}
  31. local LANGID=${2}
  32. LANGIDS="${LANGIDS},${LANGID}"
  33. echo "Building setup translation for culture \"${CULTURE}\" with LangID \"${LANGID}\"..."
  34. "${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\\${PRODUCT_SKU}.${CULTURE}.wxl" -cultures:"${CULTURE}" -sice:ICE60 -sice:ICE69
  35. 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}"
  36. "${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"
  37. 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}"
  38. 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"
  39. rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.msi"
  40. rm -f "${SETUP_RELEASE_DIR}\\${OUTPUT_BASE_FILENAME}.${CULTURE}.mst"
  41. }
  42. "${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.AppName -var var.ProductVersion -var var.IconDir -var var.LicenseDir -var var.BinaryDir -dr APPLICATIONFOLDER -platform "${PLATFORM}"
  43. "${WIX}bin\\candle.exe" -arch "${PLATFORM}" vscodium.wxs "Files-${OUTPUT_BASE_FILENAME}.wxs" -ext WixUIExtension -ext WixUtilExtension -ext WixNetFxExtension -dAppName=${PRODUCT_NAME} -dProductVersion="${MS_TAG}" -dProductId="${PRODUCT_ID}" -dBinaryDir="${BINARY_DIR}" -dIconDir="${ICON_DIR}" -dLicenseDir="${LICENSE_DIR}" -dSetupResourcesDir="${SETUP_RESOURCES_DIR}" -dCulture="${CULTURE}"
  44. "${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\\${PRODUCT_SKU}.${CULTURE}.wxl" -cultures:"${CULTURE}" -sice:ICE60 -sice:ICE69
  45. BuildSetupTranslationTransform de-de 1031
  46. BuildSetupTranslationTransform es-es 3082
  47. BuildSetupTranslationTransform fr-fr 1036
  48. BuildSetupTranslationTransform it-it 1040
  49. # WixUI_Advanced bug: https://github.com/wixtoolset/issues/issues/5909
  50. # BuildSetupTranslationTransform ja-jp 1041
  51. BuildSetupTranslationTransform ko-kr 1042
  52. BuildSetupTranslationTransform ru-ru 1049
  53. BuildSetupTranslationTransform zh-cn 2052
  54. BuildSetupTranslationTransform zh-tw 1028
  55. # Add all supported languages to MSI Package attribute
  56. 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}"
  57. # Remove files we do not need any longer.
  58. rm -rf "${TEMP}\\vscodium-cab-cache"
  59. rm -f "Files-${OUTPUT_BASE_FILENAME}.wxs"
  60. rm -f "Files-${OUTPUT_BASE_FILENAME}.wixobj"
  61. rm -f "vscodium.wixobj"
  62. cd "${CALLER_DIR}"