From b951cf1d990d76e7b1d560ddd6d693649e4f9ec6 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 17 Apr 2023 08:37:41 +0530 Subject: [PATCH] Add fallback using expanded assets in Add-DebugSymbols on Windows --- src/scripts/win32.ps1 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index b780d83b..e9bae624 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -281,13 +281,22 @@ Function Set-PhpCache { # Function to add debug symbols to PHP. Function Add-DebugSymbols { - $release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version $dev = if ($version -match $nightly_versions) { '-dev' } else { '' } - $asset = $release.assets | ForEach-Object { - if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") { - return $_.name - } - } | Select-Object -Last 1 + try { + $release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version + $asset = $release.assets | ForEach-Object { + if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") { + return $_.name + } + } | Select-Object -Last 1 + } catch { + $release = Get-File -Url $php_builder/releases/expanded_assets/php$version + $asset = $release.links.href | ForEach-Object { + if($_ -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") { + return $_.split('/')[-1] + } + } | Select-Object -Last 1 + } Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir