Skip to content

Commit a66d9d8

Browse files
Fix build script to support Windows on Arm64 (#1817)
1 parent 99edf10 commit a66d9d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $script:IsNix = $IsLinux -or $IsMacOS
3333
# For Apple M1, pwsh might be getting emulated, in which case we need to check
3434
# for the proc_translated flag, otherwise we can check the architecture.
3535
$script:IsAppleM1 = $IsMacOS -and ((sysctl -n sysctl.proc_translated) -eq 1 -or (uname -m) -eq "arm64")
36+
$script:IsArm64 = $IsWindows -and $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
3637
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Hosting", "BuildInfo.cs")
3738
$script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditorServices.Common.props")
3839

@@ -62,7 +63,7 @@ task FindDotNet {
6263

6364
# Anywhere other than on a Mac with an M1 processor, we additionally
6465
# need the .NET 3.1 runtime for our netcoreapp3.1 framework.
65-
if (!$script:IsAppleM1) {
66+
if (-not $script:IsAppleM1 -and -not $script:IsArm64) {
6667
$runtimes = dotnet --list-runtimes
6768
assert ($runtimes -match "Microsoft.NETCore.App 3.1") ".NET Runtime 3.1 required but not found!"
6869
}
@@ -183,7 +184,7 @@ Task TestServerWinPS -If (-not $script:IsNix) Build, SetupHelpForTests, {
183184
exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop }
184185
}
185186

186-
task TestServerPS7 -If (-not $script:IsAppleM1) Build, SetupHelpForTests, {
187+
task TestServerPS7 -If (-not $script:IsAppleM1 -and -not $script:IsArm64) Build, SetupHelpForTests, {
187188
Set-Location .\test\PowerShellEditorServices.Test\
188189
exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
189190
}
@@ -197,7 +198,7 @@ task TestE2E Build, SetupHelpForTests, {
197198
Set-Location .\test\PowerShellEditorServices.Test.E2E\
198199

199200
$env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" }
200-
$NetRuntime = if ($IsAppleM1) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
201+
$NetRuntime = if ($IsAppleM1 -or $script:IsArm64) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
201202
exec { & dotnet $script:dotnetTestArgs $NetRuntime }
202203

203204
# Run E2E tests in ConstrainedLanguage mode.

0 commit comments

Comments
 (0)