diff --git a/build.psm1 b/build.psm1 index d01aaeb40b..70eb5d9c5f 100644 --- a/build.psm1 +++ b/build.psm1 @@ -180,7 +180,7 @@ function Start-PSBuild { # setup arguments $Arguments = @() - if ($Publish) { + if ($Publish -or $FullCLR) { $Arguments += "publish" } else { $Arguments += "build" @@ -368,7 +368,7 @@ function New-PSOptions { } if ($FullCLR) { - $Top = "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost" + $Top = "$PSScriptRoot/src/powershell-win-full" } else { if ($Configuration -eq 'Linux') { @@ -376,7 +376,7 @@ function New-PSOptions { } else { - $Top = "$PSScriptRoot/src/powershell-windows" + $Top = "$PSScriptRoot/src/powershell-win-core" } } Write-Verbose "Top project directory is $Top" @@ -415,15 +415,10 @@ function New-PSOptions { if ($Output) { $Output = Join-Path $PSScriptRoot $Output } else { - $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework) - - # FullCLR only builds a library, so there is no runtime component - if (-not $FullCLR) { - $Output = [IO.Path]::Combine($Output, $Runtime) - } + $Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime) # Publish injects the publish directory - if ($Publish) { + if ($Publish -or $FullCLR) { $Output = [IO.Path]::Combine($Output, "publish") } @@ -770,11 +765,11 @@ function Publish-NuGetFeed 'Microsoft.PowerShell.Commands.Management', 'Microsoft.PowerShell.Commands.Utility', 'Microsoft.PowerShell.ConsoleHost', -'Microsoft.PowerShell.PSReadLine', 'Microsoft.PowerShell.Security', 'System.Management.Automation', 'Microsoft.PowerShell.CoreCLR.AssemblyLoadContext', -'Microsoft.PowerShell.CoreCLR.Eventing' +'Microsoft.PowerShell.CoreCLR.Eventing', +'Microsoft.PowerShell.SDK' ) | % { if ($VersionSuffix) { @@ -1090,8 +1085,7 @@ function Start-TypeGen Push-Location "$PSScriptRoot/src/TypeCatalogParser" try { - $topPath = if ($IsWindows) {'../powershell-windows'} else {'../powershell-unix'} - dotnet run $topPath + dotnet run } finally { diff --git a/docs/building/internals.md b/docs/building/internals.md index 79238b38f6..3480a97215 100644 --- a/docs/building/internals.md +++ b/docs/building/internals.md @@ -13,14 +13,14 @@ Top directory We are calling `dotnet` tool build for `$Top` directory -- `src\powershell-windows` for CoreCLR on Windows. +- `src\powershell-win-core` for CoreCLR on Windows. - `src\powershell-unix` for CoreCLR on Linux and OS X. -- `src\Microsoft.PowerShell.ConsoleHost` for FullCLR builds (Windows only) +- `src\powershell-win-full` for FullCLR builds (Windows only) ### Dummy dependencies We use dummy dependencies between project.json files to leverage `dotnet` build functionality. -For example, `src\powershell-windows\project.json` has dependency on `Microsoft.PowerShell.PSReadLine`, +For example, `src\powershell-win-core\project.json` has dependency on `Microsoft.PowerShell.PSReadLine`, but in reality, there is no build dependency. Dummy dependencies allows us to build just `$Top` folder, instead of building several folders. @@ -28,7 +28,7 @@ Dummy dependencies allows us to build just `$Top` folder, instead of building se ### Dummy dependencies rules * If assembly is part of FullCLR build, -it should be listed as a dependency for FullCLR $Top folder (src\Microsoft.PowerShell.ConsoleHost) +it should be listed as a dependency for FullCLR $Top folder (src\powershell-win-full) * If assembly is part of CoreCLR build, -it should be listed as a dependency for $Top folder (src\powershell-unix or src\powershell-windows) +it should be listed as a dependency for $Top folder (src\powershell-unix or src\powershell-win-core) diff --git a/src/Microsoft.PowerShell.ConsoleHost/project.json b/src/Microsoft.PowerShell.ConsoleHost/project.json index 774da06990..879fc82fcb 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/project.json +++ b/src/Microsoft.PowerShell.ConsoleHost/project.json @@ -10,50 +10,7 @@ "delaySign": true, "publicSign": false, "warningsAsErrors": true, - "allowUnsafe": true, - "copyToOutput": { - "mappings": { - "Modules/" : { - "include": [ - "../Modules/Windows-Full", - "../Modules/Windows-Core+Full", - "../Modules/Shared" - ], - "exclude": [ - "../Modules/Shared/Pester/.git*" - ] - } - }, - "include" : [ - "powershell.exe", - "powershell.pdb", - "pwrshplugin.dll", - "pwrshplugin.pdb", - "../../powershell.version" - ] - } - }, - - "publishOptions": { - "mappings": { - "Modules/" : { - "include": [ - "../Modules/Windows-Full", - "../Modules/Windows-Core+Full", - "../Modules/Shared" - ], - "exclude": [ - "../Modules/Shared/Pester/.git*" - ] - } - }, - "include" : [ - "powershell.exe", - "powershell.pdb", - "pwrshplugin.dll", - "pwrshplugin.pdb", - "../../powershell.version" - ] + "allowUnsafe": true }, "configurations": { @@ -94,25 +51,6 @@ } }, "net451": { - "dependencies": { - "Microsoft.Management.Infrastructure.CimCmdlets": "1.0.0-*", - "Microsoft.PowerShell.Activities": "1.0.0-*", - "Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*", - "Microsoft.PowerShell.Commands.Management": "1.0.0-*", - "Microsoft.PowerShell.Commands.Utility": "1.0.0-*", - "Microsoft.PowerShell.Core.Activities": "1.0.0-*", - "Microsoft.PowerShell.Diagnostics.Activities": "1.0.0-*", - "Microsoft.PowerShell.GraphicalHost": "1.0.0-*", - "Microsoft.PowerShell.LocalAccounts": "1.0.0-*", - "Microsoft.PowerShell.Management.Activities": "1.0.0-*", - "Microsoft.PowerShell.PackageManagement": "1.0.0-*", - "Microsoft.PowerShell.PSReadLine": "1.0.0-*", - "Microsoft.PowerShell.ScheduledJob": "1.0.0-*", - "Microsoft.PowerShell.Security.Activities": "1.0.0-*", - "Microsoft.PowerShell.Utility.Activities": "1.0.0-*", - "Microsoft.PowerShell.Workflow.ServiceCore": "1.0.0-*", - "Microsoft.WSMan.Management.Activities": "1.0.0-*" - } } } } diff --git a/src/Microsoft.PowerShell.SDK/README.md b/src/Microsoft.PowerShell.SDK/README.md new file mode 100644 index 0000000000..f89c3bc35b --- /dev/null +++ b/src/Microsoft.PowerShell.SDK/README.md @@ -0,0 +1,25 @@ +Microsoft PowerShell SDK +======================== + +This project is a metapackage referencing the PowerShell projects and .NET Core packages that PowerShell ships. + +The package dependencies consist of two parts: + +1. PowerShell projects: local source code with own sets of dependencies +2. .NET Core packages: the framework libraries that we ensure are present for PowerShell developers at runtime + +This second set includes packages that we do not necessarily require at compile-time, but must provide for our users at runtime. +For example, we include the library `System.Runtime.Serialization.Json.dll` so that users of PowerShell can utilize its types and methods, +even though PowerShell does not directly depend on the library. + +There are intentionally duplicated dependencies. +Instead of relying on dependency transitivity where A -> B, B -> C, so A -> C, +we explicitly include A -> C if A requires C despite the removal of B. +Additionally, we want to easily identify our complete dependency set without generating a lockfile +(an artifact of `dotnet restore` after it resolves the dependency graph). +For example, `System.Management.Automation` depends on `System.Diagnostics.TraceSource`, +but `Microsoft.PowerShell.SDK` depends on both `System.Diagnostics.TraceSource` and `System.Management.Automation`. + +Transitive dependencies not listed in [project.json][] are **not a part of public contract**. + +[project.json]: project.json diff --git a/src/Microsoft.PowerShell.SDK/project.json b/src/Microsoft.PowerShell.SDK/project.json new file mode 100644 index 0000000000..c3d10c4539 --- /dev/null +++ b/src/Microsoft.PowerShell.SDK/project.json @@ -0,0 +1,105 @@ +{ + "name": "Microsoft.PowerShell.SDK", + "version": "1.0.0-*", + "description": "PowerShell SDK metapackage", + + "dependencies": { + "Microsoft.PowerShell.Commands.Management" : "1.0.0-*", + "Microsoft.PowerShell.Commands.Utility" : "1.0.0-*", + "Microsoft.PowerShell.ConsoleHost" : "1.0.0-*", + "Microsoft.PowerShell.Security" : "1.0.0-*", + "System.Management.Automation" : "1.0.0-*" + }, + + "frameworks": { + "net451": {}, + "netstandard1.6": { + "imports": ["dnxcore50", "portable-net45+win8"], + "dependencies": { + "Microsoft.NETCore.Portable.Compatibility": "1.0.1", + "Microsoft.CSharp": "4.0.1", + "Microsoft.VisualBasic": "10.0.1", + "Microsoft.Win32.Registry" : "4.0.0", + "Microsoft.Win32.Registry.AccessControl" : "4.0.0", + "NETStandard.Library": "1.6", + "System.Collections.Immutable" : "1.2.0", + "System.Collections.NonGeneric" : "4.0.1", + "System.Collections.Specialized" : "4.0.1", + "System.ComponentModel" : "4.0.1", + "System.ComponentModel.Annotations" : "4.1.0", + "System.ComponentModel.EventBasedAsync" : "4.0.11", + "System.ComponentModel.Primitives" : "4.1.0", + "System.ComponentModel.TypeConverter" : "4.1.0", + "System.Data.Common" : "4.1.0", + "System.Data.SqlClient" : "4.1.0", + "System.Diagnostics.Contracts" : "4.0.1", + "System.Diagnostics.DiagnosticSource" : "4.0.0", + "System.Diagnostics.FileVersionInfo" : "4.0.0", + "System.Diagnostics.Process" : "4.1.0", + "System.Diagnostics.StackTrace" : "4.0.1", + "System.Diagnostics.TextWriterTraceListener" : "4.0.0", + "System.Diagnostics.TraceSource" : "4.0.0", + "System.Dynamic.Runtime" : "4.0.11", + "System.Globalization.Extensions" : "4.0.1", + "System.IO.FileSystem.AccessControl" : "4.0.0", + "System.IO.FileSystem.DriveInfo" : "4.0.0", + "System.IO.FileSystem.Watcher" : "4.0.0", + "System.IO.MemoryMappedFiles" : "4.0.0", + "System.IO.Packaging" : "4.0.0", + "System.IO.Pipes" : "4.0.0", + "System.IO.UnmanagedMemoryStream" : "4.0.1", + "System.Linq.Parallel" : "4.0.1", + "System.Linq.Queryable" : "4.0.1", + "System.Net.Http.WinHttpHandler" : "4.0.0", + "System.Net.NameResolution" : "4.0.0", + "System.Net.NetworkInformation" : "4.1.0", + "System.Net.Ping" : "4.0.0", + "System.Net.Requests" : "4.0.11", + "System.Net.Security" : "4.0.0", + "System.Net.WebHeaderCollection" : "4.0.1", + "System.Net.WebSockets" : "4.0.0", + "System.Net.WebSockets.Client" : "4.0.0", + "System.Numerics.Vectors" : "4.1.1", + "System.Reflection.DispatchProxy" : "4.0.1", + "System.Reflection.Emit" : "4.0.1", + "System.Reflection.Emit.ILGeneration" : "4.0.1", + "System.Reflection.Emit.Lightweight" : "4.0.1", + "System.Reflection.Metadata" : "1.3.0", + "System.Reflection.TypeExtensions" : "4.1.0", + "System.Resources.Reader" : "4.0.0", + "System.Runtime.CompilerServices.VisualC" : "4.0.0", + "System.Runtime.Serialization.Json" : "4.0.2", + "System.Runtime.Serialization.Primitives" : "4.1.1", + "System.Runtime.Serialization.Xml" : "4.1.1", + "System.Security.AccessControl" : "4.0.0", + "System.Security.Claims" : "4.0.1", + "System.Security.Cryptography.Cng" : "4.2.0", + "System.Security.Cryptography.Csp" : "4.0.0", + "System.Security.Cryptography.Pkcs" : "4.0.0", + "System.Security.Principal" : "4.0.1", + "System.Security.Principal.Windows" : "4.0.0", + "System.Security.SecureString" : "4.0.0", + "System.ServiceModel.Duplex" : "4.0.1", + "System.ServiceModel.Http" : "4.1.0", + "System.ServiceModel.NetTcp" : "4.1.0", + "System.ServiceModel.Primitives" : "4.1.0", + "System.ServiceModel.Security" : "4.0.1", + "System.ServiceProcess.ServiceController" : "4.1.0", + "System.Text.Encoding.CodePages" : "4.0.1", + "System.Text.Encodings.Web" : "4.0.0", + "System.Threading.AccessControl" : "4.0.0", + "System.Threading.Overlapped" : "4.0.1", + "System.Threading.Tasks.Dataflow" : "4.6.0", + "System.Threading.Tasks.Parallel" : "4.0.1", + "System.Threading.Thread" : "4.0.0", + "System.Threading.ThreadPool" : "4.0.10", + "System.Xml.XmlDocument" : "4.0.1", + "System.Xml.XmlSerializer" : "4.0.11", + "System.Xml.XPath" : "4.0.1", + "System.Xml.XPath.XDocument" : "4.0.1", + "System.Xml.XPath.XmlDocument" : "4.0.1", + "System.Private.ServiceModel": "4.1.0" + } + } + } +} diff --git a/src/TypeCatalogParser/Main.cs b/src/TypeCatalogParser/Main.cs index 8d9569f23c..8b019c120a 100644 --- a/src/TypeCatalogParser/Main.cs +++ b/src/TypeCatalogParser/Main.cs @@ -13,13 +13,6 @@ namespace TypeCatalogParser { public static void Main(string[] args) { - if (args.Length != 1) - { - throw new ArgumentException( - "Usage: ./TypeCatalogParser \n" + - "Valid options are '../powershell-unix' and '../powershell-windows'"); - } - // These are packages that are not part of .NET Core and must be excluded string[] excludedPackages = { "Microsoft.Management.Infrastructure", @@ -32,7 +25,7 @@ namespace TypeCatalogParser var outputPath = "../TypeCatalogGen/powershell.inc"; // Get a context for our top level project - var context = ProjectContext.Create(args[0], NuGetFramework.Parse("netcoreapp1.0")); + var context = ProjectContext.Create("../Microsoft.PowerShell.SDK", NuGetFramework.Parse("netstandard1.6")); System.IO.File.WriteAllLines(outputPath, // Get the target for the current runtime diff --git a/src/powershell-unix/project.json b/src/powershell-unix/project.json index f6d2f5f162..70f9d40ad2 100644 --- a/src/powershell-unix/project.json +++ b/src/powershell-unix/project.json @@ -1,7 +1,7 @@ { "name": "powershell", "version": "1.0.0-*", - "description": ".NET CLI PowerShell app", + "description": "PowerShell top-level project with .NET CLI host", "buildOptions": { "xmlDoc": true, @@ -51,10 +51,8 @@ }, "dependencies": { - "Microsoft.PowerShell.ConsoleHost": "1.0.0-*", + "Microsoft.PowerShell.SDK": "1.0.0-*", "Microsoft.PowerShell.PSReadLine": "1.0.0-*", - "Microsoft.PowerShell.Commands.Management": "1.0.0-*", - "Microsoft.PowerShell.Commands.Utility": "1.0.0-*", "Microsoft.PowerShell.PackageManagement": "1.0.0-*" }, diff --git a/src/powershell-windows/project.json b/src/powershell-win-core/project.json similarity index 90% rename from src/powershell-windows/project.json rename to src/powershell-win-core/project.json index 956b659e02..41e369f973 100644 --- a/src/powershell-windows/project.json +++ b/src/powershell-win-core/project.json @@ -1,7 +1,7 @@ { "name": "powershell", "version": "1.0.0-*", - "description": ".NET CLI PowerShell app", + "description": "PowerShell top-level project with .NET CLI PowerShell app", "buildOptions": { "xmlDoc": true, @@ -51,11 +51,9 @@ }, "dependencies": { - "Microsoft.PowerShell.ConsoleHost": "1.0.0-*", + "Microsoft.PowerShell.SDK": "1.0.0-*", "Microsoft.PowerShell.PSReadLine": "1.0.0-*", "Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*", - "Microsoft.PowerShell.Commands.Management": "1.0.0-*", - "Microsoft.PowerShell.Commands.Utility": "1.0.0-*", "Microsoft.PowerShell.LocalAccounts": "1.0.0-*", "Microsoft.PowerShell.PackageManagement": "1.0.0-*", "Microsoft.Management.Infrastructure.CimCmdlets": "1.0.0-*" diff --git a/src/powershell-win-full/project.json b/src/powershell-win-full/project.json new file mode 100644 index 0000000000..376a7c5ddf --- /dev/null +++ b/src/powershell-win-full/project.json @@ -0,0 +1,56 @@ +{ + "name": "powershell", + "version": "1.0.0-*", + "description": "PowerShell top-level project for FullCLR package with native host", + + "publishOptions": { + "mappings": { + "Modules/" : { + "include": [ + "../Modules/Windows-Full", + "../Modules/Windows-Core+Full", + "../Modules/Shared" + ], + "exclude": [ + "../Modules/Shared/Pester/.git*" + ] + } + }, + "include" : [ + "powershell.exe", + "powershell.pdb", + "pwrshplugin.dll", + "pwrshplugin.pdb", + "../../powershell.version" + ] + }, + + "dependencies": { + "Microsoft.PowerShell.SDK": "1.0.0-*", + "Microsoft.Management.Infrastructure.CimCmdlets": "1.0.0-*", + "Microsoft.PowerShell.Activities": "1.0.0-*", + "Microsoft.PowerShell.Commands.Diagnostics": "1.0.0-*", + "Microsoft.PowerShell.Core.Activities": "1.0.0-*", + "Microsoft.PowerShell.Diagnostics.Activities": "1.0.0-*", + "Microsoft.PowerShell.GraphicalHost": "1.0.0-*", + "Microsoft.PowerShell.LocalAccounts": "1.0.0-*", + "Microsoft.PowerShell.Management.Activities": "1.0.0-*", + "Microsoft.PowerShell.PackageManagement": "1.0.0-*", + "Microsoft.PowerShell.PSReadLine": "1.0.0-*", + "Microsoft.PowerShell.ScheduledJob": "1.0.0-*", + "Microsoft.PowerShell.Security.Activities": "1.0.0-*", + "Microsoft.PowerShell.Utility.Activities": "1.0.0-*", + "Microsoft.PowerShell.Workflow.ServiceCore": "1.0.0-*", + "Microsoft.WSMan.Management.Activities": "1.0.0-*" + }, + + "frameworks": { + "net451": {} + }, + + "runtimes": { + "win7-x64": { }, + "win81-x64": { }, + "win10-x64": { }, + } +}