@@ -29,7 +29,9 @@ $script:dotnetTestArgs = @(
29
29
)
30
30
31
31
$script :IsNix = $IsLinux -or $IsMacOS
32
- $script :IsRosetta = $IsMacOS -and (sysctl - n sysctl.proc_translated) -eq 1 # Mac M1
32
+ # For Apple M1, pwsh might be getting emulated, in which case we need to check
33
+ # for the proc_translated flag, otherwise we can check the architecture.
34
+ $script :IsAppleM1 = $IsMacOS -and ((sysctl - n sysctl.proc_translated) -eq 1 -or (uname - m) -eq " arm64" )
33
35
$script :BuildInfoPath = [System.IO.Path ]::Combine($PSScriptRoot , " src" , " PowerShellEditorServices.Hosting" , " BuildInfo.cs" )
34
36
$script :PsesCommonProps = [xml ](Get-Content - Raw " $PSScriptRoot /PowerShellEditorServices.Common.props" )
35
37
@@ -110,8 +112,12 @@ task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServe
110
112
111
113
if (! (Test-Path $dotnetExePath )) {
112
114
# TODO: Test .NET 5 with PowerShell 7.1
115
+ #
116
+ # We use the .NET 6 SDK, so we always install it and its runtime.
113
117
Install-Dotnet - Channel ' 6.0' # SDK and runtime
114
- Install-Dotnet - Channel ' 3.1' , ' 5.0' - Runtime # Runtime only
118
+ # Anywhere other than on a Mac with an M1 processor, we additionally
119
+ # install the .NET 3.1 and 5.0 runtimes (but not their SDKs).
120
+ if (! $script :IsAppleM1 ) { Install-Dotnet - Channel ' 3.1' , ' 5.0' - Runtime }
115
121
}
116
122
117
123
# This variable is used internally by 'dotnet' to know where it's installed
@@ -235,7 +241,7 @@ task TestServerWinPS -If (-not $script:IsNix) {
235
241
exec { & $script :dotnetExe $script :dotnetTestArgs $script :NetRuntime.Desktop }
236
242
}
237
243
238
- task TestServerPS7 - If (-not $script :IsRosetta ) {
244
+ task TestServerPS7 - If (-not $script :IsAppleM1 ) {
239
245
Set-Location .\test\PowerShellEditorServices.Test\
240
246
exec { & $script :dotnetExe $script :dotnetTestArgs $script :NetRuntime.PS7 }
241
247
}
@@ -249,7 +255,7 @@ task TestE2E {
249
255
Set-Location .\test\PowerShellEditorServices.Test.E2E\
250
256
251
257
$env: PWSH_EXE_NAME = if ($IsCoreCLR ) { " pwsh" } else { " powershell" }
252
- $NetRuntime = if ($IsRosetta ) { $script :NetRuntime.PS72 } else { $script :NetRuntime.PS7 }
258
+ $NetRuntime = if ($IsAppleM1 ) { $script :NetRuntime.PS72 } else { $script :NetRuntime.PS7 }
253
259
exec { & $script :dotnetExe $script :dotnetTestArgs $NetRuntime }
254
260
255
261
# Run E2E tests in ConstrainedLanguage mode.
0 commit comments