Skip to content

Fix build script to support Windows on Arm64 #1817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $script:IsNix = $IsLinux -or $IsMacOS
# For Apple M1, pwsh might be getting emulated, in which case we need to check
# for the proc_translated flag, otherwise we can check the architecture.
$script:IsAppleM1 = $IsMacOS -and ((sysctl -n sysctl.proc_translated) -eq 1 -or (uname -m) -eq "arm64")
$script:IsArm64 = $IsWindows -and $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Hosting", "BuildInfo.cs")
$script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditorServices.Common.props")

Expand Down Expand Up @@ -62,7 +63,7 @@ task FindDotNet {

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

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

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

# Run E2E tests in ConstrainedLanguage mode.
Expand Down