Skip to content

Commit d9403b0

Browse files
committed
Add support to build with master branch of PHP
1 parent 6d2fbc2 commit d9403b0

File tree

14 files changed

+57
-35
lines changed

14 files changed

+57
-35
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
arch: [x64, x86]
1515
ts: [nts, ts]
16-
runs-on: ${{ startsWith(inputs.php-version, '8.4') && 'windows-2022' || 'windows-2019' }}
16+
runs-on: ${{ (inputs.php-version > '8.4' || inputs.php-version=='master') && 'windows-2022' || 'windows-2019' }}
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4

extension-matrix/config/vs.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,11 @@
4848
"vs": "2022",
4949
"os": "windows-2022",
5050
"type": "github-hosted"
51+
},
52+
"master": {
53+
"vs": "2022",
54+
"os": "windows-2022",
55+
"dev": true,
56+
"type": "github-hosted"
5157
}
5258
}

extension/BuildPhpExtension/config/vs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"8.1": "vs16",
99
"8.2": "vs16",
1010
"8.3": "vs16",
11-
"8.4": "vs17"
11+
"8.4": "vs17",
12+
"master": "vs17"
1213
},
1314
"vs" : {
1415
"vc14": {

extension/BuildPhpExtension/private/Get-PhpBuild.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ function Get-PhpBuild {
2020
try {
2121
Add-StepLog "Adding release build for PHP $( $Config.php_version )"
2222
Add-Type -Assembly "System.IO.Compression.Filesystem"
23-
$phpSemver, $baseUrl = $BuildDetails.phpSemver, $BuildDetails.baseUrl
23+
$phpSemver, $baseUrl, $fallbackBaseUrl = $BuildDetails.phpSemver, $BuildDetails.baseUrl, $BuildDetails.fallbackBaseUrl
2424
$tsPart = if ($Config.ts -eq "nts") { "nts-Win32" } else { "Win32" }
2525
$binZipFile = "php-$phpSemver-$tsPart-$( $Config.vs_version )-$( $Config.arch ).zip"
2626
$binUrl = "$baseUrl/$binZipFile"
27-
28-
$fallBackUrl = "$baseUrl/archives/$binZipFile"
27+
$fallBackUrl = "$fallbackBaseUrl/$binZipFile"
2928

3029
if ($Config.php_version -lt '7.4') {
3130
$fallBackUrl = $fallBackUrl.replace("vc", "VC")

extension/BuildPhpExtension/private/Get-PhpBuildDetails.ps1

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,31 @@ function Get-PhpBuildDetails {
1313
begin {
1414
}
1515
process {
16-
foreach($releaseState in @("releases", "qa")) {
17-
$baseUrl = "https://downloads.php.net/~windows/$releaseState"
18-
$fallbackBaseUrl = "https://downloads.php.net/~windows/$releaseState/archives"
19-
$releases = Invoke-WebRequest "$baseUrl/releases.json" | ConvertFrom-Json
20-
$phpSemver = $releases.$($Config.php_version).version
21-
if($null -eq $phpSemver) {
22-
$phpSemver = (Invoke-WebRequest $fallbackBaseUrl).Links |
23-
Where-Object { $_.href -match "php-($($Config.php_version).[0-9]+).*" } |
24-
ForEach-Object { $matches[1] } |
25-
Sort-Object { [System.Version]$_ } -Descending |
26-
Select-Object -First 1
27-
}
28-
if($null -ne $phpSemver) {
29-
break
16+
if($Config.php_version -eq 'master') {
17+
$baseUrl = $fallbackBaseUrl = "https://github.com/shivammathur/php-builder-windows/releases/download/master"
18+
$PhpSemver = $PhpVersion
19+
} else {
20+
foreach($releaseState in @("releases", "qa")) {
21+
$baseUrl = "https://downloads.php.net/~windows/$releaseState"
22+
$fallbackBaseUrl = "https://downloads.php.net/~windows/$releaseState/archives"
23+
$releases = Invoke-WebRequest "$baseUrl/releases.json" | ConvertFrom-Json
24+
$phpSemver = $releases.$($Config.php_version).version
25+
if($null -eq $phpSemver) {
26+
$phpSemver = (Invoke-WebRequest $fallbackBaseUrl).Links |
27+
Where-Object { $_.href -match "php-($($Config.php_version).[0-9]+).*" } |
28+
ForEach-Object { $matches[1] } |
29+
Sort-Object { [System.Version]$_ } -Descending |
30+
Select-Object -First 1
31+
}
32+
if($null -ne $phpSemver) {
33+
break
34+
}
3035
}
3136
}
3237
return [PSCustomObject]@{
3338
phpSemver = $phpSemver
3439
baseUrl = $baseUrl
40+
fallbackBaseUrl = $fallbackBaseUrl
3541
}
3642
}
3743
end {

extension/BuildPhpExtension/private/Get-PhpDevelBuild.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function Get-PhpDevelBuild {
2020
try {
2121
Add-StepLog "Adding developer build for PHP $($Config.php_version)"
2222
Add-Type -Assembly "System.IO.Compression.Filesystem"
23-
$phpSemver, $baseUrl = $BuildDetails.phpSemver, $BuildDetails.baseUrl
23+
$phpSemver, $baseUrl, $fallbackBaseUrl = $BuildDetails.phpSemver, $BuildDetails.baseUrl, $BuildDetails.fallbackBaseUrl
2424
$tsPart = if ($Config.ts -eq "nts") {"nts-Win32"} else {"Win32"}
2525
$binZipFile = "php-devel-pack-$phpSemver-$tsPart-$($Config.vs_version)-$($Config.arch).zip"
2626
$binUrl = "$baseUrl/$binZipFile"
27-
$fallBackUrl = "$baseUrl/archives/$binZipFile"
27+
$fallBackUrl = "$fallbackBaseUrl/$binZipFile"
2828

2929
if($Config.php_version -lt '7.4') {
3030
$fallBackUrl = $fallBackUrl.replace("vc", "VC")

extension/BuildPhpExtension/private/Get-PhpSdk.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Get-PhpSdk {
77
param (
88
)
99
begin {
10-
$sdkVersion = "2.3.0"
10+
$sdkVersion = "2.4.0"
1111
$url = "https://github.com/php/php-sdk-binary-tools/archive/php-sdk-$sdkVersion.zip"
1212
}
1313
process {

extension/BuildPhpExtension/private/Get-VsVersion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function Get-VsVersion {
1818
process {
1919
$jsonContent = Get-Content -Path $jsonPath -Raw
2020
$VsConfig = ConvertFrom-Json -InputObject $jsonContent
21-
$majorMinor = $PhpVersion.Substring(0, 3)
21+
if($PhpVersion -eq 'master') { $majorMinor = 'master'; } else { $majorMinor = $PhpVersion.Substring(0, 3); }
2222
$VsVersion = $($VsConfig.php.$majorMinor)
2323
$selectedToolset = $null
2424
try {

php/BuildPhp/config/vs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"8.1": "vs16",
99
"8.2": "vs16",
1010
"8.3": "vs16",
11-
"8.4": "vs17"
11+
"8.4": "vs17",
12+
"master": "vs17"
1213
}

php/BuildPhp/private/Get-PhpBuild.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ function Get-PhpBuild {
4040
throw "PHP version $PhpVersion is not supported."
4141
}
4242
}
43-
44-
$releaseState = if ($PhpVersion -match "[a-z]") {"qa"} else {"releases"}
45-
$baseUrl = "https://downloads.php.net/~windows/$releaseState"
46-
$fallbackBaseUrl = "https://downloads.php.net/~windows/$releaseState/archives"
43+
if($PhpVersion -eq 'master') {
44+
$fallbackBaseUrl = $baseUrl = "https://github.com/shivammathur/php-builder-windows/releases/download/master"
45+
} else {
46+
$releaseState = if ($PhpVersion -match "[a-z]") {"qa"} else {"releases"}
47+
$baseUrl = "https://downloads.php.net/~windows/$releaseState"
48+
$fallbackBaseUrl = "https://downloads.php.net/~windows/$releaseState/archives"
49+
}
4750
$tsPart = if ($Ts -eq "nts") {"nts-Win32"} else {"Win32"}
4851
$binZipFile = "php-$PhpVersion-$tsPart-$VsVersion-$Arch.zip"
4952
$binUrl = "$baseUrl/$binZipFile"

0 commit comments

Comments
 (0)