From 6e2190fc7de699dd9d84faaf3f56c6b98af43ca5 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Fri, 8 Apr 2016 01:47:50 -0700 Subject: [PATCH 01/36] Add Import-Alias Pester Unit test --- test/powershell/Import-Alias.Tests.ps1 | 111 +++++++++++++++++++------ 1 file changed, 86 insertions(+), 25 deletions(-) diff --git a/test/powershell/Import-Alias.Tests.ps1 b/test/powershell/Import-Alias.Tests.ps1 index 3b8cea09d..dcbc7dbe8 100644 --- a/test/powershell/Import-Alias.Tests.ps1 +++ b/test/powershell/Import-Alias.Tests.ps1 @@ -1,25 +1,86 @@ -Describe "Import-Alias" { - $pesteraliasfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath pesteralias.txt - - Context "Validate ability to import alias file" { - - It "Should be able to import an alias file successfully" { - { Import-Alias $pesteraliasfile } | Should Not throw - } - - It "Should be able to import file via the Import-Alias alias of ipal" { - { ipal $pesteraliasfile } | Should Not throw - } - - It "Should be able to import an alias file and perform imported aliased echo cmd" { - (Import-Alias $pesteraliasfile) - (pesterecho pestertesting) | Should Be "pestertesting" - } - - It "Should be able to use ipal alias to import an alias file and perform cmd" { - (ipal $pesteraliasfile) - (pesterecho pestertesting) | Should be "pestertesting" - } - - } -} +Describe "Import-Alias DRT Unit Tests" -Tags DRT{ + $testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory + $testAliases = "TestAliases" + $fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases + + BeforeEach { + New-Item -Path $testAliasDirectory -ItemType Directory -Force + remove-item alias:abcd* -force + remove-item alias:ijkl* -force + set-alias abcd01 efgh01 + set-alias abcd02 efgh02 + set-alias abcd03 efgh03 + set-alias abcd04 efgh04 + set-alias ijkl01 mnop01 + set-alias ijkl02 mnop02 + set-alias ijkl03 mnop03 + set-alias ijkl04 mnop04 + } + + AfterEach { + Remove-Item -Path $testAliasDirectory -Recurse -Force + } + + It "Import-Alias Resolve To Multiple will throw PSInvalidOperationException" { + try { + Import-Alias * + Throw "Execution OK" + } + catch { + $_.FullyQualifiedErrorId | Should be "NotSupported,Microsoft.PowerShell.Commands.ImportAliasCommand" + } + } + + It "Import-Alias From Exported Alias File Aliases Already Exist should throw SessionStateException skip now as bug#777" -Skip:$true{ + {Export-Alias $fulltestpath abcd*}| Should Not Throw + try { + Import-Alias $fulltestpath + Throw "Execution OK" + } + catch { + $_.FullyQualifiedErrorId | Should be "AliasAlreadyExists,Microsoft.PowerShell.Commands.ImportAliasCommand" + } + } + + It "Import-Alias Into Invalid Scope should throw PSArgumentException"{ + {Export-Alias $fulltestpath abcd*}| Should Not Throw + try { + Import-Alias $fulltestpath -scope bogus + Throw "Execution OK" + } + catch { + $_.FullyQualifiedErrorId | Should be "Argument,Microsoft.PowerShell.Commands.ImportAliasCommand" + } + } + + It "Import-Alias From Exported Alias File Aliases Already Exist using force should not throw"{ + {Export-Alias $fulltestpath abcd*}| Should Not Throw + {Import-Alias $fulltestpath -Force}| Should Not Throw + } +} + +Describe "Import-Alias" { + $pesteraliasfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath pesteralias.txt + + Context "Validate ability to import alias file" { + + It "Should be able to import an alias file successfully" { + { Import-Alias $pesteraliasfile } | Should Not throw + } + + It "Should be able to import file via the Import-Alias alias of ipal" { + { ipal $pesteraliasfile } | Should Not throw + } + + It "Should be able to import an alias file and perform imported aliased echo cmd" { + (Import-Alias $pesteraliasfile) + (pesterecho pestertesting) | Should Be "pestertesting" + } + + It "Should be able to use ipal alias to import an alias file and perform cmd" { + (ipal $pesteraliasfile) + (pesterecho pestertesting) | Should be "pestertesting" + } + + } +} From 865f174e22fa248b10191f437e946e449dc0ea24 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 9 Apr 2016 17:59:13 -0700 Subject: [PATCH 02/36] Clean up comparison operators in build module --- PowerShellGitHubDev.psm1 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 4f8becfb2..9a0426e69 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -70,7 +70,7 @@ function Start-PSBuild { } $precheck = $precheck -and (precheck 'msbuild' 'msbuild not found. Install Visual Studio 2015.') - } elseif ($IsLinux -Or $IsOSX) { + } elseif ($IsLinux -or $IsOSX) { $InstallCommand = if ($IsLinux) { 'apt-get' } elseif ($IsOSX) { @@ -82,14 +82,14 @@ function Start-PSBuild { } } - if (-Not $Runtime) { + if (-not $Runtime) { $Runtime = dotnet --info | % { if ($_ -match "RID") { $_ -split "\s+" | Select-Object -Last 1 } } - if (-Not $Runtime) { + if (-not $Runtime) { Write-Warning "Could not determine Runtime Identifier, please update dotnet" $precheck = $false } else { @@ -111,7 +111,7 @@ function Start-PSBuild { $Framework = 'netstandardapp1.5' } - if ($IsLinux -Or $IsOSX) { + if ($IsLinux -or $IsOSX) { $Configuration = "Linux" $Executable = "powershell" } else { @@ -132,7 +132,7 @@ function Start-PSBuild { # Build the Output path in script scope $script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework) # FullCLR only builds a library, so there is no runtime component - if (-Not $FullCLR) { + if (-not $FullCLR) { $script:Output = [IO.Path]::Combine($script:Output, $Runtime) } # Publish injects the publish directory @@ -144,7 +144,7 @@ function Start-PSBuild { Write-Verbose "script:Output is $script:Output" # handle Restore - if ($Restore -Or -Not (Test-Path "$Top/project.lock.json")) { + if ($Restore -or -not (Test-Path "$Top/project.lock.json")) { log "Run dotnet restore" $RestoreArguments = @("--verbosity") @@ -160,7 +160,7 @@ function Start-PSBuild { } # Build native components - if ($IsLinux -Or $IsOSX) { + if ($IsLinux -or $IsOSX) { $Ext = if ($IsLinux) { "so" } elseif ($IsOSX) { @@ -180,7 +180,7 @@ function Start-PSBuild { Pop-Location } - if (-Not (Test-Path $Lib)) { + if (-not (Test-Path $Lib)) { throw "Compilation of $Lib failed" } } elseif ($FullCLR) { @@ -217,7 +217,7 @@ function Start-PSBuild { function Get-PSOutput { [CmdletBinding()]param() - if (-Not $Output) { + if (-not $Output) { throw '$script:Output is not defined, run Start-PSBuild' } @@ -274,7 +274,7 @@ function Start-PSPackage { if ($IsWindows) { throw "Building Windows packages is not yet supported!" } - if (-Not (Get-Command "fpm" -ErrorAction SilentlyContinue)) { + if (-not (Get-Command "fpm" -ErrorAction SilentlyContinue)) { throw "Build dependency 'fpm' not found in PATH! See: https://github.com/jordansissel/fpm" } @@ -292,7 +292,7 @@ function Start-PSPackage { } # Use Git tag if not given a version - if (-Not($Version)) { + if (-not $Version) { $Version = (git --git-dir="$PSScriptRoot/.git" describe) -Replace '^v' } @@ -348,7 +348,7 @@ function Start-DevPSGitHub { $env:COMPLUS_ZapDisable = 1 } - if (-Not (Test-Path $binDir\powershell.exe.config)) { + if (-not (Test-Path $binDir\powershell.exe.config)) { $configContents = @" From 0afd4c2f987801352591d42f64f82bca6cf86d6d Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Sat, 9 Apr 2016 18:02:37 -0700 Subject: [PATCH 03/36] Improve Start-PSPackage - Now checks that previous Start-PSBuild was with -Publish - Uses $script:Output automatically - Uses /opt/microsoft/powershell on Linux per FHS - Uses /usr/local/microsoft/powershell on OS X per FHS - Specifies "--rpm-os linux" for RPM packages built elsewhere - Creates symlink on demand for packaging - Puts symlink in /usr/(local)/bin as it is expected to be in PATH - Uses $Arguments array for better syntax - Resolves #800 Note that if the target of the powershell symlink exists, `fpm` aborts with a `utime` error on OS X. --- PowerShellGitHubDev.psm1 | 85 +++++++++++++++++++++++++++------------- package/powershell | 1 - 2 files changed, 57 insertions(+), 29 deletions(-) delete mode 120000 package/powershell diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 9a0426e69..3cc1a739d 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -262,35 +262,58 @@ function Start-PSxUnit { } function Start-PSPackage { - # PowerShell packages use Semantic Versioning http://semver.org/ - # - # Ubuntu and OS X packages are supported. [CmdletBinding()]param( + # PowerShell packages use Semantic Versioning http://semver.org/ [string]$Version, + # Package iteration version (rarely changed) [int]$Iteration = 1, + # Ubuntu, CentOS, and OS X packages are supported [ValidateSet("deb", "osxpkg", "rpm")] [string]$Type ) + $Description = @" +Open PowerShell on .NET Core +PowerShell is an open-source, cross-platform, scripting language and rich object shell. +Built upon .NET Core, it is also a C# REPL. +"@ + if ($IsWindows) { throw "Building Windows packages is not yet supported!" } if (-not (Get-Command "fpm" -ErrorAction SilentlyContinue)) { throw "Build dependency 'fpm' not found in PATH! See: https://github.com/jordansissel/fpm" } - if (-Not(Test-Path "$PSScriptRoot/bin/powershell")) { - throw "Please Start-PSBuild with the corresponding runtime for the package" + $Source = Split-Path -Parent (Get-PSOutput) + if ((Split-Path -Leaf $Source) -ne "publish") { + throw "Please Start-PSBuild -Package with the corresponding runtime for the package" } - # Change permissions for packaging - chmod -R go=u "$PSScriptRoot/bin" - # Decide package output type - if (-Not($Type)) { + if (-not $Type) { $Type = if ($IsLinux) { "deb" } elseif ($IsOSX) { "osxpkg" } Write-Warning "-Type was not specified, continuing with $Type" } + # Follow the Filesystem Hierarchy Standard for Linux and OS X + $Destination = if ($IsLinux) { + "/opt/microsoft/powershell" + } elseif ($IsOSX) { + "/usr/local/microsoft/powershell" + } + + # Destination for symlink to powershell executable + $Link = if ($IsLinux) { + "/usr/bin" + } elseif ($IsOSX) { + "/usr/local/bin" + } + + New-Item -Force -ItemType SymbolicLink -Path /tmp/powershell -Target $Destination/powershell >$null + + # Change permissions for packaging + chmod -R go=u $Source /tmp/powershell + # Use Git tag if not given a version if (-not $Version) { $Version = (git --git-dir="$PSScriptRoot/.git" describe) -Replace '^v' @@ -306,26 +329,32 @@ function Start-PSPackage { "rpm" { "libicu" } } + + $Arguments = @( + "--force", "--verbose", + "--name", "powershell", + "--version", $Version, + "--iteration", $Iteration, + "--maintainer", "Andrew Schwartzmeyer ", + "--vendor", "Microsoft ", + "--url", "https://github.com/PowerShell/PowerShell", + "--license", "Unlicensed", + "--description", $Description, + "--category", "shells", + "--rpm-os", "linux", + "--depends", $libunwind, + "--depends", $libicu, + "--deb-build-depends", "dotnet", + "--deb-build-depends", "cmake", + "--deb-build-depends", "g++", + "-t", $Type, + "-s", "dir", + "$Source/=$Destination/", + "/tmp/powershell=$Link" + ) + # Build package - fpm --force --verbose ` - --name "powershell" ` - --version $Version ` - --iteration $Iteration ` - --maintainer "Andrew Schwartzmeyer " ` - --vendor "Microsoft " ` - --url "https://github.com/PowerShell/PowerShell" ` - --license "Unlicensed" ` - --description "Open PowerShell on .NET Core\nPowerShell is an open-source, cross-platform, scripting language and rich object shell. Built upon .NET Core, it is also a C# REPL.\n" ` - --category "shells" ` - --depends $libunwind ` - --depends $libicu ` - --deb-build-depends "dotnet" ` - --deb-build-depends "cmake" ` - --deb-build-depends "g++" ` - -t $Type ` - -s dir ` - "$PSScriptRoot/bin/=/usr/local/share/powershell/" ` - "$PSScriptRoot/package/powershell=/usr/local/bin" + fpm $Arguments } diff --git a/package/powershell b/package/powershell deleted file mode 120000 index 61bd3470b..000000000 --- a/package/powershell +++ /dev/null @@ -1 +0,0 @@ -../share/powershell/powershell \ No newline at end of file From 5c341e7d7f1975aa566e94d18b94c896bc7167ab Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Sun, 10 Apr 2016 19:38:35 -0700 Subject: [PATCH 04/36] Remove Context for Import-Alias pester unit test --- test/powershell/Import-Alias.Tests.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/powershell/Import-Alias.Tests.ps1 b/test/powershell/Import-Alias.Tests.ps1 index dcbc7dbe8..42f699b63 100644 --- a/test/powershell/Import-Alias.Tests.ps1 +++ b/test/powershell/Import-Alias.Tests.ps1 @@ -62,8 +62,6 @@ Describe "Import-Alias DRT Unit Tests" -Tags DRT{ Describe "Import-Alias" { $pesteraliasfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath pesteralias.txt - Context "Validate ability to import alias file" { - It "Should be able to import an alias file successfully" { { Import-Alias $pesteraliasfile } | Should Not throw } @@ -81,6 +79,4 @@ Describe "Import-Alias" { (ipal $pesteraliasfile) (pesterecho pestertesting) | Should be "pestertesting" } - - } } From e0547c81ff884ca563548ec28c5c6e5f69337909 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 11 Apr 2016 09:50:58 -0700 Subject: [PATCH 05/36] Update Linux installation documentation for v0.3.0 --- docs/installation/linux.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/docs/installation/linux.md b/docs/installation/linux.md index f3302dd55..803a94ae5 100644 --- a/docs/installation/linux.md +++ b/docs/installation/linux.md @@ -6,34 +6,50 @@ Supports Ubuntu 14.04, CentOS 7.1, and OS X 10.11. Once the package is installed, `powershell` will be in your path, ready to be launched from a terminal. It will read `~/.powershell/profile.ps1` for your user profile, and -`/usr/local/share/powershell/PSL_profile.ps1` for the system profile. +`/opt/microsoft/powershell/Microsoft.PowerShellCore_profile.ps1` for +the host profile. Similarly, it will search `~/.powershell/Modules` and -`/usr/local/share/powershell/Modules` for user and system modules. +`/opt/microsoft/powershell/Modules` for user and system modules. + +To place PowerShell in your path, a symlink to the +`/opt/microsoft/powershell/powershell` executable is placed at +`/usr/bin/powershell`. Ubuntu 14.04 ============ Using a stock Ubuntu 14.04 image, download the -`powershell_0.2.0-1_amd64.deb` file, and then execute the following: +`powershell_0.3.0-1_amd64.deb` file, and then execute the following: ```sh sudo apt-get install libunwind8 libicu52 -sudo dpkg -i powershell_0.2.0-1_amd64.deb +sudo dpkg -i powershell_0.3.0-1_amd64.deb ``` CentOS 7.1 ========== Using a stock CentOS 7.1 image, download the -`powershell-0.2.0-1.x86_64.rpm` file, and then execute the following: +`powershell-0.3.0-1.x86_64.rpm` file, and then execute the following: ```sh -sudo yum install powershell-0.2.0-1.x86_64.rpm +sudo yum install powershell-0.3.0-1.x86_64.rpm ``` OS X 10.11 ========== -Using an OS X 10.11 machine, download the `powershell-0.2.0.pkg` file, -double-click it, and follow the prompts. +Using an OS X 10.11 machine, download the `powershell-0.3.0.pkg` file, +double-click it, and follow the prompts. Or install it from the +terminal: + +```sh +sudo installer -pkg powershell-0.3.0.pkg -target / +``` + +Note that because OS X is a derivation of BSD, instead of `/opt`, the +prefix used is `/usr/local`; thus, `powershell` lives at +`/usr/local/microsoft/powershell`, and the symlink is placed at +`/usr/local/bin/powershell`. This affects the system modules and +profile as well. From 71b55abf6696841e18b8a25a77a73b9a7e1332f5 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 11 Apr 2016 10:37:15 -0700 Subject: [PATCH 06/36] Bump .NET Core packages to build 24011 And update the CorePsTypeCatalog. --- .../project.json | 2 +- .../project.json | 4 +- .../project.json | 4 +- .../CorePsTypeCatalog.cs | 112 +++++++++--------- .../project.json | 4 +- .../project.json | 6 +- .../project.json | 4 +- src/System.Management.Automation/project.json | 60 +++++----- src/System.Security.SecureString/project.json | 2 +- 9 files changed, 99 insertions(+), 99 deletions(-) diff --git a/src/Microsoft.Management.Infrastructure.Native/project.json b/src/Microsoft.Management.Infrastructure.Native/project.json index 15a08f9b2..ef7ce6fe8 100644 --- a/src/Microsoft.Management.Infrastructure.Native/project.json +++ b/src/Microsoft.Management.Infrastructure.Native/project.json @@ -11,7 +11,7 @@ "warningsAsErrors": true }, "dependencies": { - "NETStandard.Library": "1.5.0-rc3-24004-00", + "NETStandard.Library": "1.5.0-rc3-24011-00", "System.Security.SecureString": "1.0.0-*" } }, diff --git a/src/Microsoft.Management.Infrastructure/project.json b/src/Microsoft.Management.Infrastructure/project.json index e76693770..c0aae85a9 100644 --- a/src/Microsoft.Management.Infrastructure/project.json +++ b/src/Microsoft.Management.Infrastructure/project.json @@ -19,8 +19,8 @@ "define": [ "_CORECLR" ] }, "dependencies": { - "System.Runtime.Serialization.Xml": "4.1.1-rc3-24004-00", - "System.Threading.ThreadPool": "4.0.10-rc3-24004-00" + "System.Runtime.Serialization.Xml": "4.1.1-rc3-24011-00", + "System.Threading.ThreadPool": "4.0.10-rc3-24011-00" } }, "net451": { diff --git a/src/Microsoft.PowerShell.Commands.Management/project.json b/src/Microsoft.PowerShell.Commands.Management/project.json index 02bdaf99d..55d5a80b1 100644 --- a/src/Microsoft.PowerShell.Commands.Management/project.json +++ b/src/Microsoft.PowerShell.Commands.Management/project.json @@ -19,8 +19,8 @@ "define": [ "CORECLR" ] }, "dependencies": { - "System.ServiceProcess.ServiceController": "4.1.0-rc3-24004-00", - "System.Net.NameResolution": "4.0.0-rc3-24004-00" + "System.ServiceProcess.ServiceController": "4.1.0-rc3-24011-00", + "System.Net.NameResolution": "4.0.0-rc3-24011-00" } }, "net451": { diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs index 6179e61af..8ef7a6bbf 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs @@ -1045,52 +1045,52 @@ namespace System.Management.Automation typeCatalog["System.Linq.ILookup`2"] = "System.Linq, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Linq.IOrderedEnumerable`1"] = "System.Linq, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Linq.Lookup`2"] = "System.Linq, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.IOrderedQueryable"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.IOrderedQueryable`1"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.IQueryable"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.IQueryable`1"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.IQueryProvider"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.BinaryExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.BlockExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.CatchBlock"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ConditionalExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ConstantExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.DebugInfoExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.DefaultExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ElementInit"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.Expression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.Expression`1"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ExpressionType"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ExpressionVisitor"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.GotoExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.GotoExpressionKind"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.IArgumentProvider"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.IDynamicExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.IndexExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.InvocationExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.LabelExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.LabelTarget"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.LambdaExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ListInitExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.LoopExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberAssignment"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberBinding"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberBindingType"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberInitExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberListBinding"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MemberMemberBinding"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.MethodCallExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.NewArrayExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.NewExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.ParameterExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.RuntimeVariablesExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.SwitchCase"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.SwitchExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.SymbolDocumentInfo"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.TryExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.TypeBinaryExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Linq.Expressions.UnaryExpression"] = "System.Linq.Expressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.IOrderedQueryable"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.IOrderedQueryable`1"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.IQueryable"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.IQueryable`1"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.IQueryProvider"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.BinaryExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.BlockExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.CatchBlock"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ConditionalExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ConstantExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.DebugInfoExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.DefaultExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ElementInit"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.Expression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.Expression`1"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ExpressionType"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ExpressionVisitor"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.GotoExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.GotoExpressionKind"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.IArgumentProvider"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.IDynamicExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.IndexExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.InvocationExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.LabelExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.LabelTarget"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.LambdaExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ListInitExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.LoopExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberAssignment"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberBinding"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberBindingType"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberInitExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberListBinding"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MemberMemberBinding"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.MethodCallExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.NewArrayExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.NewExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.ParameterExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.RuntimeVariablesExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.SwitchCase"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.SwitchExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.SymbolDocumentInfo"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.TryExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.TypeBinaryExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Linq.Expressions.UnaryExpression"] = "System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Net.Http.ByteArrayContent"] = "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Net.Http.ClientCertificateOption"] = "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Net.Http.DelegatingHandler"] = "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; @@ -2197,16 +2197,16 @@ namespace System.Management.Automation typeCatalog["System.Text.UTF32Encoding"] = "System.Text.Encoding.Extensions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Text.UTF7Encoding"] = "System.Text.Encoding.Extensions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Text.UTF8Encoding"] = "System.Text.Encoding.Extensions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.Capture"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.CaptureCollection"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.Group"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.GroupCollection"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.Match"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.MatchCollection"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.MatchEvaluator"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.Regex"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.RegexMatchTimeoutException"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; - typeCatalog["System.Text.RegularExpressions.RegexOptions"] = "System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.Capture"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.CaptureCollection"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.Group"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.GroupCollection"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.Match"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.MatchCollection"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.MatchEvaluator"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.Regex"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.RegexMatchTimeoutException"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + typeCatalog["System.Text.RegularExpressions.RegexOptions"] = "System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Threading.AbandonedMutexException"] = "System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Threading.AsyncLocal`1"] = "System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; typeCatalog["System.Threading.AsyncLocalValueChangedArgs`1"] = "System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json index b364735b6..7a3a53f93 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json @@ -22,8 +22,8 @@ "define": [ "CORECLR" ] }, "dependencies": { - "NETStandard.Library": "1.5.0-rc3-24004-00", - "System.Runtime.Loader": "4.0.0-rc3-24004-00" + "NETStandard.Library": "1.5.0-rc3-24011-00", + "System.Runtime.Loader": "4.0.0-rc3-24011-00" } } } diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/project.json b/src/Microsoft.PowerShell.CoreCLR.Eventing/project.json index 6ba83afa9..30aec82bd 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/project.json +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/project.json @@ -23,9 +23,9 @@ "define": [ "CORECLR" ] }, "dependencies": { - "System.Security.Principal": "4.0.1-rc3-24004-00", - "System.Security.Principal.Windows": "4.0.0-rc3-24004-00", - "System.Diagnostics.TraceSource": "4.0.0-rc3-24004-00", + "System.Security.Principal": "4.0.1-rc3-24011-00", + "System.Security.Principal.Windows": "4.0.0-rc3-24011-00", + "System.Diagnostics.TraceSource": "4.0.0-rc3-24011-00", "System.Security.SecureString": "1.0.0-*" } } diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/project.json b/src/Microsoft.PowerShell.CoreConsoleHost/project.json index bee6b0578..22edf8af0 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/project.json +++ b/src/Microsoft.PowerShell.CoreConsoleHost/project.json @@ -11,8 +11,8 @@ "dependencies": { "Newtonsoft.Json": "8.0.2", - "System.Xml.XDocument": "4.0.11-rc3-24004-00", - "System.IO.MemoryMappedFiles": "4.0.0-rc3-24004-00", + "System.Xml.XDocument": "4.0.11-rc3-24011-00", + "System.IO.MemoryMappedFiles": "4.0.0-rc3-24011-00", "Microsoft.PowerShell.Commands.Management": "1.0.0-*", "Microsoft.PowerShell.Commands.Utility": "1.0.0-*" }, diff --git a/src/System.Management.Automation/project.json b/src/System.Management.Automation/project.json index fbfa7018d..e58a4f1f0 100644 --- a/src/System.Management.Automation/project.json +++ b/src/System.Management.Automation/project.json @@ -30,36 +30,36 @@ "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext": "1.0.0-*", "Microsoft.PowerShell.CoreCLR.Eventing": "1.0.0-*", - "Microsoft.CSharp": "4.0.1-rc3-24004-00", - "Microsoft.Win32.Registry.AccessControl": "4.0.0-rc3-24004-00", - "System.Collections.Specialized": "4.0.1-rc3-24004-00", - "System.Collections.NonGeneric": "4.0.1-rc3-24004-00", - "System.ComponentModel.EventBasedAsync": "4.0.11-rc3-24004-00", - "System.ComponentModel.TypeConverter": "4.0.1-rc3-24004-00", - "System.Data.Common": "4.0.1-rc3-24004-00", - "System.Diagnostics.Contracts": "4.0.1-rc3-24004-00", - "System.Diagnostics.FileVersionInfo": "4.0.0-rc3-24004-00", - "System.Diagnostics.Process": "4.1.0-rc3-24004-00", - "System.Diagnostics.StackTrace": "4.0.1-rc3-24004-00", - "System.Diagnostics.TraceSource": "4.0.0-rc3-24004-00", - "System.Dynamic.Runtime": "4.0.11-rc3-24004-00", - "System.IO.FileSystem.AccessControl": "4.0.0-rc3-24004-00", - "System.IO.FileSystem.DriveInfo": "4.0.0-rc3-24004-00", - "System.IO.FileSystem.Watcher": "4.0.0-rc3-24004-00", - "System.IO.Pipes": "4.0.0-rc3-24004-00", - "System.Linq.Expressions": "4.0.11-rc3-24004-00", - "System.Net.Http": "4.0.1-rc3-24004-00", - "System.Net.NetworkInformation": "4.1.0-rc3-24004-00", - "System.Reflection.Emit": "4.0.1-rc3-24004-00", - "System.Reflection.Emit.Lightweight": "4.0.1-rc3-24004-00", - "System.Security.AccessControl": "4.0.0-rc3-24004-00", - "System.Security.Cryptography.Algorithms": "4.1.0-rc3-24004-00", - "System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24004-00", - "System.Threading.Thread": "4.0.0-rc3-24004-00", - "System.Threading.Tasks.Parallel": "4.0.1-rc3-24004-00", - "System.Xml.XPath.XmlDocument": "4.0.1-rc3-24004-00", - "System.Xml.XmlDocument": "4.0.1-rc3-24004-00", - "System.Xml.XmlSerializer": "4.0.11-rc3-24004-00" + "Microsoft.CSharp": "4.0.1-rc3-24011-00", + "Microsoft.Win32.Registry.AccessControl": "4.0.0-rc3-24011-00", + "System.Collections.Specialized": "4.0.1-rc3-24011-00", + "System.Collections.NonGeneric": "4.0.1-rc3-24011-00", + "System.ComponentModel.EventBasedAsync": "4.0.11-rc3-24011-00", + "System.ComponentModel.TypeConverter": "4.0.1-rc3-24011-00", + "System.Data.Common": "4.0.1-rc3-24011-00", + "System.Diagnostics.Contracts": "4.0.1-rc3-24011-00", + "System.Diagnostics.FileVersionInfo": "4.0.0-rc3-24011-00", + "System.Diagnostics.Process": "4.1.0-rc3-24011-00", + "System.Diagnostics.StackTrace": "4.0.1-rc3-24011-00", + "System.Diagnostics.TraceSource": "4.0.0-rc3-24011-00", + "System.Dynamic.Runtime": "4.0.11-rc3-24011-00", + "System.IO.FileSystem.AccessControl": "4.0.0-rc3-24011-00", + "System.IO.FileSystem.DriveInfo": "4.0.0-rc3-24011-00", + "System.IO.FileSystem.Watcher": "4.0.0-rc3-24011-00", + "System.IO.Pipes": "4.0.0-rc3-24011-00", + "System.Linq.Expressions": "4.0.11-rc3-24011-00", + "System.Net.Http": "4.0.1-rc3-24011-00", + "System.Net.NetworkInformation": "4.1.0-rc3-24011-00", + "System.Reflection.Emit": "4.0.1-rc3-24011-00", + "System.Reflection.Emit.Lightweight": "4.0.1-rc3-24011-00", + "System.Security.AccessControl": "4.0.0-rc3-24011-00", + "System.Security.Cryptography.Algorithms": "4.1.0-rc3-24011-00", + "System.Security.Cryptography.X509Certificates": "4.1.0-rc3-24011-00", + "System.Threading.Thread": "4.0.0-rc3-24011-00", + "System.Threading.Tasks.Parallel": "4.0.1-rc3-24011-00", + "System.Xml.XPath.XmlDocument": "4.0.1-rc3-24011-00", + "System.Xml.XmlDocument": "4.0.1-rc3-24011-00", + "System.Xml.XmlSerializer": "4.0.11-rc3-24011-00" } }, "net451": { diff --git a/src/System.Security.SecureString/project.json b/src/System.Security.SecureString/project.json index 7d2cfc174..5f8be8985 100644 --- a/src/System.Security.SecureString/project.json +++ b/src/System.Security.SecureString/project.json @@ -12,7 +12,7 @@ "frameworks": { "netstandard1.5": { "dependencies": { - "NETStandard.Library": "1.5.0-rc3-24004-00" + "NETStandard.Library": "1.5.0-rc3-24011-00" }, "imports": [ "dnxcore50" ] } From 735a702f1ccb85869a8c5164980a520baa4eaff6 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 11 Apr 2016 10:45:10 -0700 Subject: [PATCH 07/36] Remove alias tests for Write-Output The `echo` and `write` aliases were removed, which make these tests inaccurate (but did not fail them). --- test/powershell/Write-Output.Tests.ps1 | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/test/powershell/Write-Output.Tests.ps1 b/test/powershell/Write-Output.Tests.ps1 index 2e1ee9718..89c2210bb 100644 --- a/test/powershell/Write-Output.Tests.ps1 +++ b/test/powershell/Write-Output.Tests.ps1 @@ -35,22 +35,6 @@ Describe "Write-Output" { } } - Context "Alias Tests" { - It "Should have the same result between the echo alias and the cmdlet" { - $alias = echo -InputObject $testString - $cmdlet = Write-Output -InputObject $testString - - $alias | Should Be $cmdlet - } - - It "Should have the same result between the write alias and the cmdlet" { - $alias = write -InputObject $testString - $cmdlet = Write-Output -InputObject $testString - - $alias | Should Be $cmdlet - } - } - Context "Enumerate Objects" { $enumerationObject = @(1,2,3) It "Should see individual objects when not using the NoEnumerate switch" { From ea53a156422a171f568838fb5a06a28b00f0e02e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 11 Apr 2016 12:41:58 -0700 Subject: [PATCH 08/36] Update download.sh to get v0.3.0 deb asset --- download.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.sh b/download.sh index 58ef8d0e0..7b2637d03 100755 --- a/download.sh +++ b/download.sh @@ -3,12 +3,12 @@ [[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; } # Authorizes with read-only access to GitHub API -# Retrieves URL of v0.2.0 release asset +# Retrieves URL of v0.3.0 release asset # Downloads asset to powershell.deb curl -s -i \ -H "Authorization: token $GITHUB_TOKEN " \ -H 'Accept: application/octet-stream' \ - 'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1398546' | + 'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1536045' | grep location | sed 's/location: //g' | wget -i - -O powershell.deb From 1f19758614aaad31a95c05bad8d3d5880ad85c07 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 12 Apr 2016 12:10:54 -0700 Subject: [PATCH 09/36] Remove OMI and provider submodules --- .gitmodules | 7 ------- src/omi | 1 - src/omi-provider | 1 - 3 files changed, 9 deletions(-) delete mode 160000 src/omi delete mode 160000 src/omi-provider diff --git a/.gitmodules b/.gitmodules index 6fc1171a3..fc9b7ccdf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +1,3 @@ -[submodule "src/omi"] - path = src/omi - url = https://github.com/Microsoft/omi.git - branch = psrp/features -[submodule "src/omi-provider"] - path = src/omi-provider - url = https://github.com/PowerShell/psl-omi-provider.git [submodule "src/windows-build"] path = src/windows-build url = https://github.com/PowerShell/psl-windows-build.git diff --git a/src/omi b/src/omi deleted file mode 160000 index 6fbc8b0b6..000000000 --- a/src/omi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6fbc8b0b6297a67993b280deeb47af97896511c5 diff --git a/src/omi-provider b/src/omi-provider deleted file mode 160000 index 4f49eae9a..000000000 --- a/src/omi-provider +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4f49eae9a80e87219b284728960b41efbbc40a8c From a2fc6c330aa0c052655492aee0b378ac463e650a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 12 Apr 2016 15:18:27 -0700 Subject: [PATCH 10/36] Remove PSRP building documentation Migrated to PSRP repository --- docs/building/psrp.md | 106 ------------------------------------------ 1 file changed, 106 deletions(-) delete mode 100644 docs/building/psrp.md diff --git a/docs/building/psrp.md b/docs/building/psrp.md deleted file mode 100644 index 1d1018b34..000000000 --- a/docs/building/psrp.md +++ /dev/null @@ -1,106 +0,0 @@ -PowerShell Remoting Protocol -============================ - -This guide supplements the [Linux instructions](./linux.md), as -building PowerShell Remoting Protocol (PSRP) support first requires -PowerShell on Linux built. - -PSRP communication is tunneled through the Open Management -Infrastructure (OMI) using the [OMI provider][]. - -> PSRP has been observed working on OS X, but the changes made to OMI to -> accomplish this are not even beta-ready and need to be done correctly. They -> exist on the `andschwa-osx` branch of the OMI repository. - -[OMI provider]: https://github.com/PowerShell/psl-omi-provider/ - -Environment -=========== - -Toolchain Setup ---------------- - -PSRP requires the following additional packages: - -```sh -sudo apt-get install libpam0g-dev libssl-dev libcurl4-openssl-dev libboost-filesystem-dev -``` - -Git Setup ---------- - -Two additional submodules need to be initialized: - -```sh -git submodule update --init -- src/omi src/omi-provider -``` - -The `src/omi` submodule requires your GitHub user to have joined the -Microsoft organization. If it fails to check out, Git will give up and -not check out further submodules either. Please follow the -instructions on the [Open Source Hub][]. - -[Open Source Hub]: https://opensourcehub.microsoft.com/articles/how-to-join-microsoft-github-org-self-service - -Building -======== - -Run `./omibuild.sh` to build OMI and the provider. - -This script first builds OMI in developer mode: - -```sh -pushd src/omi/Unix -./configure --dev -make -j -popd -``` - -Then it builds and registers the provider: - -```sh -pushd src/omi-provider -cmake -DCMAKE_BUILD_TYPE=Debug . -make -j -popd -``` - -The provider maintains its own native host library to initialize the -CLR, but there are plans to refactor .NET's packaged host as a shared -library. - -Running -------- - -Some initial setup on Windows is required. Open an administrative command -prompt and execute the following: - -```cmd -winrm set winrm/config/Client @{AllowUnencrypted="true"} -winrm set winrm/config/Client @{TrustedHosts="*"} -``` - -> You can also set the `TrustedHosts` to include the target's IP address. - -Then on Linux, launch `omiserver` (after building with the -instructions above): - -```sh -./psrp.sh -``` - -Now in a PowerShell prompt on Windows (opened after setting the WinRM client -configurations): - -```powershell -Enter-PSSession -ComputerName -Credential $cred -Authentication basic -``` - -> The `$cred` variable can be empty; a credentials prompt will appear, enter -> any fake credentials you wish as authentication is not yet implemented. - -The IP address of the Linux machine can be obtained with: - -```sh -ip -f inet addr show dev eth0 -``` From b8f326adf5fec1e4e134c73b8f8d8e86b9527229 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 12 Apr 2016 15:59:38 -0700 Subject: [PATCH 11/36] Redirect PSRP documentation to other repo --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c0e739618..b57ca8598 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Get PowerShell | | Linux | Windows .NET Core | Windows .NET Full | OS X | PSRP | |-----------------------|-------|-------------------|-------------------|------|------| -| Build from **Source** | [Instructions](docs/building/linux.md) | [Instructions](docs/building/windows-core.md) | [Instructions](docs/building/windows-full.md) | [Instructions](docs/building/osx.md) | [Instructions](docs/building/psrp.md) | +| Build from **Source** | [Instructions](docs/building/linux.md) | [Instructions](docs/building/windows-core.md) | [Instructions](docs/building/windows-full.md) | [Instructions](docs/building/osx.md) | [Instructions][psrp] | | Get **Binaries** | [Releases][] | [Artifacts][] | [Artifacts][] | [Releases][] | TBD | Building summary: `Start-PSBuild` from the module @@ -38,6 +38,7 @@ instructions. [releases]: https://github.com/PowerShell/PowerShell/releases [artifacts]: https://ci.appveyor.com/project/PowerShell/powershell-linux/build/artifacts +[psrp]: https://github.com/PowerShell/psl-omi-provider Team coordination ----------------- From 285253da02ae687e0ead0902cdb9c7de58e97054 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 12 Apr 2016 16:00:05 -0700 Subject: [PATCH 12/36] Disable xUnit tests on Travis temporarily Until #806 is resolved. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0ea3ad8e4..5cc937b31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_install: - ./download.sh - sudo dpkg -i ./powershell.deb script: - - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild; Start-PSxUnit; Start-PSPester" + - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild; Start-PSPester" notifications: slack: secure: sKYd4n61+ZFzGZuWGUl8V1kN0NM16wRVOFVlNhlFCwnkrEsKROb++EvXf5uwnKuzxkhEjvPWO+UFgeshQDoR93y4s5YLfhC5JupK4nUzjPzWs208KTrh8u/x9MY8X6Ojxi85EEAiku5GzMoMlkucSStZUYwbIfnelzqdw8uoRwmm2MW4XCPwsuEuDUVghyiva0Mdx1G6MopCrK8T96WywJXT3chhfZQgVt+sQCBt9g+2kjDaObKrzG0P07IVK43ZpDgnu6AoxlyBzIx9mJH2Oa/tki3/kTO72Wcp3ps3qvmiStADamzVKR9p1VlWCLWAd6VOehxuByCGEyujpzk135Wud2DZYO+8LD6inZVhFe3Wt5pCU9BDXZppiATfMCqgXEH7nK54pEn79yHcjthRJ2+Z9ot7As2fu3RSBmTAi8nRP0fxRyX/jctR3S6P0qt0y1ynx9nzBfhmhPQW0PMVazWS/nruQIvK/3iiYXjZxM5bBwIvabmwV00EYeTdbL6ufXWNgQcG1ZWkDsi2I3vst/ytUbHwaFYg83bXWpxg9DCzJeWLVUvE5/3NfBxRAuCTot/fgTEA9IYScvrlL7Q/bT0cOt0vEM98MPf1UO+WP85uxhsRgHtwDEo+jMaL6ZFkPhlV6mmmED4NdY2//a571cLNXdnuMAze5O3TWGBG53g= From 841f76ec37c2afde3b7e575d9d1497bfe2672d00 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 12 Apr 2016 16:16:17 -0700 Subject: [PATCH 13/36] Update Git setup documentation Now that everyone needs all the submodules. Much simpler. --- README.md | 32 +++++++++++++++++++++++++++++--- docs/building/linux.md | 10 +--------- docs/building/windows-core.md | 10 +--------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index b57ca8598..22c717082 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,32 @@ rules, and Git best practices. Clone this repository. It is a "superproject" and has a number of other repositories embedded within it as submodules. *Please* see the -contributing guidelines and learn about submodules. Not every -submodule is required on every system; see the individual build -instructions for the necessary subsets. +contributing guidelines and learn about submodules. To make things +easy, we can just clone recursively. + +```sh +git clone --recursive https://github.com/PowerShell/PowerShell.git +``` + +You can verify that the submodules were initialized properly with: + +```sh +git submodule status +``` + +If they're initialized, it will look like this: + +``` + f23641488f8d7bf8630ca3496e61562aa3a64009 src/Modules/Pester (f23641488) + c99458533a9b4c743ed51537e25989ea55944908 src/libpsl-native/test/googletest (release-1.7.0) + e6bf85694ae8352d77175c4c7d304946e018808c src/windows-build (monad/cc6afbeb-3/31) +``` + +If they're not, there will be minuses in front (and the folders will +be empty): + +``` +-f23641488f8d7bf8630ca3496e61562aa3a64009 src/Modules/Pester (f23641488) +-c99458533a9b4c743ed51537e25989ea55944908 src/libpsl-native/test/googletest (release-1.7.0) +-e6bf85694ae8352d77175c4c7d304946e018808c src/windows-build (monad/cc6afbeb-3/31) +``` diff --git a/docs/building/linux.md b/docs/building/linux.md index 88275f544..5e4076f7e 100644 --- a/docs/building/linux.md +++ b/docs/building/linux.md @@ -59,17 +59,9 @@ Git Setup --------- Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and [Contributing Guidelines](../../CONTRIBUTING.md). -Please clone the superproject (this repo) and initialize a subset of -the submodules: - -```sh -git clone https://github.com/PowerShell/PowerShell.git -cd PowerShell -git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest -``` - Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index c4821468e..31def61ac 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -47,17 +47,9 @@ Git Setup --------- Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and [Contributing Guidelines](../../CONTRIBUTING.md). -Please clone the superproject (this repo) and initialize a subset of -the submodules: - -```sh -git clone https://github.com/PowerShell/PowerShell.git -cd PowerShell -git submodule update --init -- src/windows-build src/Modules/Pester -``` - Build using our module ====================== From 6184dec3ad0bf0c945c89680948c2893fb6b9477 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Wed, 13 Apr 2016 02:42:34 -0700 Subject: [PATCH 14/36] Update stand-alone tests for Import-Alias Pester unit test --- test/powershell/Import-Alias.Tests.ps1 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/test/powershell/Import-Alias.Tests.ps1 b/test/powershell/Import-Alias.Tests.ps1 index 42f699b63..f47b493a4 100644 --- a/test/powershell/Import-Alias.Tests.ps1 +++ b/test/powershell/Import-Alias.Tests.ps1 @@ -1,5 +1,5 @@ Describe "Import-Alias DRT Unit Tests" -Tags DRT{ - $testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ExportAliasTestDirectory + $testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ImportAliasTestDirectory $testAliases = "TestAliases" $fulltestpath = Join-Path -Path $testAliasDirectory -ChildPath $testAliases @@ -60,7 +60,24 @@ Describe "Import-Alias DRT Unit Tests" -Tags DRT{ } Describe "Import-Alias" { - $pesteraliasfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath pesteralias.txt + $newLine=[Environment]::NewLine + $testAliasDirectory = Join-Path -Path $TestDrive -ChildPath ImportAliasTestDirectory + $testAliases = "pesteralias.txt" + $pesteraliasfile = Join-Path -Path $testAliasDirectory -ChildPath $testAliases + + BeforeEach { + New-Item -Path $testAliasDirectory -ItemType Directory -Force + + $pesteraliascontent ='# Alias File'+$newLine + $pesteraliascontent+='# Exported by : alex'+$newLine + $pesteraliascontent+='# Date/Time : Thursday, 12 November 2015 21:55:08'+$newLine + $pesteraliascontent+='# Computer : archvm'+$newLine+'"pesterecho","echo","","None"' + $pesteraliascontent > $pesteraliasfile + } + + AfterEach { + Remove-Item -Path $testAliasDirectory -Recurse -Force + } It "Should be able to import an alias file successfully" { { Import-Alias $pesteraliasfile } | Should Not throw From 1bc2a9e576a9f0fbdbcc37a01a9d1f10964775d6 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 11 Apr 2016 16:56:19 -0700 Subject: [PATCH 15/36] Fix stack overflow exception when loading assemblies When an assembly that exists outside of the trusted platform assembly list but in the GAC on Windows was loaded, the use of `Assembly.Load` before the `LoadFromAssemblyPath` caused a recursive loop to occur. This happens because an `Assembly.Load` on a not-yet-loaded assembly is overridden, thus calling back into the `AssemblyLoadContext.Load` override. By attempting to load from the file path first, we avoid this loop. However, loading TPA assemblies by their path throws an exception, so now we catch this particular exception and attempt the load through `Assembly.Load`. This is safe for TPA assemblies since they're already loaded, thus the `Assembly.Load` does not re-load the assembly, but simply returns it. --- .../CoreCLR/CorePsAssemblyLoadContext.cs | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs index 8c17f5e86..106cf402a 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs @@ -141,9 +141,8 @@ namespace System.Management.Automation string asmCultureName = assemblyName.CultureName ?? string.Empty; string asmFilePath = null; - for (int i = 0; i < probingPaths.Count; i++) + foreach (var probingPath in probingPaths) { - string probingPath = probingPaths[i]; string asmCulturePath = Path.Combine(probingPath, asmCultureName); for (int k = 0; k < extensions.Length; k++) { @@ -184,19 +183,21 @@ namespace System.Management.Automation assemblyName.FullName); } - // Try loading it from the TPA list. All PowerShell dependencies are in the - // TPA list when published with dotnet-cli. try - { - asmLoaded = Assembly.Load(assemblyName); - } - // If it wasn't there, try loading from path - catch (FileNotFoundException) { asmLoaded = asmFilePath.EndsWith(".ni.dll", StringComparison.OrdinalIgnoreCase) ? LoadFromNativeImagePath(asmFilePath, null) : LoadFromAssemblyPath(asmFilePath); } + // Since .NET CLI built versions of PowerShell have all the + // built-in assemblies in the TPA list, the above will throw, + // and we have to use Assembly.Load. However, we must try the + // above first, otherwise assemblies that exist outside the TPA + // list will go into a recursive loop. + catch (System.IO.FileLoadException) + { + asmLoaded = System.Reflection.Assembly.Load(assemblyName); + } // If it loaded, add it to the cache if (asmLoaded != null) @@ -250,20 +251,22 @@ namespace System.Management.Automation if (TryGetAssemblyFromCache(assemblyName, out asmLoaded)) return asmLoaded; - // Try loading it from the TPA list. All PowerShell dependencies are in the - // TPA list when published with dotnet-cli. try - { - asmLoaded = Assembly.Load(assemblyName); - } - // If it wasn't there, try loading from path - catch (FileNotFoundException) { // Load the assembly through 'LoadFromNativeImagePath' or 'LoadFromAssemblyPath' asmLoaded = assemblyPath.EndsWith(".ni.dll", StringComparison.OrdinalIgnoreCase) ? LoadFromNativeImagePath(assemblyPath, null) : LoadFromAssemblyPath(assemblyPath); } + // Since .NET CLI built versions of PowerShell have all the + // built-in assemblies in the TPA list, the above will throw, + // and we have to use Assembly.Load. However, we must try the + // above first, otherwise assemblies that exist outside the TPA + // list will go into a recursive loop. + catch (System.IO.FileLoadException) + { + asmLoaded = System.Reflection.Assembly.Load(assemblyName); + } if (asmLoaded != null) { @@ -503,11 +506,11 @@ namespace System.Management.Automation // Porting note: it's much easier to send an LPStr on Linux private const UnmanagedType stringType = -#if LINUX + #if LINUX UnmanagedType.LPStr -#else + #else UnmanagedType.LPWStr -#endif + #endif ; /// From 95eade130597af48f880bb7a35236838625def19 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Mon, 11 Apr 2016 00:12:28 -0700 Subject: [PATCH 16/36] Add Get-Variable Pester Unit Test --- test/powershell/Get-Variable.Tests.ps1 | 333 ++++++++++++++----------- 1 file changed, 193 insertions(+), 140 deletions(-) diff --git a/test/powershell/Get-Variable.Tests.ps1 b/test/powershell/Get-Variable.Tests.ps1 index 71c4d367b..6721b3366 100644 --- a/test/powershell/Get-Variable.Tests.ps1 +++ b/test/powershell/Get-Variable.Tests.ps1 @@ -1,140 +1,193 @@ -Describe "Get-Variable" { - It "Should be able to call with no parameters without error" { - { Get-Variable } | Should Not Throw - } - - It "Should return environment variables when called with no parameters" { - (Get-Variable).Name -contains "$" | Should Be $true - (Get-Variable).Name -contains "?" | Should Be $true - (Get-Variable).Name -contains "HOST" | Should Be $true - (Get-Variable).Name -contains "PWD" | Should Be $true - (Get-Variable).Name -contains "PID" | Should Be $true - (Get-Variable).Name -contains "^" | Should Be $true - } - - It "Should return the value of an object" { - New-Variable -Name tempVar -Value 1 - (Get-Variable tempVar).Value | Should Be (1) - } - - It "Should be able to call using the gv alias" { - { gv } | Should Not Throw - } - - It "Should be able to call using the Name switch" { - New-Variable -Name var1 -Value 4 - - { Get-Variable -Name var1 } | Should Not Throw - - (Get-Variable -Name var1).Value | Should Be 4 - - Remove-Variable var1 - } - - It "Should be able to use wildcard characters in the Name field" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value "test" - - (Get-Variable -Name var*).Value[0] | Should be 4 - (Get-Variable -Name var*).Value[1] | Should be "test" - - Remove-Variable var1 - Remove-Variable var2 - } - - It "Should return only the value if the value switch is used" { - New-Variable -Name var1 -Value 4 - - Get-Variable -Name var1 -ValueOnly | Should be 4 - - Remove-Variable var1 - } - - It "Should pipe string to the name field without the Name field being specified"{ - New-Variable -Name var1 -Value 3 - - ("var1" | Get-Variable ).Value | Should Be 3 - - Remove-Variable var1 - } - - It "Should be able to include a set of variables to get" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value 2 - - $actual = Get-Variable -Include var1, var2 - - $actual[0].Name | Should Be var1 - $actual[1].Name | Should Be var2 - - $actual[0].Value | Should Be 4 - $actual[1].Value | Should Be 2 - - Remove-Variable var1 - Remove-Variable var2 - } - - It "Should be able to exclude a set of variables to get" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value 2 - New-Variable -Name var3 -Value "test" - - $actual = Get-Variable -Exclude var1, var2 - - $actual | Where-Object { $_.Name -eq "var3" } | Should Not BeNullOrEmpty - } - - Context "Scope Tests" { - # This will violate the DRY principle. Tread softly. - It "Should be able to get a global scope variable using the global switch" { - New-Variable globalVar -Value 1 -Scope global -Force - - (Get-Variable -Name globalVar -Scope global)[0].Value | Should Be 1 - } - - It "Should not be able to clear a global scope variable using the local switch" { - New-Variable globalVar -Value 1 -Scope global -Force - - Get-Variable -Name globalVar -Scope local -ErrorAction SilentlyContinue | Should Throw - } - - It "Should be able to get a global variable when there's one in the script scope" { - New-Variable globalVar -Value 1 -Scope global -Force - { New-Variable globalVar -Value 2 -Scope script -Force } - - $(Get-Variable -Name globalVar).Value | Should Be 1 - } - - It "Should be able to get an item locally using the local switch" { - { - New-Variable localVar -Value 1 -Scope local -Force - - Get-Variable -Name localVar -Scope local - } | Should Not Throw - } - - It "Should be able to get a variable created in the global scope when there's one in local scope" { - New-Variable localVar -Value 1 -Scope local -Force - - New-Variable localVar -Value 2 -Scope global -Force - - $(Get-Variable -Name localVar -Scope global).Value | Should Be 2 - } - - It "Should be able to get a script variable created using the script switch" { - { - New-Variable scriptVar -Value 1 -Scope script -Force - - Get-Variable -Name scriptVar -Scope script - } | Should Not Throw - } - - It "Should be able to clear a global script variable that was created using the script scope switch" { - { - New-Variable scriptVar -Value 1 -Scope script -Force - - Get-Variable -Name scriptVar -Scope script - } | Should Not Throw - } - } -} + +Describe "Get-Variable DRT Unit Tests" -Tags DRT{ + It "Get-Variable not exist variable Name should throw ItemNotFoundException skip now as bug#777" -Skip:$true{ + try { + Get-Variable -Name nonexistingVariableName + Throw "Execution OK" + } + catch { + $_.FullyQualifiedErrorId | Should be "VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand" + } + } + + It "Get-Variable exist variable Name with include and bogus exclude should work"{ + Set-Variable newVar testing + $var1=get-variable -Name newVar -Include newVar -Exclude bogus + $var1.Name|Should Be "newVar" + $var1.Value|Should Be "testing" + } + + It "Get-Variable exist variable Name with Description and Option should work"{ + Set-Variable newVar testing -Option ReadOnly -Description "testing description" + $var1=get-variable -Name newVar + $var1.Name|Should Be "newVar" + $var1.Value|Should Be "testing" + $var1.Options|Should Be "ReadOnly" + $var1.Description|Should Be "testing description" + } + + It "Get-Variable exist variable Globbing Name should work"{ + Set-Variable abcaVar testing + Set-Variable bcdaVar "another test" + Set-Variable aVarfoo wow + $var1=get-variable -Name *aVar* -Scope local + $var1[0].Name|Should Be "abcaVar" + $var1[0].Value|Should Be "testing" + $var1[1].Name|Should Be "aVarfoo" + $var1[1].Value|Should Be "wow" + $var1[2].Name|Should Be "bcdaVar" + $var1[2].Value|Should Be "another test" + } + + It "Get-Variable an exist private variable Name should throw ItemNotFoundException skip now as bug#777" -Skip:$true{ + try { + Set-Variable newVar testing -Option Private + Get-Variable -Name newVar + Throw "Execution OK" + } + catch { + $_.FullyQualifiedErrorId | Should be "VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand" + } + } +} + +Describe "Get-Variable" { + It "Should be able to call with no parameters without error" { + { Get-Variable } | Should Not Throw + } + + It "Should return environment variables when called with no parameters" { + (Get-Variable).Name -contains "$" | Should Be $true + (Get-Variable).Name -contains "?" | Should Be $true + (Get-Variable).Name -contains "HOST" | Should Be $true + (Get-Variable).Name -contains "PWD" | Should Be $true + (Get-Variable).Name -contains "PID" | Should Be $true + (Get-Variable).Name -contains "^" | Should Be $true + } + + It "Should return the value of an object" { + New-Variable -Name tempVar -Value 1 + (Get-Variable tempVar).Value | Should Be (1) + } + + It "Should be able to call using the gv alias" { + { gv } | Should Not Throw + } + + It "Should be able to call using the Name switch" { + New-Variable -Name var1 -Value 4 + + { Get-Variable -Name var1 } | Should Not Throw + + (Get-Variable -Name var1).Value | Should Be 4 + + Remove-Variable var1 + } + + It "Should be able to use wildcard characters in the Name field" { + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value "test" + + (Get-Variable -Name var*).Value[0] | Should be 4 + (Get-Variable -Name var*).Value[1] | Should be "test" + + Remove-Variable var1 + Remove-Variable var2 + } + + It "Should return only the value if the value switch is used" { + New-Variable -Name var1 -Value 4 + + Get-Variable -Name var1 -ValueOnly | Should be 4 + + Remove-Variable var1 + } + + It "Should pipe string to the name field without the Name field being specified"{ + New-Variable -Name var1 -Value 3 + + ("var1" | Get-Variable ).Value | Should Be 3 + + Remove-Variable var1 + } + + It "Should be able to include a set of variables to get" { + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value 2 + + $actual = Get-Variable -Include var1, var2 + + $actual[0].Name | Should Be var1 + $actual[1].Name | Should Be var2 + + $actual[0].Value | Should Be 4 + $actual[1].Value | Should Be 2 + + Remove-Variable var1 + Remove-Variable var2 + } + + It "Should be able to exclude a set of variables to get" { + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value 2 + New-Variable -Name var3 -Value "test" + + $actual = Get-Variable -Exclude var1, var2 + + $actual | Where-Object { $_.Name -eq "var3" } | Should Not BeNullOrEmpty + } + + Context "Scope Tests" { + # This will violate the DRY principle. Tread softly. + It "Should be able to get a global scope variable using the global switch" { + New-Variable globalVar -Value 1 -Scope global -Force + + (Get-Variable -Name globalVar -Scope global)[0].Value | Should Be 1 + } + + It "Should not be able to clear a global scope variable using the local switch" { + New-Variable globalVar -Value 1 -Scope global -Force + + Get-Variable -Name globalVar -Scope local -ErrorAction SilentlyContinue | Should Throw + } + + It "Should be able to get a global variable when there's one in the script scope" { + New-Variable globalVar -Value 1 -Scope global -Force + { New-Variable globalVar -Value 2 -Scope script -Force } + + $(Get-Variable -Name globalVar).Value | Should Be 1 + } + + It "Should be able to get an item locally using the local switch" { + { + New-Variable localVar -Value 1 -Scope local -Force + + Get-Variable -Name localVar -Scope local + } | Should Not Throw + } + + It "Should be able to get a variable created in the global scope when there's one in local scope" { + New-Variable localVar -Value 1 -Scope local -Force + + New-Variable localVar -Value 2 -Scope global -Force + + $(Get-Variable -Name localVar -Scope global).Value | Should Be 2 + } + + It "Should be able to get a script variable created using the script switch" { + { + New-Variable scriptVar -Value 1 -Scope script -Force + + Get-Variable -Name scriptVar -Scope script + } | Should Not Throw + } + + It "Should be able to clear a global script variable that was created using the script scope switch" { + { + New-Variable scriptVar -Value 1 -Scope script -Force + + Get-Variable -Name scriptVar -Scope script + } | Should Not Throw + } + } +} From 053191437763abaeb2d609f08ae55ad20f7d853f Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Tue, 12 Apr 2016 00:46:50 -0700 Subject: [PATCH 17/36] Enable bug777 skip for Get-Variable --- test/powershell/Get-Variable.Tests.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/powershell/Get-Variable.Tests.ps1 b/test/powershell/Get-Variable.Tests.ps1 index 6721b3366..0d6d2fb82 100644 --- a/test/powershell/Get-Variable.Tests.ps1 +++ b/test/powershell/Get-Variable.Tests.ps1 @@ -1,6 +1,7 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ - It "Get-Variable not exist variable Name should throw ItemNotFoundException skip now as bug#777" -Skip:$true{ + It "Get-Variable not exist variable Name should throw ItemNotFoundException"{ + $ErrorActionPreference = "Stop" try { Get-Variable -Name nonexistingVariableName Throw "Execution OK" @@ -8,6 +9,7 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ catch { $_.FullyQualifiedErrorId | Should be "VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand" } + $ErrorActionPreference = "SilentlyContinue" } It "Get-Variable exist variable Name with include and bogus exclude should work"{ @@ -39,7 +41,7 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ $var1[2].Value|Should Be "another test" } - It "Get-Variable an exist private variable Name should throw ItemNotFoundException skip now as bug#777" -Skip:$true{ + It "Get-Variable an exist private variable Name should throw ItemNotFoundException skip now as bug#818" -Skip:$true{ try { Set-Variable newVar testing -Option Private Get-Variable -Name newVar From 191f232519ac3d9b8f7a5142ec2e95cc014a003e Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Wed, 13 Apr 2016 00:01:49 -0700 Subject: [PATCH 18/36] Update fixed comments from PR for Get-Variable Pester unit test --- test/powershell/Get-Variable.Tests.ps1 | 29 +++++++++++++------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/test/powershell/Get-Variable.Tests.ps1 b/test/powershell/Get-Variable.Tests.ps1 index 0d6d2fb82..6b26ff4a2 100644 --- a/test/powershell/Get-Variable.Tests.ps1 +++ b/test/powershell/Get-Variable.Tests.ps1 @@ -1,25 +1,23 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ - It "Get-Variable not exist variable Name should throw ItemNotFoundException"{ - $ErrorActionPreference = "Stop" + It "Get-Variable of not existing variable Name should throw ItemNotFoundException"{ try { - Get-Variable -Name nonexistingVariableName + Get-Variable -EA Stop -Name nonexistingVariableName Throw "Execution OK" } catch { $_.FullyQualifiedErrorId | Should be "VariableNotFound,Microsoft.PowerShell.Commands.GetVariableCommand" } - $ErrorActionPreference = "SilentlyContinue" } - It "Get-Variable exist variable Name with include and bogus exclude should work"{ + It "Get-Variable of existing variable Name with include and bogus exclude should work"{ Set-Variable newVar testing $var1=get-variable -Name newVar -Include newVar -Exclude bogus $var1.Name|Should Be "newVar" $var1.Value|Should Be "testing" } - It "Get-Variable exist variable Name with Description and Option should work"{ + It "Get-Variable of existing variable Name with Description and Option should work"{ Set-Variable newVar testing -Option ReadOnly -Description "testing description" $var1=get-variable -Name newVar $var1.Name|Should Be "newVar" @@ -28,11 +26,12 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ $var1.Description|Should Be "testing description" } - It "Get-Variable exist variable Globbing Name should work"{ + It "Get-Variable of existing variable Globbing Name should work"{ Set-Variable abcaVar testing Set-Variable bcdaVar "another test" Set-Variable aVarfoo wow $var1=get-variable -Name *aVar* -Scope local + $var1.Count | Should be 3 $var1[0].Name|Should Be "abcaVar" $var1[0].Value|Should Be "testing" $var1[1].Name|Should Be "aVarfoo" @@ -41,10 +40,10 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ $var1[2].Value|Should Be "another test" } - It "Get-Variable an exist private variable Name should throw ItemNotFoundException skip now as bug#818" -Skip:$true{ + It "Get-Variable of existing private variable Name should throw ItemNotFoundException skip now as bug#818" -Skip:$true{ try { Set-Variable newVar testing -Option Private - Get-Variable -Name newVar + &{Get-Variable -Name newVar} Throw "Execution OK" } catch { @@ -73,7 +72,7 @@ Describe "Get-Variable" { } It "Should be able to call using the gv alias" { - { gv } | Should Not Throw + (get-alias gv).Definition | Should be "Get-Variable" } It "Should be able to call using the Name switch" { @@ -136,7 +135,7 @@ Describe "Get-Variable" { $actual = Get-Variable -Exclude var1, var2 - $actual | Where-Object { $_.Name -eq "var3" } | Should Not BeNullOrEmpty + $actual.Name -contains "var3" | Should Be $true } Context "Scope Tests" { @@ -144,7 +143,7 @@ Describe "Get-Variable" { It "Should be able to get a global scope variable using the global switch" { New-Variable globalVar -Value 1 -Scope global -Force - (Get-Variable -Name globalVar -Scope global)[0].Value | Should Be 1 + (Get-Variable -Name globalVar -Scope global).Value | Should Be 1 } It "Should not be able to clear a global scope variable using the local switch" { @@ -155,9 +154,9 @@ Describe "Get-Variable" { It "Should be able to get a global variable when there's one in the script scope" { New-Variable globalVar -Value 1 -Scope global -Force - { New-Variable globalVar -Value 2 -Scope script -Force } + { New-Variable globalVar -Value 2 -Scope script -Force} - $(Get-Variable -Name globalVar).Value | Should Be 1 + (Get-Variable -Name globalVar).Value | Should Be 1 } It "Should be able to get an item locally using the local switch" { @@ -173,7 +172,7 @@ Describe "Get-Variable" { New-Variable localVar -Value 2 -Scope global -Force - $(Get-Variable -Name localVar -Scope global).Value | Should Be 2 + (Get-Variable -Name localVar -Scope global).Value | Should Be 2 } It "Should be able to get a script variable created using the script switch" { From d0c759f10e68521b4a36dbcf9c894f3b6ffe64aa Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Wed, 13 Apr 2016 01:43:27 -0700 Subject: [PATCH 19/36] Update indent for Get-Variable Pester unit test --- test/powershell/Get-Variable.Tests.ps1 | 80 +++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/test/powershell/Get-Variable.Tests.ps1 b/test/powershell/Get-Variable.Tests.ps1 index 6b26ff4a2..dd25aceaa 100644 --- a/test/powershell/Get-Variable.Tests.ps1 +++ b/test/powershell/Get-Variable.Tests.ps1 @@ -54,88 +54,88 @@ Describe "Get-Variable DRT Unit Tests" -Tags DRT{ Describe "Get-Variable" { It "Should be able to call with no parameters without error" { - { Get-Variable } | Should Not Throw + { Get-Variable } | Should Not Throw } It "Should return environment variables when called with no parameters" { - (Get-Variable).Name -contains "$" | Should Be $true - (Get-Variable).Name -contains "?" | Should Be $true - (Get-Variable).Name -contains "HOST" | Should Be $true - (Get-Variable).Name -contains "PWD" | Should Be $true - (Get-Variable).Name -contains "PID" | Should Be $true - (Get-Variable).Name -contains "^" | Should Be $true + (Get-Variable).Name -contains "$" | Should Be $true + (Get-Variable).Name -contains "?" | Should Be $true + (Get-Variable).Name -contains "HOST" | Should Be $true + (Get-Variable).Name -contains "PWD" | Should Be $true + (Get-Variable).Name -contains "PID" | Should Be $true + (Get-Variable).Name -contains "^" | Should Be $true } It "Should return the value of an object" { - New-Variable -Name tempVar -Value 1 - (Get-Variable tempVar).Value | Should Be (1) + New-Variable -Name tempVar -Value 1 + (Get-Variable tempVar).Value | Should Be (1) } It "Should be able to call using the gv alias" { - (get-alias gv).Definition | Should be "Get-Variable" + (get-alias gv).Definition | Should be "Get-Variable" } It "Should be able to call using the Name switch" { - New-Variable -Name var1 -Value 4 + New-Variable -Name var1 -Value 4 - { Get-Variable -Name var1 } | Should Not Throw + { Get-Variable -Name var1 } | Should Not Throw - (Get-Variable -Name var1).Value | Should Be 4 + (Get-Variable -Name var1).Value | Should Be 4 - Remove-Variable var1 + Remove-Variable var1 } It "Should be able to use wildcard characters in the Name field" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value "test" + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value "test" - (Get-Variable -Name var*).Value[0] | Should be 4 - (Get-Variable -Name var*).Value[1] | Should be "test" + (Get-Variable -Name var*).Value[0] | Should be 4 + (Get-Variable -Name var*).Value[1] | Should be "test" - Remove-Variable var1 - Remove-Variable var2 + Remove-Variable var1 + Remove-Variable var2 } It "Should return only the value if the value switch is used" { - New-Variable -Name var1 -Value 4 + New-Variable -Name var1 -Value 4 - Get-Variable -Name var1 -ValueOnly | Should be 4 + Get-Variable -Name var1 -ValueOnly | Should be 4 - Remove-Variable var1 + Remove-Variable var1 } It "Should pipe string to the name field without the Name field being specified"{ - New-Variable -Name var1 -Value 3 + New-Variable -Name var1 -Value 3 - ("var1" | Get-Variable ).Value | Should Be 3 + ("var1" | Get-Variable ).Value | Should Be 3 - Remove-Variable var1 + Remove-Variable var1 } It "Should be able to include a set of variables to get" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value 2 + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value 2 - $actual = Get-Variable -Include var1, var2 + $actual = Get-Variable -Include var1, var2 - $actual[0].Name | Should Be var1 - $actual[1].Name | Should Be var2 + $actual[0].Name | Should Be var1 + $actual[1].Name | Should Be var2 - $actual[0].Value | Should Be 4 - $actual[1].Value | Should Be 2 + $actual[0].Value | Should Be 4 + $actual[1].Value | Should Be 2 - Remove-Variable var1 - Remove-Variable var2 + Remove-Variable var1 + Remove-Variable var2 } It "Should be able to exclude a set of variables to get" { - New-Variable -Name var1 -Value 4 - New-Variable -Name var2 -Value 2 - New-Variable -Name var3 -Value "test" + New-Variable -Name var1 -Value 4 + New-Variable -Name var2 -Value 2 + New-Variable -Name var3 -Value "test" - $actual = Get-Variable -Exclude var1, var2 + $actual = Get-Variable -Exclude var1, var2 - $actual.Name -contains "var3" | Should Be $true + $actual.Name -contains "var3" | Should Be $true } Context "Scope Tests" { From 273328d06f591296ae2548fcab38c17efc2466cb Mon Sep 17 00:00:00 2001 From: Sergei Vorobev Date: Tue, 12 Apr 2016 13:06:17 -0700 Subject: [PATCH 20/36] Update files from psl-monad source-depot [SD:695331] Corresponds to 1218e29752ba4 --- src/Modules/PSGet/PSGet.Format.ps1xml | 12 - src/Modules/PSGet/PSGet.Resource.psd1 | Bin 69704 -> 70822 bytes src/Modules/PSGet/PSModule.psm1 | 364 ++++++++++++------ .../DscSupport/CimDSCParser.cs | 5 +- .../engine/hostifaces/Connection.cs | 7 +- .../engine/remoting/client/remoterunspace.cs | 4 + .../server/ServerRunspacePoolDriver.cs | 5 +- .../security/nativeMethods.cs | 29 +- 8 files changed, 266 insertions(+), 160 deletions(-) diff --git a/src/Modules/PSGet/PSGet.Format.ps1xml b/src/Modules/PSGet/PSGet.Format.ps1xml index 54ff00a1f..2908458c0 100644 --- a/src/Modules/PSGet/PSGet.Format.ps1xml +++ b/src/Modules/PSGet/PSGet.Format.ps1xml @@ -14,9 +14,6 @@ 35 - - 10 - 20 @@ -31,9 +28,6 @@ Name - - Type - Repository @@ -52,9 +46,6 @@ - - 25 - 25 @@ -69,9 +60,6 @@ Name - - PackageManagementProvider - InstallationPolicy diff --git a/src/Modules/PSGet/PSGet.Resource.psd1 b/src/Modules/PSGet/PSGet.Resource.psd1 index 5177bec6b84b495f13b5c0b5aa366aba6e0eaa08..7dfaf7c0e88032293afbb1da1b9aed26dc9fc261 100644 GIT binary patch delta 503 zcma)3&r1Sf5S^vPD7GJ@5F1FF6+|c`QFJMb3NolPmCjaQ?v_8oRa3fzw+O$HrO78oB;vZF<5$>4@P z#4GI@yGpLglcqTMYrnIrxuuu=_x+WVZbj>m{1j#t_{`zvk%2L144p-b#^<6_kD!{P z4b0d?l)y9_xu7hEg$`vgJ~gLW-BkmYu-RBuhf@$62f?Ckm=hGD2rWanG-p9Tnrsdq z>lgEi%CB$Jql>8h$>GWRo#N+@`r7!v@Q|zCVg^Mq#ef-U&7cypJXUJp r1R)CIJ-|6qE2c47cC|0mcxx - [CmdletBinding(PositionalBinding=$false, + [CmdletBinding(DefaultParameterSetName='NameParameterSet', HelpUri='http://go.microsoft.com/fwlink/?LinkID=517129')] Param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory=$true, + Position=0, + ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [string] $Name, - [Parameter(Mandatory=$true)] + [Parameter(Mandatory=$true, + Position=1, + ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [Uri] $SourceLocation, - [Parameter()] + [Parameter(ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [Uri] $PublishLocation, - [Parameter()] + [Parameter(ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [Uri] $ScriptSourceLocation, - [Parameter()] + [Parameter(ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [Uri] $ScriptPublishLocation, + [Parameter(Mandatory=$true, + ParameterSetName='PSGalleryParameterSet')] + [Switch] + $Default, + [Parameter()] [ValidateSet('Trusted','Untrusted')] [string] $InstallationPolicy = 'Untrusted', - [Parameter()] + [Parameter(ParameterSetName='NameParameterSet')] [ValidateNotNullOrEmpty()] [string] $PackageManagementProvider @@ -3585,62 +3602,86 @@ function Register-PSRepository Process { - # Ping and resolve the specified location - $SourceLocation = Resolve-Location -Location (Get-LocationString -LocationUri $SourceLocation) ` - -LocationParameterName 'SourceLocation' ` - -CallerPSCmdlet $PSCmdlet - if(-not $SourceLocation) + if($PSCmdlet.ParameterSetName -eq 'PSGalleryParameterSet') { - # Above Resolve-Location function throws an error when it is not able to resolve a location - return - } + if(-not $Default) + { + return + } - if($InstallationPolicy -eq "Trusted") - { - $PSBoundParameters.Add("Trusted", $true) - } - - $providerName = $null - - if($PackageManagementProvider) - { - $providerName = $PackageManagementProvider - } - elseif($selctedProviderName) - { - $providerName = $selctedProviderName + $PSBoundParameters['Name'] = $Script:PSGalleryModuleSource + $null = $PSBoundParameters.Remove('Default') } else { - $providerName = Get-PackageManagementProviderName -Location $SourceLocation + if($Name -eq $Script:PSGalleryModuleSource) + { + $message = $LocalizedData.UseDefaultParameterSetOnRegisterPSRepository + ThrowError -ExceptionName "System.ArgumentException" ` + -ExceptionMessage $message ` + -ErrorId 'UseDefaultParameterSetOnRegisterPSRepository' ` + -CallerPSCmdlet $PSCmdlet ` + -ErrorCategory InvalidArgument ` + -ExceptionObject $Name + return + } + + # Ping and resolve the specified location + $SourceLocation = Resolve-Location -Location (Get-LocationString -LocationUri $SourceLocation) ` + -LocationParameterName 'SourceLocation' ` + -CallerPSCmdlet $PSCmdlet + if(-not $SourceLocation) + { + # Above Resolve-Location function throws an error when it is not able to resolve a location + return + } + + $providerName = $null + + if($PackageManagementProvider) + { + $providerName = $PackageManagementProvider + } + elseif($selctedProviderName) + { + $providerName = $selctedProviderName + } + else + { + $providerName = Get-PackageManagementProviderName -Location $SourceLocation + } + + if($providerName) + { + $PSBoundParameters[$script:PackageManagementProviderParam] = $providerName + } + + if($PublishLocation) + { + $PSBoundParameters[$script:PublishLocation] = Get-LocationString -LocationUri $PublishLocation + } + + if($ScriptPublishLocation) + { + $PSBoundParameters[$script:ScriptPublishLocation] = Get-LocationString -LocationUri $ScriptPublishLocation + } + + if($ScriptSourceLocation) + { + $PSBoundParameters[$script:ScriptSourceLocation] = Get-LocationString -LocationUri $ScriptSourceLocation + } + + $PSBoundParameters["Location"] = Get-LocationString -LocationUri $SourceLocation + $null = $PSBoundParameters.Remove("SourceLocation") } - if($providerName) + if($InstallationPolicy -eq "Trusted") { - $PSBoundParameters[$script:PackageManagementProviderParam] = $providerName + $PSBoundParameters['Trusted'] = $true } - - if($PublishLocation) - { - $PSBoundParameters[$script:PublishLocation] = Get-LocationString -LocationUri $PublishLocation - } - - if($ScriptPublishLocation) - { - $PSBoundParameters[$script:ScriptPublishLocation] = Get-LocationString -LocationUri $ScriptPublishLocation - } - - if($ScriptSourceLocation) - { - $PSBoundParameters[$script:ScriptSourceLocation] = Get-LocationString -LocationUri $ScriptSourceLocation - } - - $PSBoundParameters["Provider"] = $script:PSModuleProviderName - - $PSBoundParameters["Location"] = Get-LocationString -LocationUri $SourceLocation - $null = $PSBoundParameters.Remove("SourceLocation") $null = $PSBoundParameters.Remove("InstallationPolicy") + $PSBoundParameters["Provider"] = $script:PSModuleProviderName $PSBoundParameters["MessageResolver"] = $script:PackageManagementMessageResolverScriptBlock $null = PackageManagement\Register-PackageSource @PSBoundParameters @@ -3656,17 +3697,16 @@ function Set-PSRepository HelpUri='http://go.microsoft.com/fwlink/?LinkID=517128')] Param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory=$true, Position=0)] [ValidateNotNullOrEmpty()] [string] $Name, - [Parameter()] + [Parameter(Position=1)] [ValidateNotNullOrEmpty()] [Uri] $SourceLocation, - [Parameter()] [ValidateNotNullOrEmpty()] [Uri] @@ -5925,6 +5965,50 @@ function Set-PSGetSettingsVariable } } +function Set-PSGalleryRepository +{ + [CmdletBinding()] + param([switch]$Trusted) + + $psgalleryLocation = Resolve-Location -Location $Script:PSGallerySourceUri ` + -LocationParameterName 'SourceLocation' ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue + + $scriptSourceLocation = Resolve-Location -Location $Script:PSGalleryScriptSourceUri ` + -LocationParameterName 'ScriptSourceLocation' ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue + if($psgalleryLocation) + { + $result = Ping-Endpoint -Endpoint $Script:PSGalleryPublishUri -AllowAutoRedirect:$false + if ($result.ContainsKey($Script:ResponseUri) -and $result[$Script:ResponseUri]) + { + $script:PSGalleryPublishUri = $result[$Script:ResponseUri] + } + + $repository = Microsoft.PowerShell.Utility\New-Object PSCustomObject -Property ([ordered]@{ + Name = $Script:PSGalleryModuleSource + SourceLocation = $psgalleryLocation + PublishLocation = $Script:PSGalleryPublishUri + ScriptSourceLocation = $scriptSourceLocation + ScriptPublishLocation = $Script:PSGalleryPublishUri + Trusted=$Trusted + Registered=$true + InstallationPolicy = if($Trusted) {'Trusted'} else {'Untrusted'} + PackageManagementProvider=$script:NuGetProviderName + ProviderOptions = @{} + }) + + $repository.PSTypeNames.Insert(0, "Microsoft.PowerShell.Commands.PSRepository") + $script:PSGetModuleSources[$Script:PSGalleryModuleSource] = $repository + + Save-ModuleSources + + return $repository + } +} + function Set-ModuleSourcesVariable { [CmdletBinding()] @@ -5943,39 +6027,7 @@ function Set-ModuleSourcesVariable if(-not $script:PSGetModuleSources.Contains($Script:PSGalleryModuleSource)) { - $isPersistRequired = $true - $psgalleryLocation = Resolve-Location -Location $Script:PSGallerySourceUri ` - -LocationParameterName 'SourceLocation' ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue - - $scriptSourceLocation = Resolve-Location -Location $Script:PSGalleryScriptSourceUri ` - -LocationParameterName 'ScriptSourceLocation' ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue - if($psgalleryLocation) - { - $result = Ping-Endpoint -Endpoint $Script:PSGalleryPublishUri -AllowAutoRedirect:$false - if ($result.ContainsKey($Script:ResponseUri) -and $result[$Script:ResponseUri]) - { - $script:PSGalleryPublishUri = $result[$Script:ResponseUri] - } - $moduleSource = Microsoft.PowerShell.Utility\New-Object PSCustomObject -Property ([ordered]@{ - Name = $Script:PSGalleryModuleSource - SourceLocation = $psgalleryLocation - PublishLocation = $Script:PSGalleryPublishUri - ScriptSourceLocation = $scriptSourceLocation - ScriptPublishLocation = $Script:PSGalleryPublishUri - Trusted=$false - Registered=$true - InstallationPolicy = 'Untrusted' - PackageManagementProvider=$script:NuGetProviderName - ProviderOptions = @{} - }) - - $moduleSource.PSTypeNames.Insert(0, "Microsoft.PowerShell.Commands.PSRepository") - $script:PSGetModuleSources.Add($Script:PSGalleryModuleSource, $moduleSource) - } + $null = Set-PSGalleryRepository } } @@ -7552,7 +7604,7 @@ function Publish-PSArtifactUtility Microsoft.PowerShell.Management\Remove-Item $NupkgPath -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Confirm:$false -WhatIf:$false Microsoft.PowerShell.Management\Remove-Item $NuspecPath -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Confirm:$false -WhatIf:$false - Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath + Microsoft.PowerShell.Management\Set-Content -Value $nuspec -Path $NuspecPath -Force -Confirm:$false -WhatIf:$false # Create .nupkg file $output = & $script:NuGetExePath pack $NuspecPath -OutputDirectory $NugetPackageRoot @@ -7950,15 +8002,14 @@ function Get-DynamicOptions Write-Output -InputObject (New-DynamicOption -Category $category -Name $script:PackageManagementProviderParam -ExpectedType String -IsRequired $false) - Write-Output -InputObject (New-DynamicOption -Category $category ` - -Name $script:PSArtifactType ` - -ExpectedType String ` - -IsRequired $false ` - -PermittedValues @($script:PSArtifactTypeModule,$script:PSArtifactTypeScript, $script:All)) - switch($category) { Package { + Write-Output -InputObject (New-DynamicOption -Category $category ` + -Name $script:PSArtifactType ` + -ExpectedType String ` + -IsRequired $false ` + -PermittedValues @($script:PSArtifactTypeModule,$script:PSArtifactTypeScript, $script:All)) Write-Output -InputObject (New-DynamicOption -Category $category -Name $script:Filter -ExpectedType String -IsRequired $false) Write-Output -InputObject (New-DynamicOption -Category $category -Name $script:Tag -ExpectedType StringArray -IsRequired $false) Write-Output -InputObject (New-DynamicOption -Category $category -Name Includes -ExpectedType StringArray -IsRequired $false -PermittedValues $script:IncludeValidSet) @@ -7975,6 +8026,11 @@ function Get-DynamicOptions Install { + Write-Output -InputObject (New-DynamicOption -Category $category ` + -Name $script:PSArtifactType ` + -ExpectedType String ` + -IsRequired $false ` + -PermittedValues @($script:PSArtifactTypeModule,$script:PSArtifactTypeScript, $script:All)) Write-Output -InputObject (New-DynamicOption -Category $category -Name "Scope" -ExpectedType String -IsRequired $false -PermittedValues @("CurrentUser","AllUsers")) Write-Output -InputObject (New-DynamicOption -Category $category -Name "InstallUpdate" -ExpectedType Switch -IsRequired $false) Write-Output -InputObject (New-DynamicOption -Category $category -Name 'NoPathUpdate' -ExpectedType Switch -IsRequired $false) @@ -8001,6 +8057,11 @@ function Add-PackageSource Set-ModuleSourcesVariable -Force + if(-not $Name) + { + return + } + $IsNewModuleSource = $false $Options = $request.Options @@ -8047,6 +8108,17 @@ function Add-PackageSource $PublishLocation = $null if($Options.ContainsKey($script:PublishLocation)) { + if($Name -eq $Script:PSGalleryModuleSource) + { + $message = $LocalizedData.ParameterIsNotAllowedWithPSGallery -f ('PublishLocation') + ThrowError -ExceptionName "System.ArgumentException" ` + -ExceptionMessage $message ` + -ErrorId 'ParameterIsNotAllowedWithPSGallery' ` + -CallerPSCmdlet $PSCmdlet ` + -ErrorCategory InvalidArgument ` + -ExceptionObject $PublishLocation + } + $PublishLocation = $Options[$script:PublishLocation] if(-not (Microsoft.PowerShell.Management\Test-Path $PublishLocation) -and @@ -8079,6 +8151,17 @@ function Add-PackageSource $ScriptSourceLocation = $null if($Options.ContainsKey($script:ScriptSourceLocation)) { + if($Name -eq $Script:PSGalleryModuleSource) + { + $message = $LocalizedData.ParameterIsNotAllowedWithPSGallery -f ('ScriptSourceLocation') + ThrowError -ExceptionName "System.ArgumentException" ` + -ExceptionMessage $message ` + -ErrorId 'ParameterIsNotAllowedWithPSGallery' ` + -CallerPSCmdlet $PSCmdlet ` + -ErrorCategory InvalidArgument ` + -ExceptionObject $ScriptSourceLocation + } + $ScriptSourceLocation = $Options[$script:ScriptSourceLocation] if(-not (Microsoft.PowerShell.Management\Test-Path $ScriptSourceLocation) -and @@ -8111,6 +8194,17 @@ function Add-PackageSource $ScriptPublishLocation = $null if($Options.ContainsKey($script:ScriptPublishLocation)) { + if($Name -eq $Script:PSGalleryModuleSource) + { + $message = $LocalizedData.ParameterIsNotAllowedWithPSGallery -f ('ScriptPublishLocation') + ThrowError -ExceptionName "System.ArgumentException" ` + -ExceptionMessage $message ` + -ErrorId 'ParameterIsNotAllowedWithPSGallery' ` + -CallerPSCmdlet $PSCmdlet ` + -ErrorCategory InvalidArgument ` + -ExceptionObject $ScriptPublishLocation + } + $ScriptPublishLocation = $Options[$script:ScriptPublishLocation] if(-not (Microsoft.PowerShell.Management\Test-Path $ScriptPublishLocation) -and @@ -8140,10 +8234,53 @@ function Add-PackageSource } } - # Ping and resolve the specified location - $Location = Resolve-Location -Location $Location ` - -LocationParameterName 'Location' ` - -CallerPSCmdlet $PSCmdlet + $currentSourceObject = $null + + # Check if Name is already registered + if($script:PSGetModuleSources.Contains($Name)) + { + $currentSourceObject = $script:PSGetModuleSources[$Name] + } + + # Location is not allowed for PSGallery source + # However OneGet passes Location value during Set-PackageSource cmdlet, + # that's why ensuring that Location value is same as the current SourceLocation + # + if(($Name -eq $Script:PSGalleryModuleSource) -and + $Location -and + ((-not $IsUpdatePackageSource) -or ($currentSourceObject -and $currentSourceObject.SourceLocation -ne $Location))) + { + $message = $LocalizedData.ParameterIsNotAllowedWithPSGallery -f ('Location, NewLocation or SourceLocation') + ThrowError -ExceptionName "System.ArgumentException" ` + -ExceptionMessage $message ` + -ErrorId 'ParameterIsNotAllowedWithPSGallery' ` + -CallerPSCmdlet $PSCmdlet ` + -ErrorCategory InvalidArgument ` + -ExceptionObject $Location + } + + if($Name -eq $Script:PSGalleryModuleSource) + { + # Add or update the PSGallery repostory + $repository = Set-PSGalleryRepository -Trusted:$Trusted + + if($repository) + { + # return the package source object. + Write-Output -InputObject (New-PackageSourceFromModuleSource -ModuleSource $repository) + } + + return + } + + if($Location) + { + # Ping and resolve the specified location + $Location = Resolve-Location -Location $Location ` + -LocationParameterName 'Location' ` + -CallerPSCmdlet $PSCmdlet + } + if(-not $Location) { # Above Resolve-Location function throws an error when it is not able to resolve a location @@ -8204,14 +8341,6 @@ function Add-PackageSource -ErrorCategory InvalidArgument } - $currentSourceObject = $null - - # Check if Name is already registered - if($script:PSGetModuleSources.Contains($Name)) - { - $currentSourceObject = $script:PSGetModuleSources[$Name] - } - if(-not $PublishLocation -and $currentSourceObject -and $currentSourceObject.PublishLocation) { $PublishLocation = $currentSourceObject.PublishLocation @@ -10632,7 +10761,6 @@ function New-SoftwareIdentityFromPackage } $details.Add( "PackageManagementProvider" , $PackageManagementProviderName ) - $details.Add( "Type" , $Type ) if($InstalledLocation) { diff --git a/src/System.Management.Automation/DscSupport/CimDSCParser.cs b/src/System.Management.Automation/DscSupport/CimDSCParser.cs index 84700b601..b3f25f10d 100644 --- a/src/System.Management.Automation/DscSupport/CimDSCParser.cs +++ b/src/System.Management.Automation/DscSupport/CimDSCParser.cs @@ -2723,7 +2723,10 @@ namespace Microsoft.PowerShell.DesiredStateConfiguration.Internal bool missingDefaultConstructor = false; if (type.GetTypeInfo().IsValueType) { - supported = true; + if (mapPrimitiveDotNetTypeToMof.ContainsKey(type)) + { + supported = true; + } } else if (!type.GetTypeInfo().IsAbstract) { diff --git a/src/System.Management.Automation/engine/hostifaces/Connection.cs b/src/System.Management.Automation/engine/hostifaces/Connection.cs index b1bdd7ab9..dd4404360 100644 --- a/src/System.Management.Automation/engine/hostifaces/Connection.cs +++ b/src/System.Management.Automation/engine/hostifaces/Connection.cs @@ -471,7 +471,12 @@ namespace System.Management.Automation.Runspaces /// /// Runspace is based on a named pipe transport. /// - NamedPipeTransport = 0x2 + NamedPipeTransport = 0x2, + + /// + /// Runspace is based on a VM socket transport. + /// + VMSocketTransport = 0x4 } #endregion diff --git a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs index f1d3e8792..f885af03f 100644 --- a/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs +++ b/src/System.Management.Automation/engine/remoting/client/remoterunspace.cs @@ -1000,6 +1000,10 @@ namespace System.Management.Automation { returnCaps |= RunspaceCapability.NamedPipeTransport; } + else if (_connectionInfo is VMConnectionInfo) + { + returnCaps |= RunspaceCapability.VMSocketTransport; + } else { ContainerConnectionInfo containerConnectionInfo = _connectionInfo as ContainerConnectionInfo; diff --git a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs index 3b2884911..ca48ef6f2 100644 --- a/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs +++ b/src/System.Management.Automation/engine/remoting/server/ServerRunspacePoolDriver.cs @@ -879,6 +879,7 @@ namespace System.Management.Automation data.RunspacePoolId, hostInfo, streamOptions, + noInput, addToHistory); return; @@ -1209,6 +1210,7 @@ namespace System.Management.Automation /// RunspacePool Id /// Host Info /// Remote stream options + /// False when input is provided /// Add to history private void StartPowerShellCommandOnPushedRunspace( PowerShell powershell, @@ -1216,6 +1218,7 @@ namespace System.Management.Automation Guid runspacePoolId, HostInfo hostInfo, RemoteStreamOptions streamOptions, + bool noInput, bool addToHistory) { Runspace runspace = this.remoteHost.PushedRunspace; @@ -1223,7 +1226,7 @@ namespace System.Management.Automation ServerPowerShellDriver driver = new ServerPowerShellDriver( powershell, null, - true, + noInput, powershellId, runspacePoolId, this, diff --git a/src/System.Management.Automation/security/nativeMethods.cs b/src/System.Management.Automation/security/nativeMethods.cs index e20e69953..27c769369 100644 --- a/src/System.Management.Automation/security/nativeMethods.cs +++ b/src/System.Management.Automation/security/nativeMethods.cs @@ -2144,33 +2144,8 @@ namespace System.Management.Automation.Security [DllImport("wintrust.dll", CharSet = CharSet.Unicode)] internal static extern IntPtr CryptCATStoreFromHandle( IntPtr hCatalog - ); - - [DllImport("wintrust.dll", CharSet = CharSet.Unicode)] - internal static extern bool CryptCATAdminAcquireContext2( - ref IntPtr phCatAdmin, - IntPtr pgSubsystem, - [MarshalAs(UnmanagedType.LPWStr)] - string pwszHashAlgorithm, - IntPtr pStrongHashPolicy, - DWORD dwFlags - ); - - [DllImport("wintrust.dll", CharSet = CharSet.Unicode)] - internal static extern bool CryptCATAdminReleaseContext( - IntPtr phCatAdmin, - DWORD dwFlags - ); - - [DllImport("wintrust.dll", CharSet = CharSet.Unicode)] - internal static extern bool CryptCATAdminCalcHashFromFileHandle2( - IntPtr hCatAdmin, - SafeFileHandle hFile, - [In, Out] ref DWORD pcbHash, - IntPtr pbHash, - DWORD dwFlags - ); - + ); + [DllImport("wintrust.dll", CharSet = CharSet.Unicode)] internal static extern IntPtr CryptCATEnumerateMember( IntPtr hCatalog, From eb9daf0238e764cce3a521da8ed875b4dadc3534 Mon Sep 17 00:00:00 2001 From: George Fleming Date: Wed, 13 Apr 2016 11:42:59 -0700 Subject: [PATCH 21/36] Host code to enable PSReadLine, and remove checking of .NET Framework version if CORECLR --- .../main.cs | 84 +++++++++++++++---- .../engine/Modules/ModuleCmdletBase.cs | 4 +- 2 files changed, 71 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/main.cs b/src/Microsoft.PowerShell.CoreConsoleHost/main.cs index 13daf43fc..ba3f0be18 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/main.cs +++ b/src/Microsoft.PowerShell.CoreConsoleHost/main.cs @@ -9,6 +9,7 @@ namespace Microsoft.PowerShell.CoreConsoleHost using System.Text; using System.IO; using System.Runtime.InteropServices; + using System.Linq; using PowerShell = System.Management.Automation.PowerShell; public static class Program @@ -562,27 +563,78 @@ OPTIONS this.myHost.UI.Write(prompt); - ConsoleReadLine.ReadResult result = consoleReadLine.Read(false, initialCommand); - - switch(result.state) + string input; + if (TryInvokeUserDefinedReadLine(out input, true)) { - case ConsoleReadLine.ReadResult.State.Abort: - incompleteLine = false; - partialLine = string.Empty; - initialCommand = String.Empty; - break; - case ConsoleReadLine.ReadResult.State.Redraw: - initialCommand = result.command; - break; - case ConsoleReadLine.ReadResult.State.Complete: - default: - this.Execute(result.command); - initialCommand = String.Empty; - break; + this.Execute(input); + } + else + { + ConsoleReadLine.ReadResult result = consoleReadLine.Read(false, initialCommand); + + switch(result.state) + { + case ConsoleReadLine.ReadResult.State.Abort: + incompleteLine = false; + partialLine = string.Empty; + initialCommand = String.Empty; + break; + case ConsoleReadLine.ReadResult.State.Redraw: + initialCommand = result.command; + break; + case ConsoleReadLine.ReadResult.State.Complete: + default: + this.Execute(result.command); + initialCommand = String.Empty; + break; + } } } } + /// + /// Helper function to test if PSReadLine or another alternate ReadLine has been loaded + /// + const string CustomReadlineCommand = "PSConsoleHostReadLine"; + private bool TryInvokeUserDefinedReadLine(out string input, bool useUserDefinedCustomReadLine) + { + if (useUserDefinedCustomReadLine) + { + var runspace = this.myHost.Runspace; + if (runspace != null + && runspace.ExecutionContext.EngineIntrinsics.InvokeCommand.GetCommands(CustomReadlineCommand, CommandTypes.Function | CommandTypes.Cmdlet, nameIsPattern: false).Any()) + { + try + { + PowerShell ps; + if ((runspace.ExecutionContext.EngineHostInterface.NestedPromptCount > 0) && (Runspace.DefaultRunspace != null)) + { + ps = PowerShell.Create(RunspaceMode.CurrentRunspace); + } + else + { + ps = PowerShell.Create(); + ps.Runspace = runspace; + } + + var result = ps.AddCommand(CustomReadlineCommand).Invoke(); + if (result.Count == 1) + { + input = PSObject.Base(result[0]) as string; + return true; + } + } + catch (Exception e) + { + CommandProcessorBase.CheckForSevereException(e); + } + } + } + + input = null; + return false; + } + /// /// Method to handle the Debugger DebuggerStop event. /// diff --git a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs index 206d95a18..ddac1ac97 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs @@ -2010,7 +2010,8 @@ namespace Microsoft.PowerShell.Commands } // Test the required .NET Framework version - Version requestedDotNetFrameworkVersion; + Version requestedDotNetFrameworkVersion = new Version (0, 0, 0, 0); +#if !CORECLR if ( !GetScalarFromData(data, moduleManifestPath, "DotNetFrameworkVersion", manifestProcessingFlags, out requestedDotNetFrameworkVersion)) @@ -2044,6 +2045,7 @@ namespace Microsoft.PowerShell.Commands WriteVerbose(cannotDetectNetFrameworkVersionMessage); } } +#endif // HelpInfo URI string helpInfoUri = null; From e210cf14c0ddff212e0fa783072e76c7619d153a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 14:57:20 -0700 Subject: [PATCH 22/36] Bump Pester with fixes --- src/Modules/Pester | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/Pester b/src/Modules/Pester index f23641488..51f1597ea 160000 --- a/src/Modules/Pester +++ b/src/Modules/Pester @@ -1 +1 @@ -Subproject commit f23641488f8d7bf8630ca3496e61562aa3a64009 +Subproject commit 51f1597eae5e517ce65fed293c9d6e245b1a9d60 From 9fc0dd451b74d133e880ab56598381eb83ff81c1 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 18:56:23 -0700 Subject: [PATCH 23/36] Import-Module PowerShellGitHubDev in build.sh Make it Do What I Mean. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index f205aeef1..267a6966c 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ if hash powershell 2>/dev/null; then echo 'Continuing with `powershell -c Start-PSBuild`' - powershell -c Start-PSBuild + powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild" else echo 'No `powershell`, see docs/building/linux.md or osx.md to build PowerShell!' fi From a5dfe80d9aafdd68737bb7c4e224f75f2ee38f47 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:03:41 -0700 Subject: [PATCH 24/36] Download and install packages for Ubuntu and OS X This both downloads the v0.3.0 release for the current platform and now also installs it (requiring `sudo`). Should probably rename. --- download.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/download.sh b/download.sh index 7b2637d03..806f2cbe1 100755 --- a/download.sh +++ b/download.sh @@ -2,13 +2,39 @@ [[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; } +# Set OS specific asset ID and package name +case "$OSTYPE" in + linux*) + asset='1536045' + package='powershell_0.3.0-1_amd64.deb' + ;; + darwin*) + asset='1536063' + package='powershell-0.3.0.pkg' + ;; + *) + exit 2 >&2 "$OSTYPE not supported!" + ;; +esac + # Authorizes with read-only access to GitHub API # Retrieves URL of v0.3.0 release asset -# Downloads asset to powershell.deb curl -s -i \ -H "Authorization: token $GITHUB_TOKEN " \ -H 'Accept: application/octet-stream' \ - 'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1536045' | + "https://api.github.com/repos/PowerShell/PowerShell/releases/assets/$asset" | grep location | sed 's/location: //g' | - wget -i - -O powershell.deb + wget -i - -O $package + +# Installs PowerShell package +case "$OSTYPE" in + linux*) + sudo dpkg -i ./$package + ;; + darwin*) + sudo installer -pkg ./$package -target / + ;; +esac + +echo "Congratulations! PowerShell is now installed." From d94a040229bc84feaff5ed07ee8d0b51620f5ff7 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:11:38 -0700 Subject: [PATCH 25/36] Add Start-PSBootstrap function Installs Open PowerShell build dependenices on all platform; deprecates `bootstrap.sh`. --- PowerShellGitHubDev.psm1 | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 3cc1a739d..d0c2f8a89 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -261,6 +261,56 @@ function Start-PSxUnit { } } + +function Start-PSBootstrap { + [CmdletBinding()]param() + + Write-Host "Installing Open PowerShell build dependencies" + + if ($IsLinux) { + precheck 'curl' "Bootstrap dependency 'curl' not found in PATH, please install!" > $null + precheck 'apt-get' "Bootstrap dependency 'apt-get' not found in PATH, this only supports Ubuntu 14.04!" > $null + + # Setup LLVM feed + curl -s http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list + sudo apt-get update -qq + + # Install ours and .NET's dependencies + sudo apt-get install -y wget make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 + + # Install .NET CLI packages + Remove-Item dotnet*.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-host-ubuntu-x64.latest.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-sharedframework-ubuntu-x64.latest.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-sdk-ubuntu-x64.latest.deb + + } elseif ($IsOSX) { + precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/" + + # Install ours and .NET's dependencies + brew install cmake wget openssl + + # Install .NET CLI packages + Remove-Item dotnet*.pkg + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg + sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target / + } elseif ($IsWindows -And -Not $IsCore) { + Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 + ./install.ps1 + $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } else { + Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)" + } +} + + function Start-PSPackage { [CmdletBinding()]param( # PowerShell packages use Semantic Versioning http://semver.org/ From a031dd909560f4cc7526855745c64861b14986bc Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:12:30 -0700 Subject: [PATCH 26/36] Remove deprecated bootstrap.sh --- bootstrap.sh | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 599321730..000000000 --- a/bootstrap.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -echo "Installing build dependencies" - -curl http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - -echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list -sudo apt-get update -qq - -sudo apt-get install -y wget make g++ cmake \ - libc6 libgcc1 libstdc++6 \ - libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-host-ubuntu-x64.latest.deb - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-sharedframework-ubuntu-x64.latest.deb - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-sdk-ubuntu-x64.latest.deb From 995eaf4c0fe7d5eefdfe4d977a80f684b50e3bf1 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:13:03 -0700 Subject: [PATCH 27/36] Update Travis to use Start-PSBootstrap --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cc937b31..57d9e5e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,9 @@ git: before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest - - ./bootstrap.sh - ./download.sh - - sudo dpkg -i ./powershell.deb script: - - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild; Start-PSPester" + - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBootstrap; Start-PSBuild; Start-PSPester" notifications: slack: secure: sKYd4n61+ZFzGZuWGUl8V1kN0NM16wRVOFVlNhlFCwnkrEsKROb++EvXf5uwnKuzxkhEjvPWO+UFgeshQDoR93y4s5YLfhC5JupK4nUzjPzWs208KTrh8u/x9MY8X6Ojxi85EEAiku5GzMoMlkucSStZUYwbIfnelzqdw8uoRwmm2MW4XCPwsuEuDUVghyiva0Mdx1G6MopCrK8T96WywJXT3chhfZQgVt+sQCBt9g+2kjDaObKrzG0P07IVK43ZpDgnu6AoxlyBzIx9mJH2Oa/tki3/kTO72Wcp3ps3qvmiStADamzVKR9p1VlWCLWAd6VOehxuByCGEyujpzk135Wud2DZYO+8LD6inZVhFe3Wt5pCU9BDXZppiATfMCqgXEH7nK54pEn79yHcjthRJ2+Z9ot7As2fu3RSBmTAi8nRP0fxRyX/jctR3S6P0qt0y1ynx9nzBfhmhPQW0PMVazWS/nruQIvK/3iiYXjZxM5bBwIvabmwV00EYeTdbL6ufXWNgQcG1ZWkDsi2I3vst/ytUbHwaFYg83bXWpxg9DCzJeWLVUvE5/3NfBxRAuCTot/fgTEA9IYScvrlL7Q/bT0cOt0vEM98MPf1UO+WP85uxhsRgHtwDEo+jMaL6ZFkPhlV6mmmED4NdY2//a571cLNXdnuMAze5O3TWGBG53g= From 70f921e824c3287f76753c054f404df06c5ad68f Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:21:02 -0700 Subject: [PATCH 28/36] Update AppVeyor to use Start-PSBootstrap --- appveyor.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9b494ce18..1d4b21f7d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,13 +18,10 @@ install: - ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester - - ps: Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 - - ps: ./install.ps1 -version 1.0.0-beta-002198 + - ps: Import-Module .\PowerShellGitHubDev.psm1; Start-PSBootstrap build_script: - ps: | - $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" - dotnet --version Import-Module .\PowerShellGitHubDev.psm1 Start-PSBuild -Publish Start-PSBuild -FullCLR From 7538951dfa72da5020119d8754103fe1bc44e63e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:36:15 -0700 Subject: [PATCH 29/36] Install package dependencies in download.sh --- PowerShellGitHubDev.psm1 | 2 +- download.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index d0c2f8a89..483da716a 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -277,7 +277,7 @@ function Start-PSBootstrap { sudo apt-get update -qq # Install ours and .NET's dependencies - sudo apt-get install -y wget make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 + sudo apt-get install -y make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 # Install .NET CLI packages Remove-Item dotnet*.deb diff --git a/download.sh b/download.sh index 806f2cbe1..9c19dc600 100755 --- a/download.sh +++ b/download.sh @@ -7,6 +7,8 @@ case "$OSTYPE" in linux*) asset='1536045' package='powershell_0.3.0-1_amd64.deb' + # Install curl and wget to download package + sudo apt-get install -y curl wget ;; darwin*) asset='1536063' @@ -30,6 +32,8 @@ curl -s -i \ # Installs PowerShell package case "$OSTYPE" in linux*) + # Install dependencies + sudo apt-get install -y libunwind8 libicu52 sudo dpkg -i ./$package ;; darwin*) From aa1af214bc29521cfd20c205f089dc9b4dc817b1 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:54:52 -0700 Subject: [PATCH 30/36] Add OS X to Travis CI matrix --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 57d9e5e3d..06e25765a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ sudo: required dist: trusty git: submodules: false +os: + - linux + - osx before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest From 38041211b53634a03ddbe41570438b407b046ff5 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:56:03 -0700 Subject: [PATCH 31/36] Remove deprecated omibuild and psrp scripts --- omibuild.sh | 13 ------------- psrp.sh | 2 -- 2 files changed, 15 deletions(-) delete mode 100755 omibuild.sh delete mode 100755 psrp.sh diff --git a/omibuild.sh b/omibuild.sh deleted file mode 100755 index 756b995dc..000000000 --- a/omibuild.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Build OMI -pushd src/omi/Unix -./configure --dev -make -j -popd - -# Build the OMI Provider -pushd src/omi-provider -cmake -DCMAKE_BUILD_TYPE=Debug . -make -j -popd diff --git a/psrp.sh b/psrp.sh deleted file mode 100755 index eb42adc06..000000000 --- a/psrp.sh +++ /dev/null @@ -1,2 +0,0 @@ -export CORE_ROOT=$(pwd)/bin -sudo -E ./src/omi/Unix/output/bin/omiserver -l --loglevel 2 From 14837da6640d7170e8f2f1cf1346325af0ceca64 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:21:23 -0700 Subject: [PATCH 32/36] Update documentation for Start-PSBootstrap Also moved Git setup section first. --- docs/building/linux.md | 77 +++++++++++++++++++++-------------- docs/building/osx.md | 20 +++------ docs/building/windows-core.md | 30 +++++++++----- 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/docs/building/linux.md b/docs/building/linux.md index 5e4076f7e..68fbf0bbe 100644 --- a/docs/building/linux.md +++ b/docs/building/linux.md @@ -10,6 +10,16 @@ Environment These instructions are written assuming the Ubuntu 14.04 LTS, since that's the distro the team uses. +Git Setup +--------- + +Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and +[Contributing Guidelines](../../CONTRIBUTING.md). + +This guide assumes that you have recursively cloned the PowerShell +repository and `cd`ed into it. + Toolchain Setup --------------- @@ -26,16 +36,46 @@ Unfortunately, the `apt-get` feed for `dotnet` has been deprecated, and the latest version is only distributed in the form of three separate packages, which require manual dependency resolution. -**To ease this process, just run `./bootstrap.sh` and enter password -for `sudo` when prompted.** +Installing the toolchain is as easy as running `Start-PSBootstrap` in +PowerShell. Of course, this requires a self-hosted copy of PowerShell +on Linux. -The [bootstrap script](../../bootstrap.sh) does the following: +Fortunately, this is as easy as downloading and installing the +package. Unfortunately, while the repository is still private, the +package cannot be downloaded as simply as with `wget`. We have a +script that wraps the GitHub API and uses a personal access token to +authorize in order to obtain the package. + +The `./download.sh` script will also install the PowerShell package. + +> You can alternativelly download via a browser, upload it to your +> box via some other method, and manually install it. + +In Bash: + +```sh +GITHUB_TOKEN= ./download.sh +powershell +``` + +You should now be in a `powershell` console host that is installed +separately from any development copy you're about to build. Just +import our module, bootsrap the dependencies, and build! + +In PowerShell: + +```powershell +Import-Module ./PowerShellGitHubDev.psm1 +Start-PSBootstrap +``` + +The `Start-PSBootstrap` function does the following: - Adds the LLVM package feed - Installs our dependencies combined with the dependencies of the .NET CLI toolchain via `apt-get` - Installs the .NET CLI host, shared framework, and SDK by downloading - the three `.deb` packages to `/tmp` and using `dpkg -i` + the three `.deb` packages and using `dpkg -i` [dotnet-cli]: https://github.com/dotnet/cli#new-to-net-cli [CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html @@ -55,36 +95,13 @@ uninstall prior any prior versions. [cli-docs]: https://dotnet.github.io/getting-started/ -Git Setup ---------- - -Using Git requires it to be setup correctly; refer to the -[README](../../README.md) and -[Contributing Guidelines](../../CONTRIBUTING.md). - Build using our module ====================== We maintain a [PowerShell module](../../PowerShellGitHubDev.psm1) with the function `Start-PSBuild` to build PowerShell. Since this is -PowerShell code, it requires self-hosting. Fortunately, this is as -easy as downloading and installing the package. Unfortunately, while -the repository is still private, the package cannot be downloaded as -simply as with `wget`. We have a script that wraps the GitHub API and -uses a personal access token to authorize and obtain the package. - -> You can alternativelly download via a browser and upload it to your -> box via some other method. - -```sh -GITHUB_TOKEN= ./download.sh -sudo dpkg -i ./powershell.deb -powershell -``` - -You should now be in a `powershell` console host that is installed -separately from any development copy you're about to build. Just -import our module and build! +PowerShell code, it requires self-hosting. If you have followed the +toolchain setup section above, you should have `powershell` installed. > If you cannot or do not want to self-host, `Start-PSBuild` is just a > convenience; you can execute each step of the build process yourself @@ -99,8 +116,6 @@ Congratulations! If everything went right, PowerShell is now built. The `Start-PSBuild` script will output the location of the executable: `./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netstandardapp1.5/ubuntu.14.04-x64/powershell`. -> Note that the `./build.sh` script is deprecated and will be removed - You can run our cross-platform Pester tests with `Start-PSPester`, and our xUnit tests with `Start-PSxUnit`. diff --git a/docs/building/osx.md b/docs/building/osx.md index de8b97737..56c4c04a7 100644 --- a/docs/building/osx.md +++ b/docs/building/osx.md @@ -11,22 +11,14 @@ Environment =========== You will want [Homebrew](http://brew.sh/), the missing package manager -for OS X. Once installed, use `brew` to install the following -dependencies. +for OS X. Once installed, follow the same instructions to download and +install a self-hosted copy of PowerShell on your OS X machine, and use +`Start-PSBootstrap` to install the dependencies. -```sh -brew install openssl cmake wget -``` +The `Start-PSBootstrap` function does the following: -Instead of using Linux `./bootstrap.sh` to install .NET CLI's Ubuntu -packages, you will want to use the official PKG installer for OS X. - -```sh -wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg -open ./dotnet-dev-osx-x64.latest.pkg -``` - -Then follow the wizard's instructions to complete installation. +- Uses `brew` to install CMake, OpenSSL, and GNU WGet +- Downloads and installs the latest .NET CLI package Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 31def61ac..288ef7a61 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -11,16 +11,33 @@ Environment These instructions are tested on Windows 10 and Windows Server 2012 R2, though they should work anywhere the dependencies work. +Git Setup +--------- + +Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and +[Contributing Guidelines](../../CONTRIBUTING.md). + +This guide assumes that you have recursively cloned the PowerShell +repository and `cd`ed into it. + .NET CLI -------- We use the [.NET Command Line Interface][dotnet-cli] (`dotnet`) to -build PowerShell. The following script will install `dotnet` and add -it to your PowerShell session's path: +build PowerShell. The `Start-PSBootstrap` function will automatically +install it and add it to your path: + +```powershell +Import-Module ./PowerShellGitHubDev.psm1 +Start-PSBootstrap +``` + +The `Start-PSBootstrap` function itself does exactly this: ```powershell Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 -./install.ps1 -version 1.0.0-beta-002198 +./install.ps1 $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" ``` @@ -43,13 +60,6 @@ CLI can cause odd failures when running. Please check your version. [redist-2012]: https://www.microsoft.com/en-us/download/confirmation.aspx?id=30679 [redist-2015]: https://www.microsoft.com/en-us/download/details.aspx?id=48145 -Git Setup ---------- - -Using Git requires it to be setup correctly; refer to the -[README](../../README.md) and -[Contributing Guidelines](../../CONTRIBUTING.md). - Build using our module ====================== From beccce54a831ad5a4f270bc189ea55db54d261d2 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:30:00 -0700 Subject: [PATCH 33/36] Use matrix.include and fix OS X PATH --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06e25765a..5977179f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ language: cpp -sudo: required -dist: trusty +matrix: + include: + - os: linux + dist: trusty + sudo: required + - os: osx + language: generic + env: PATH+=/usr/local/share/dotnet git: submodules: false -os: - - linux - - osx before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest From 3d21d5da934fe9768a45a9487401d209602c6630 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:41:50 -0700 Subject: [PATCH 34/36] Deal with paths magically in Start-PSBuild --- PowerShellGitHubDev.psm1 | 16 ++++++++++++++-- docs/building/osx.md | 5 +++++ docs/building/windows-core.md | 1 - 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 483da716a..e8b6d8244 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -23,6 +23,7 @@ try { function Start-PSBuild { [CmdletBinding(DefaultParameterSetName='CoreCLR')] param( + [switch]$NoPath, [switch]$Restore, [Parameter(ParameterSetName='CoreCLR')] @@ -57,6 +58,15 @@ function Start-PSBuild { $FullCLR = $true } + if (-not $NoPath) { + Write-Verbose "Appending probable .NET CLI tool path" + if ($IsWindows) { + $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } elseif ($IsOSX) { + $env:PATH += ":/usr/local/share/dotnet" + } + } + # verify we have all tools in place to do the build $precheck = precheck 'dotnet' "Build dependency 'dotnet' not found in PATH! See: https://dotnet.github.io/getting-started/" if ($FullCLR) { @@ -65,7 +75,8 @@ function Start-PSBuild { # msbuild is needed to build powershell.exe # msbuild is part of .NET Framework, we can try to get it from well-known location. - if (-not (Get-Command -Name msbuild -ErrorAction Ignore)) { + if (-nopt $NoPath -and -not (Get-Command -Name msbuild -ErrorAction Ignore)) { + Write-Verbose "Appending probable Visual C++ tools path" $env:path += ";${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319" } @@ -301,10 +312,11 @@ function Start-PSBootstrap { Remove-Item dotnet*.pkg wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target / + } elseif ($IsWindows -And -Not $IsCore) { Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 - $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } else { Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)" } diff --git a/docs/building/osx.md b/docs/building/osx.md index 56c4c04a7..e08ba59b8 100644 --- a/docs/building/osx.md +++ b/docs/building/osx.md @@ -19,6 +19,11 @@ The `Start-PSBootstrap` function does the following: - Uses `brew` to install CMake, OpenSSL, and GNU WGet - Downloads and installs the latest .NET CLI package +- Adds `/usr/local/share/dotnet` to the process path + +Please heed that last step. You may want to add the .NET CLI tool +location to your path more permanently by adding it to your shell's +profile. Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 288ef7a61..33c73211d 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -38,7 +38,6 @@ The `Start-PSBootstrap` function itself does exactly this: ```powershell Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 -$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" ``` If you have any problems installing `dotnet`, please see their From ed62e5c6e62ec65acfbb0f241ab240e28e674a2a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 19:00:18 -0700 Subject: [PATCH 35/36] Add OS X 10.9 runtime --- PowerShellGitHubDev.psm1 | 1 + src/Microsoft.PowerShell.CoreConsoleHost/project.json | 1 + 2 files changed, 2 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index e8b6d8244..1b81a2ff9 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -36,6 +36,7 @@ function Start-PSBuild { "win7-x64", "win81-x64", "win10-x64", + "osx.10.9-x64", "osx.10.10-x64", "osx.10.11-x64")] [Parameter(ParameterSetName='CoreCLR')] diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/project.json b/src/Microsoft.PowerShell.CoreConsoleHost/project.json index 22edf8af0..af65a00ad 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/project.json +++ b/src/Microsoft.PowerShell.CoreConsoleHost/project.json @@ -37,6 +37,7 @@ "win7-x64": { }, "win81-x64": { }, "win10-x64": { }, + "osx.10.9-x64": { }, "osx.10.10-x64": { }, "osx.10.11-x64": { } } From b2bc4183fe3cd0341e1054e203d9f486a616d14a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 19:09:39 -0700 Subject: [PATCH 36/36] Disable Travis CI OS X support Unfortunately, Travis CI's OS X machines are 10.9.5, per https://docs.travis-ci.com/user/osx-ci-environment/#CI-environment-OS. While NuGet supports the RID, .NET Core does not yet publish 10.9 packages, resulting in a build failure we can't do anything about. I've asked for best-effort support by providing runtime packages for 10.9 in dotnet/corefx#7731. Revert "Add OS X 10.9 runtime" This reverts commit 19ab0de84cec37bb90443df14d4e69f10c41e1b1. --- .travis.yml | 6 +++--- PowerShellGitHubDev.psm1 | 1 - src/Microsoft.PowerShell.CoreConsoleHost/project.json | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5977179f2..90817fd1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ matrix: - os: linux dist: trusty sudo: required - - os: osx - language: generic - env: PATH+=/usr/local/share/dotnet + # - os: osx + # language: generic + # env: PATH+=/usr/local/share/dotnet git: submodules: false before_install: diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 1b81a2ff9..e8b6d8244 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -36,7 +36,6 @@ function Start-PSBuild { "win7-x64", "win81-x64", "win10-x64", - "osx.10.9-x64", "osx.10.10-x64", "osx.10.11-x64")] [Parameter(ParameterSetName='CoreCLR')] diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/project.json b/src/Microsoft.PowerShell.CoreConsoleHost/project.json index af65a00ad..22edf8af0 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/project.json +++ b/src/Microsoft.PowerShell.CoreConsoleHost/project.json @@ -37,7 +37,6 @@ "win7-x64": { }, "win81-x64": { }, "win10-x64": { }, - "osx.10.9-x64": { }, "osx.10.10-x64": { }, "osx.10.11-x64": { } }