Skip to content

Commit 6d1b59e

Browse files
committed
Add fallback to get php library from trunk if not in series files
1 parent 5d1ed07 commit 6d1b59e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

extension/BuildPhpExtension/private/Add-PhpDependencies.ps1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@ Function Add-PhpDependencies {
1717
Add-StepLog "Adding libraries (core)"
1818
}
1919
$phpBaseUrl = 'https://downloads.php.net/~windows/php-sdk/deps'
20+
$phpTrunkBaseUrl = "https://downloads.php.net/~windows/php-sdk/deps/$($Config.vs_version)/$($Config.arch)"
2021
$phpSeries = Invoke-WebRequest -Uri "$phpBaseUrl/series/packages-$($Config.php_version)-$($Config.vs_version)-$($Config.arch)-staging.txt" -UseBasicParsing
22+
$phpTrunk = Invoke-WebRequest -Uri $phpTrunkBaseUrl -UseBasicParsing
2123
foreach ($library in $Config.php_libraries) {
2224
try {
23-
$matches = $phpSeries.Content | Select-String -Pattern "(^|\n)$library.*"
24-
if ($matches.Count -eq 0) {
25+
$matchesFound = $phpSeries.Content | Select-String -Pattern "(^|\n)$library.*"
26+
if ($matchesFound.Count -eq 0) {
27+
foreach ($file in $phpTrunk.Links.Href) {
28+
if ($file -match "^$library") {
29+
$matchesFound = $file | Select-String -Pattern '.*'
30+
break
31+
}
32+
}
33+
}
34+
if ($matchesFound.Count -eq 0) {
2535
throw "Failed to find $library"
2636
}
27-
$file = $matches.Matches[0].Value.Trim()
37+
$file = $matchesFound.Matches[0].Value.Trim()
2838
Invoke-WebRequest "$phpBaseUrl/$($Config.vs_version)/$($Config.arch)/$file" -OutFile $library
2939
Expand-Archive $library "../deps"
3040
Add-BuildLog tick "$library" "Added $($file -replace '\.zip$')"

0 commit comments

Comments
 (0)