diff --git a/crates/zed/resources/windows/gwen.iss b/crates/zed/resources/windows/gwen.iss index 9ec41aa714..d7dd0adf75 100644 --- a/crates/zed/resources/windows/gwen.iss +++ b/crates/zed/resources/windows/gwen.iss @@ -66,6 +66,7 @@ Name: "{app}"; AfterInstall: DisableAppDirInheritance [Files] Source: "{#ResourcesDir}\Gwen.exe"; DestDir: "{code:GetInstallDir}"; Flags: ignoreversion +Source: "{#ResourcesDir}\pdfium.dll"; DestDir: "{code:GetInstallDir}"; Flags: ignoreversion Source: "{#ResourcesDir}\bin\*"; DestDir: "{code:GetInstallDir}\bin"; Flags: ignoreversion Source: "{#ResourcesDir}\tools\*"; DestDir: "{app}\tools"; Flags: ignoreversion Source: "{#ResourcesDir}\appx\*"; DestDir: "{app}\appx"; BeforeInstall: RemoveAppxPackage; AfterInstall: AddAppxPackage; Flags: ignoreversion; Check: IsWindows11OrLater diff --git a/script/bundle-windows.ps1 b/script/bundle-windows.ps1 index 14b30f2e05..75bffc3e6b 100644 --- a/script/bundle-windows.ps1 +++ b/script/bundle-windows.ps1 @@ -41,7 +41,7 @@ function Get-VSArch { } Push-Location -& "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch (Get-VSArch -Arch $Architecture) -HostArch (Get-VSArch -Arch $OSArchitecture) +& "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch (Get-VSArch -Arch $Architecture) -HostArch (Get-VSArch -Arch $OSArchitecture) Pop-Location $target = "$Architecture-pc-windows-msvc" @@ -156,7 +156,7 @@ function BuildRemoteServer { function ZipZedAndItsFriendsDebug { $items = @( - ".\$CargoOutDir\zed.pdb", + ".\$CargoOutDir\gwen.pdb", ".\$CargoOutDir\cli.pdb", ".\$CargoOutDir\auto_update_helper.pdb", ".\$CargoOutDir\explorer_command_injector.pdb", @@ -239,12 +239,28 @@ function DownloadConpty { Expand-Archive -Path $zipPath -DestinationPath ".\conpty" -Force } +function DownloadPdfium { + # Runtime library for the bundled pdf_viewer (dlopen'd as pdfium.dll). + $url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium/8066/pdfium-win-x64.tgz" + $tgzPath = ".\pdfium-win-x64.tgz" + $sha256 = "739A57D597D864297909CC40A2411EBA728490C76A0FA25E3EA299C7F6B07020" + if (-not (Test-Path $tgzPath) -or (Get-FileHash $tgzPath -Algorithm SHA256).Hash -ne $sha256) { + Invoke-WebRequest -Uri $url -OutFile $tgzPath + } + if ((Get-FileHash $tgzPath -Algorithm SHA256).Hash -ne $sha256) { + throw "pdfium-win-x64.tgz checksum mismatch" + } + New-Item -Path ".\pdfium" -ItemType Directory -Force + tar -xzf $tgzPath -C ".\pdfium" "bin/pdfium.dll" +} + function CollectFiles { Move-Item -Path "$innoDir\zed_explorer_command_injector.appx" -Destination "$innoDir\appx\zed_explorer_command_injector.appx" -Force Move-Item -Path "$innoDir\zed_explorer_command_injector.dll" -Destination "$innoDir\appx\zed_explorer_command_injector.dll" -Force Move-Item -Path "$innoDir\cli.exe" -Destination "$innoDir\bin\gwen.exe" -Force Move-Item -Path "$innoDir\gwen.sh" -Destination "$innoDir\bin\gwen" -Force Move-Item -Path "$innoDir\auto_update_helper.exe" -Destination "$innoDir\tools\auto_update_helper.exe" -Force + Move-Item -Path ".\pdfium\bin\pdfium.dll" -Destination "$innoDir\pdfium.dll" -Force if($Architecture -eq "aarch64") { New-Item -Type Directory -Path "$innoDir\arm64" -Force Move-Item -Path ".\conpty\build\native\runtimes\arm64\OpenConsole.exe" -Destination "$innoDir\arm64\OpenConsole.exe" -Force @@ -383,7 +399,9 @@ $debugStoreKey = "$env:ZED_RELEASE_CHANNEL/zed-$env:RELEASE_VERSION-$env:ZED_REL CheckEnvironmentVariables PrepareForBundle -GenerateLicenses +if (-not (Test-Path "assets/licenses.md")) { + GenerateLicenses +} BuildZedAndItsFriends BuildRemoteServer MakeAppx @@ -391,6 +409,7 @@ SignZedAndItsFriends ZipZedAndItsFriendsDebug DownloadAMDGpuServices DownloadConpty +DownloadPdfium CollectFiles BuildInstaller