Rename IsCore to IsCoreCLR

This commit is contained in:
Andrew Schwartzmeyer committed 2016-07-26 11:54:08 -07:00
1 parent 9ba6ba359d
commit 41173a3b65
17 files changed
+33 -33

No files matched your search

+3 -3
View File
@@ -4,14 +4,14 @@ try {
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]
$IsCore = $true
$IsCoreCLR = $true
$IsLinux = $Runtime::IsOSPlatform($OSPlatform::Linux)
$IsOSX = $Runtime::IsOSPlatform($OSPlatform::OSX)
$IsWindows = $Runtime::IsOSPlatform($OSPlatform::Windows)
} catch {
# If these are already set, then they're read-only and we're done
try {
$IsCore = $false
$IsCoreCLR = $false
$IsLinux = $false
$IsOSX = $false
$IsWindows = $true
@@ -602,7 +602,7 @@ function Start-PSBootstrap {
}
# Install for Windows
if ($IsWindows -and -not $IsCore) {
if ($IsWindows -and -not $IsCoreCLR) {
Remove-Item -ErrorAction SilentlyContinue -Recurse -Force ~\AppData\Local\Microsoft\dotnet
$installScript = "dotnet-install.ps1"
Invoke-WebRequest -Uri $obtainUrl/$installScript -OutFile $installScript
@@ -17,7 +17,7 @@ $script:isNanoServer = $null -ne ('System.Runtime.Loader.AssemblyLoadContext' -a
function IsWindows { $PSVariable = Get-Variable -Name IsWindows -ErrorAction Ignore; return (-not $PSVariable -or $PSVariable.Value) }
function IsLinux { $PSVariable = Get-Variable -Name IsLinux -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) }
function IsOSX { $PSVariable = Get-Variable -Name IsOSX -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) }
function IsCore { $PSVariable = Get-Variable -Name IsCore -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) }
function IsCoreCLR { $PSVariable = Get-Variable -Name IsCoreCLR -ErrorAction Ignore; return ($PSVariable -and $PSVariable.Value) }
if(IsWindows)
{
@@ -727,7 +727,7 @@ function Publish-Module
Begin
{
if($script:isNanoServer -or (IsCore)) {
if($script:isNanoServer -or (IsCoreCLR)) {
$message = $LocalizedData.PublishPSArtifactUnsupportedOnNano -f "Module"
ThrowError -ExceptionName "System.InvalidOperationException" `
-ExceptionMessage $message `
@@ -2526,7 +2526,7 @@ function Publish-Script
Begin
{
if($script:isNanoServer -or (IsCore)) {
if($script:isNanoServer -or (IsCoreCLR)) {
$message = $LocalizedData.PublishPSArtifactUnsupportedOnNano -f "Script"
ThrowError -ExceptionName "System.InvalidOperationException" `
-ExceptionMessage $message `
@@ -7322,7 +7322,7 @@ function Install-NuGetClientBinaries
}
# On Nano server we don't need NuGet.exe
if(-not $bootstrapNuGetProvider -and ($script:isNanoServer -or (IsCore) -or -not $BootstrapNuGetExe))
if(-not $bootstrapNuGetProvider -and ($script:isNanoServer -or (IsCoreCLR) -or -not $BootstrapNuGetExe))
{
return
}
@@ -7379,7 +7379,7 @@ function Install-NuGetClientBinaries
}
}
if($BootstrapNuGetExe -and -not $script:isNanoServer -and -not (IsCore))
if($BootstrapNuGetExe -and -not $script:isNanoServer -and -not (IsCoreCLR))
{
Write-Verbose -Message $LocalizedData.DownloadingNugetExe
@@ -79,7 +79,7 @@ namespace System.Management.Automation
/// <summary>
/// True if PowerShell was built targeting .NET Core.
/// </summary>
public static bool IsCore
public static bool IsCoreCLR
{
get
{
@@ -5122,8 +5122,8 @@ end
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
new SessionStateVariableEntry(
SpecialVariables.IsCore,
Platform.IsCore,
SpecialVariables.IsCoreCLR,
Platform.IsCoreCLR,
String.Empty,
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
#endregion
@@ -5475,7 +5475,7 @@ end
internal const string DefaultMoreFunctionText = @"
param([string[]]$paths)
# Nano needs to use Unicode, but Windows and Linux need the default
$OutputEncoding = if ($IsWindows -and $IsCore) {
$OutputEncoding = if ($IsWindows -and $IsCoreCLR) {
[System.Text.Encoding]::Unicode
} else {
[System.Console]::OutputEncoding
@@ -166,8 +166,8 @@ namespace System.Management.Automation
internal const string IsWindows = "IsWindows";
internal static VariablePath IsWindowsPath = new VariablePath("IsWindows");
internal const string IsCore = "IsCore";
internal static VariablePath IsCorePath = new VariablePath("IsCore");
internal const string IsCoreCLR = "IsCoreCLR";
internal static VariablePath IsCoreCLRPath = new VariablePath("IsCoreCLR");
#endregion
#region Preference Variables
+2 -2
View File
@@ -10,9 +10,9 @@ namespace PSTests
public static class PlatformTests
{
[Fact]
public static void TestIsCore()
public static void TestIsCoreCLR()
{
Assert.True(Platform.IsCore);
Assert.True(Platform.IsCoreCLR);
}
[Fact]
@@ -19,7 +19,7 @@ Describe "PSVersionTable" {
$PSVersionTable.GitCommitId | Should not match "powershell.version"
}
It "Should have the correct edition" -Skip:(!$IsCore) {
It "Should have the correct edition" -Skip:(!$IsCoreCLR) {
$PSVersionTable["PSEdition"] | Should Be "PowerShellCore"
}
}
@@ -471,7 +471,7 @@ Describe 'PositiveReturnSelfClassTypeFromMemberFunction Test' -Tags "CI" {
}
Describe 'TestMultipleArguments Test' -Tags "CI" {
if ( $IsCore ) { $maxCount = 14 } else { $maxCount = 16 }
if ( $IsCoreCLR ) { $maxCount = 14 } else { $maxCount = 16 }
for ($i = 0; $i -lt $maxCount; $i++)
{
$properties = $(for ($j = 0; $j -le $i; $j++) {
@@ -1,4 +1,4 @@
if ( $IsCore ) {
if ( $IsCoreCLR ) {
return
}
@@ -11,7 +11,7 @@ Describe "Type accelerators" -Tags "DRT" {
}
It "Can query type accelerators" {
if ( $IsCore ) { $count = 80 } else { $count = 82 }
if ( $IsCoreCLR ) { $count = 80 } else { $count = 82 }
$TypeAccelerators.Count -gt $count | Should Be $true
$TypeAccelerators['xml'] | Should Be ([System.Xml.XmlDocument])
$TypeAccelerators['AllowNull'] | Should Be ([System.Management.Automation.AllowNullAttribute])
@@ -215,7 +215,7 @@ Describe "Line breakpoints on commands in multi-line pipelines" -tags 'Innerloop
Context "COM TESTS" {
# DRT for 133807 SetBreakpointWithShortPath
BeforeAll {
if ( $IsCore ) { return } # no COM on core
if ( $IsCoreCLR ) { return } # no COM on core
$scriptPath1 = Join-Path $TestDrive SBPShortPathBug133807.DRT.tmp.ps1
$scriptPath1 = setup -f SBPShortPathBug133807.DRT.tmp.ps1 -content '
1..3 |
@@ -230,19 +230,19 @@ Describe "Line breakpoints on commands in multi-line pipelines" -tags 'Innerloop
}
AfterAll {
if ( $IsCore ) { return }
if ( $IsCoreCLR ) { return }
if ($breakpoints -ne $null) { $breakpoints | Remove-PSBreakpoint }
}
It "Short path Breakpoint on line 1 hit count" -skip:$IsCore {
It "Short path Breakpoint on line 1 hit count" -skip:$IsCoreCLR {
$breakpoints[0].HitCount | Should Be 1
}
It "Short path Breakpoint on line 2 hit count" -skip:$IsCore {
It "Short path Breakpoint on line 2 hit count" -skip:$IsCoreCLR {
$breakpoints[1].HitCount | Should Be 3
}
It "Short path Breakpoint on line 3 hit count" -skip:$IsCore {
It "Short path Breakpoint on line 3 hit count" -skip:$IsCoreCLR {
$breakpoints[2].HitCount | Should Be 1
}
}
@@ -1,4 +1,4 @@
if ($IsWindows -and !$IsCore) {
if ($IsWindows -and !$IsCoreCLR) {
#check to see whether we're running as admin in Windows...
$windowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'Security.Principal.WindowsPrincipal' $windowsIdentity
@@ -1,4 +1,4 @@
if ($IsWindows -and !$IsCore) {
if ($IsWindows -and !$IsCoreCLR) {
#check to see whether we're running as admin in Windows...
$windowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'Security.Principal.WindowsPrincipal' $windowsIdentity
@@ -1,4 +1,4 @@
if ($IsWindows -and !$IsCore) {
if ($IsWindows -and !$IsCoreCLR) {
#check to see whether we're running as admin in Windows...
$windowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'Security.Principal.WindowsPrincipal' $windowsIdentity
@@ -1,4 +1,4 @@
if ($IsWindows -and !$IsCore) {
if ($IsWindows -and !$IsCoreCLR) {
#check to see whether we're running as admin in Windows...
$windowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$windowsPrincipal = new-object 'Security.Principal.WindowsPrincipal' $windowsIdentity
@@ -37,14 +37,14 @@ Describe "Invoke-Item" {
$testfile = Join-Path $TestDrive testfile.txt
}
It "Should invoke a text file without error" -Skip:($IsWindows -and $IsCore) {
It "Should invoke a text file without error" -Skip:($IsWindows -and $IsCoreCLR) {
$debugfn = NewProcessStartInfo "-noprofile ""``Invoke-Item $testfile`n" -RedirectStdIn
$process = RunPowerShell $debugfn
EnsureChildHasExited $process
$process.ExitCode | Should Be 0
}
It "Should throw not supported on Windows with .NET Core" -Skip:($IsLinux -or $IsOSX -or !$IsCore) {
It "Should throw not supported on Windows with .NET Core" -Skip:($IsLinux -or $IsOSX -or !$IsCoreCLR) {
{ Invoke-Item $testfile }| Should Throw "Operation is not supported on this platform."
}
}
@@ -13,7 +13,7 @@ Describe "Trace-Command" -tags "P1", "RI" {
}
# LogicalOperationStack is not in .NET Core
It "LogicalOperationStack works" -Skip:$IsCore {
It "LogicalOperationStack works" -Skip:$IsCoreCLR {
$keyword = "Trace_Command_ListenerOption_LogicalOperationStack_Foo"
$stack = [System.Diagnostics.Trace]::CorrelationManager.LogicalOperationStack
$stack.Push($keyword)
@@ -25,7 +25,7 @@ Describe "Trace-Command" -tags "P1", "RI" {
}
# GetStackTrace is not in .NET Core
It "Callstack works" -Skip:$IsCore {
It "Callstack works" -Skip:$IsCoreCLR {
Trace-Command -Name * -Expression {echo Foo} -ListenerOption Callstack -FilePath $logfile
$log = Get-Content $logfile | Where-Object {$_ -like "*Callstack= * System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)*"}
$log.Count | Should BeGreaterThan 0