From a1a722c4a133be6e6909ccd0607af110e3531ba8 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 9 May 2016 14:40:52 -0700 Subject: [PATCH] Add powershell project shim The `src/powershell` project builds Core PowerShell as a .NET CLI app, with a dependency on `Microsoft.PowerShell.ConsoleHost`, so that the latter can remain a library. --- PowerShellGitHubDev.psm1 | 7 ++- .../project.json | 21 ++------- .../AssemblyInfo.cs | 2 +- src/libpsl-native/CMakeLists.txt | 2 +- .../.gitignore | 0 src/powershell/project.json | 45 +++++++++++++++++++ 6 files changed, 57 insertions(+), 20 deletions(-) rename src/{Microsoft.PowerShell.ConsoleHost => powershell}/.gitignore (100%) create mode 100644 src/powershell/project.json diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index b3af37ea9d..5d4cab947e 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -221,7 +221,12 @@ function New-PSOptions { [switch]$FullCLR ) - $Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost" + if ($FullCLR) { + $Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost" + } else { + $Top = "$PSScriptRoot/src/powershell" + } + Write-Verbose "Top project directory is $Top" if (-not $Configuration) { $Configuration = if ($IsLinux -or $IsOSX) { diff --git a/src/Microsoft.PowerShell.ConsoleHost/project.json b/src/Microsoft.PowerShell.ConsoleHost/project.json index db6a61beb7..babf345d0c 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/project.json +++ b/src/Microsoft.PowerShell.ConsoleHost/project.json @@ -1,13 +1,12 @@ { - "name": "powershell", + "name": "Microsoft.PowerShell.ConsoleHost", "version": "1.0.0-*", "description": "PowerShell Host", "authors": [ "sevoroby", "andschwa" ], "compilationOptions": { "warningsAsErrors": true, - "allowUnsafe": true, - "emitEntryPoint": true + "allowUnsafe": true }, "dependencies": { @@ -19,19 +18,16 @@ "content": [ "Modules", "../Modules", - "*_profile.ps1", - "*.so", - "*.dylib" + "powershell.exe" ], "frameworks": { - "netcoreapp1.0": { + "netstandard1.5": { "imports": [ "dnxcore50", "portable-net45+win8" ], "compilationOptions": { "define": [ "CORECLR", "OPEN" ] }, "dependencies": { - "Microsoft.NETCore.App": "1.0.0-rc2-3002668", "Newtonsoft.Json": "8.0.2", "System.Xml.XDocument": "4.0.11-rc2-24103", "System.IO.MemoryMappedFiles": "4.0.0-rc2-24103" @@ -41,15 +37,6 @@ } }, - "runtimes": { - "ubuntu.14.04-x64": { }, - "centos.7.1-x64": { }, - "win7-x64": { }, - "win81-x64": { }, - "win10-x64": { }, - "osx.10.11-x64": { } - }, - "compile": [ "../windows-build/gen/Microsoft.PowerShell.ConsoleHost/*.cs" ] diff --git a/src/System.Management.Automation/AssemblyInfo.cs b/src/System.Management.Automation/AssemblyInfo.cs index 609774f13e..cfe4a9105c 100644 --- a/src/System.Management.Automation/AssemblyInfo.cs +++ b/src/System.Management.Automation/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Resources; [assembly:InternalsVisibleTo("Microsoft.PowerShell.Commands.Utility")] [assembly:InternalsVisibleTo("Microsoft.PowerShell.Security")] [assembly:InternalsVisibleTo("Microsoft.PowerShell.CoreCLR.AssemblyLoadContext")] -[assembly:InternalsVisibleTo("powershell")] +[assembly:InternalsVisibleTo("Microsoft.PowerShell.ConsoleHost")] [assembly:InternalsVisibleTo("powershell-tests")] #else diff --git a/src/libpsl-native/CMakeLists.txt b/src/libpsl-native/CMakeLists.txt index b4665909b1..3e77b46eed 100644 --- a/src/libpsl-native/CMakeLists.txt +++ b/src/libpsl-native/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.4) project(PSL-NATIVE) add_compile_options(-std=c++11 -Wall -Werror) -set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/../Microsoft.PowerShell.ConsoleHost") +set(LIBRARY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/../powershell") # test in BUILD_DIR enable_testing() diff --git a/src/Microsoft.PowerShell.ConsoleHost/.gitignore b/src/powershell/.gitignore similarity index 100% rename from src/Microsoft.PowerShell.ConsoleHost/.gitignore rename to src/powershell/.gitignore diff --git a/src/powershell/project.json b/src/powershell/project.json new file mode 100644 index 0000000000..08e061986e --- /dev/null +++ b/src/powershell/project.json @@ -0,0 +1,45 @@ +{ + "name": "powershell", + "version": "1.0.0-*", + "description": ".NET CLI PowerShell app", + "authors": [ "andschwa" ], + + "compilationOptions": { + "warningsAsErrors": true, + "allowUnsafe": true, + "emitEntryPoint": true + }, + + "dependencies": { + "Microsoft.PowerShell.ConsoleHost": "1.0.0-*" + }, + + "content": [ + "Modules", + "../Modules", + "*_profile.ps1", + "*.so", + "*.dylib" + ], + + "frameworks": { + "netcoreapp1.0": { + "imports": [ "dnxcore50", "portable-net45+win8" ], + "compilationOptions": { + "define": [ "CORECLR" ] + }, + "dependencies": { + "Microsoft.NETCore.App": "1.0.0-rc2-3002668" + } + } + }, + + "runtimes": { + "ubuntu.14.04-x64": { }, + "centos.7.1-x64": { }, + "win7-x64": { }, + "win81-x64": { }, + "win10-x64": { }, + "osx.10.11-x64": { } + } +}