Skip to content
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
18 changes: 6 additions & 12 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,13 @@ function Get-PSCommitId
function Get-EnvironmentInformation
{
$environment = @{}
# Use the .NET Core APIs to determine the current platform.
# If a runtime exception is thrown, we are on Windows PowerShell, not PowerShell Core,
# because System.Runtime.InteropServices.RuntimeInformation
# and System.Runtime.InteropServices.OSPlatform do not exist in Windows PowerShell.
try {
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]

# PowerShell Core will likely not be built on pre-1709 nanoserver
if ($PSVersionTable.ContainsKey("PSEdition") -and "Core" -eq $PSVersionTable.PSEdition) {
$environment += @{'IsCoreCLR' = $true}
$environment += @{'IsLinux' = $Runtime::IsOSPlatform($OSPlatform::Linux)}
$environment += @{'IsMacOS' = $Runtime::IsOSPlatform($OSPlatform::OSX)}
$environment += @{'IsWindows' = $Runtime::IsOSPlatform($OSPlatform::Windows)}
} catch {
$environment += @{'IsLinux' = $IsLinux}
$environment += @{'IsMacOS' = $IsMacOS}
$environment += @{'IsWindows' = $IsWindows}
} else {
$environment += @{'IsCoreCLR' = $false}
$environment += @{'IsLinux' = $false}
$environment += @{'IsMacOS' = $false}
Expand Down