|
8 | 8 |
|
9 | 9 | . "$PSScriptRoot\tools\buildCommon\startNativeExecution.ps1"
|
10 | 10 |
|
| 11 | +# CI runs with PowerShell 5.0, so don't use features like ?: && || |
11 | 12 | Set-StrictMode -Version 3.0
|
12 | 13 |
|
13 | 14 | # On Unix paths is separated by colon
|
@@ -861,26 +862,29 @@ function New-PSOptions {
|
861 | 862 | Write-Verbose "Using framework '$Framework'"
|
862 | 863 |
|
863 | 864 | if (-not $Runtime) {
|
864 |
| - if ($environment.IsLinux) { |
865 |
| - $Runtime = "linux-x64" |
866 |
| - } elseif ($environment.IsMacOS) { |
867 |
| - if ($PSVersionTable.OS.Contains('ARM64')) { |
868 |
| - $Runtime = "osx-arm64" |
869 |
| - } |
870 |
| - else { |
871 |
| - $Runtime = "osx-x64" |
| 865 | + $Info = dotnet --info |
| 866 | + Write-Verbose "dotnet --info:`n${Info}" |
| 867 | + |
| 868 | + $Platform, $Architecture = $info | |
| 869 | + Select-String '^\s*OS Platform:\s+(\w+)$', '^\s*Architecture:\s+(\w+)$' | |
| 870 | + Select-Object -First 2 | |
| 871 | + ForEach-Object { $_.Matches.Groups[1].Value } |
| 872 | + |
| 873 | + switch ($Platform) { |
| 874 | + 'Windows' { |
| 875 | + # For x86 and x64 architectures, we use win7-x64 and win7-x86 RIDs. |
| 876 | + # For arm and arm64 architectures, we use win-arm and win-arm64 RIDs. |
| 877 | + $Platform = if ($Architecture[0] -eq 'x') { 'win7' } else { 'win' } |
| 878 | + $Runtime = "${Platform}-${Architecture}" |
872 | 879 | }
|
873 |
| - } else { |
874 |
| - $RID = dotnet --info | ForEach-Object { |
875 |
| - if ($_ -match "RID") { |
876 |
| - $_ -split "\s+" | Select-Object -Last 1 |
877 |
| - } |
| 880 | + |
| 881 | + 'Linux' { |
| 882 | + $Runtime = "linux-${Architecture}" |
878 | 883 | }
|
879 | 884 |
|
880 |
| - # We plan to release packages targeting win7-x64 and win7-x86 RIDs, |
881 |
| - # which supports all supported windows platforms. |
882 |
| - # So we, will change the RID to win7-<arch> |
883 |
| - $Runtime = $RID -replace "win\d+", "win7" |
| 885 | + 'Darwin' { |
| 886 | + $Runtime = "osx-${Architecture}" |
| 887 | + } |
884 | 888 | }
|
885 | 889 |
|
886 | 890 | if (-not $Runtime) {
|
@@ -2272,7 +2276,7 @@ function Start-DevPowerShell {
|
2272 | 2276 |
|
2273 | 2277 | # splatting for the win
|
2274 | 2278 | $startProcessArgs = @{
|
2275 |
| - FilePath = "$BinDir\pwsh" |
| 2279 | + FilePath = Join-Path $BinDir 'pwsh' |
2276 | 2280 | }
|
2277 | 2281 |
|
2278 | 2282 | if ($ArgumentList) {
|
|
0 commit comments