Skip to content

Commit b951cf1

Browse files
committed
Add fallback using expanded assets in Add-DebugSymbols on Windows
1 parent 1fdc5e7 commit b951cf1

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/scripts/win32.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,22 @@ Function Set-PhpCache {
281281

282282
# Function to add debug symbols to PHP.
283283
Function Add-DebugSymbols {
284-
$release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version
285284
$dev = if ($version -match $nightly_versions) { '-dev' } else { '' }
286-
$asset = $release.assets | ForEach-Object {
287-
if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
288-
return $_.name
289-
}
290-
} | Select-Object -Last 1
285+
try {
286+
$release = Invoke-RestMethod https://api.github.com/repos/shivammathur/php-builder-windows/releases/tags/php$version
287+
$asset = $release.assets | ForEach-Object {
288+
if($_.name -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
289+
return $_.name
290+
}
291+
} | Select-Object -Last 1
292+
} catch {
293+
$release = Get-File -Url $php_builder/releases/expanded_assets/php$version
294+
$asset = $release.links.href | ForEach-Object {
295+
if($_ -match "php-debug-pack-$version.[0-9]+$dev$env:PHPTS-Win32-.*-$arch.zip") {
296+
return $_.split('/')[-1]
297+
}
298+
} | Select-Object -Last 1
299+
}
291300
Get-File -Url $php_builder/releases/download/php$version/$asset -OutFile $php_dir\$asset
292301
Expand-Archive -Path $php_dir\$asset -DestinationPath $php_dir -Force
293302
Get-ChildItem -Path $php_dir -Filter php_*.pdb | Move-Item -Destination $ext_dir

0 commit comments

Comments
 (0)