From 41173a3b65be51025fdbe6b734e791c2d206632f Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 21 Jul 2016 16:52:22 -0700 Subject: [PATCH] Rename IsCore to IsCoreCLR --- build.psm1 | 6 +++--- src/Modules/Shared/PowerShellGet/PSModule.psm1 | 10 +++++----- .../CoreCLR/CorePsPlatform.cs | 2 +- .../engine/InitialSessionState.cs | 6 +++--- .../engine/SpecialVariables.cs | 4 ++-- test/csharp/test_CorePsPlatform.cs | 4 ++-- test/powershell/Host/PSVersionTable.Tests.ps1 | 2 +- .../Classes/Scripting.Classes.BasicParsing.Tests.ps1 | 2 +- .../Language/Parser/MethodInvocation.Tests.ps1 | 2 +- .../Language/Parser/TypeAccelerator.Tests.ps1 | 2 +- .../Scripting/Debugging/DebuggerScriptTests.Tests.ps1 | 10 +++++----- .../Clear-EventLog.Tests.ps1 | 2 +- .../Get-EventLog.Tests.ps1 | 2 +- .../New-EventLog.Tests.ps1 | 2 +- .../Remove-EventLog.Tests.ps1 | 2 +- .../Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 | 4 ++-- .../Trace-Command.Tests.ps1 | 4 ++-- 17 files changed, 33 insertions(+), 33 deletions(-) diff --git a/build.psm1 b/build.psm1 index 19b069eb6..d01aaeb40 100644 --- a/build.psm1 +++ b/build.psm1 @@ -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 diff --git a/src/Modules/Shared/PowerShellGet/PSModule.psm1 b/src/Modules/Shared/PowerShellGet/PSModule.psm1 index 6960de904..3bf44f236 100644 --- a/src/Modules/Shared/PowerShellGet/PSModule.psm1 +++ b/src/Modules/Shared/PowerShellGet/PSModule.psm1 @@ -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 diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index 9171933bb..f20d88679 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -79,7 +79,7 @@ namespace System.Management.Automation /// /// True if PowerShell was built targeting .NET Core. /// - public static bool IsCore + public static bool IsCoreCLR { get { diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 7575d647e..a31e7799c 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -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 diff --git a/src/System.Management.Automation/engine/SpecialVariables.cs b/src/System.Management.Automation/engine/SpecialVariables.cs index a6a83d883..0fd56301c 100644 --- a/src/System.Management.Automation/engine/SpecialVariables.cs +++ b/src/System.Management.Automation/engine/SpecialVariables.cs @@ -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 diff --git a/test/csharp/test_CorePsPlatform.cs b/test/csharp/test_CorePsPlatform.cs index 2a6fa2d94..7937d539b 100644 --- a/test/csharp/test_CorePsPlatform.cs +++ b/test/csharp/test_CorePsPlatform.cs @@ -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] diff --git a/test/powershell/Host/PSVersionTable.Tests.ps1 b/test/powershell/Host/PSVersionTable.Tests.ps1 index 4725973a1..cd3367a70 100644 --- a/test/powershell/Host/PSVersionTable.Tests.ps1 +++ b/test/powershell/Host/PSVersionTable.Tests.ps1 @@ -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" } } diff --git a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 index 7a366e928..cd016e3d7 100644 --- a/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 +++ b/test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1 @@ -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++) { diff --git a/test/powershell/Language/Parser/MethodInvocation.Tests.ps1 b/test/powershell/Language/Parser/MethodInvocation.Tests.ps1 index deaf64520..f7b5bfd5a 100644 --- a/test/powershell/Language/Parser/MethodInvocation.Tests.ps1 +++ b/test/powershell/Language/Parser/MethodInvocation.Tests.ps1 @@ -1,4 +1,4 @@ -if ( $IsCore ) { +if ( $IsCoreCLR ) { return } diff --git a/test/powershell/Language/Parser/TypeAccelerator.Tests.ps1 b/test/powershell/Language/Parser/TypeAccelerator.Tests.ps1 index 59f004838..ad70df72e 100644 --- a/test/powershell/Language/Parser/TypeAccelerator.Tests.ps1 +++ b/test/powershell/Language/Parser/TypeAccelerator.Tests.ps1 @@ -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]) diff --git a/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 b/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 index c35c77cad..5e3008659 100644 --- a/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 +++ b/test/powershell/Language/Scripting/Debugging/DebuggerScriptTests.Tests.ps1 @@ -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 } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 index 9fff93ab3..631a0981f 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 @@ -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 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 index ebeb00f48..9b5b4803a 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 @@ -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 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 index 30955ffd0..0557d64dc 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 @@ -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 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 index 26787c206..1e5a29c65 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 @@ -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 diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 index bc1686499..77534c829 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1 @@ -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." } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 index 61c62edac..b1c7e6b12 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Trace-Command.Tests.ps1 @@ -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