Skip to content

Commit c1aa52d

Browse files
committed
Switch to windows-2022
1 parent 33f3991 commit c1aa52d

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
vs16:
99
name: build_vs16
10-
runs-on: windows-2019
10+
runs-on: windows-2022
1111
strategy:
1212
fail-fast: false
1313
matrix:

scripts/builder.ps1

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,32 @@ Function Get-PHPBranch() {
197197
return $php_branch
198198
}
199199

200+
Function Get-VSToolset() {
201+
$toolsets = @{
202+
"vc14" = "14.0"
203+
}
204+
$MSVCDirectory = vswhere -latest -products * -find "VC\Tools\MSVC"
205+
foreach ($toolset in (Get-ChildItem $MSVCDirectory)) {
206+
$major, $minor = $toolset.Name.split(".")[0,1]
207+
if(14 -eq $major) {
208+
if (9 -ge $minor) {
209+
$toolsets."vc14" = $toolset
210+
} elseif (19 -ge $minor) {
211+
$toolsets."vc15" = $toolset
212+
} elseif (29 -ge $minor) {
213+
$toolsets."vs16" = $toolset
214+
} else {
215+
$toolsets."vs17" = $toolset
216+
}
217+
}
218+
}
219+
$toolset = $toolsets.$vs
220+
if (-not $toolset) {
221+
throw "No toolset found for $vs"
222+
}
223+
return $toolset.Name
224+
}
225+
200226
Function Build-Extension() {
201227
$ts_path = Get-TSPath
202228
$package_zip = "php-devel-pack-$php_version$ts_path-Win32-$vs-$arch.zip"
@@ -210,7 +236,7 @@ Function Build-Extension() {
210236
$env:PATH = "$cache_dir\$package_dir;$env:PATH"
211237
$builder = "$cache_dir\php-sdk-$sdk_version\phpsdk-$vs-$arch.bat"
212238
$task = (Get-Item -Path "." -Verbose).FullName + '\task.bat'
213-
& $builder -t $task
239+
& $builder -s (Get-VSToolset) -t $task
214240
}
215241

216242
Function Copy-Extension() {

0 commit comments

Comments
 (0)