From e6e4dcafbe52898a8d551f8305f6acfd2566ef24 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 11 Feb 2016 08:25:43 -0800 Subject: [PATCH] Build with new framework and new CLI All libraries now use the framework `netstandard1.5`, and import the `dnxcore50` and `portable` frameworks. The app that is published, Microsoft.PowerShell.Linux.Host, that is, the top-level dependency that emits an executable, instead targets `netstandardapp1.5` and has a new `runtimes` key so that .NET CLI's `restore` and `publish` commands know which runtime implementations to resolve. When switching to the new CLI, we needed to fix how we specified our dependencies. In particular, the .NET CLI team helped me figure out how to download packages that are reference assembly only on Linux, with implementations on Windows. The result of this is the new `frameworks` setup. Additionally, we were incorrectly specifying our build dependencies; that is, projects we also build (not packages). The solution was much cleaner. We removed the `type: build` section and replaced it with the version `1.0.0-*` that all our projects currently use. The `project.json` files also had their names, descriptions, indentation, and versions fixed. The build scripts were simplified. --- build.ps1 | 7 +----- build.sh | 4 +-- .../project.json | 11 ++++---- .../project.json | 10 +++----- .../project.json | 12 ++++----- .../project.json | 11 +++----- .../project.json | 13 +++------- .../project.json | 7 +++--- .../project.json | 25 ++++++++++--------- .../project.json | 10 +++----- src/System.Management.Automation/project.json | 15 ++++------- src/System.Security.SecureString/project.json | 18 ++++++++----- src/TypeCatalogGen/Runtime/project.json | 6 ++++- src/TypeCatalogGen/project.json | 23 +++++++++-------- test/csharp/project.json | 6 ++--- 15 files changed, 82 insertions(+), 96 deletions(-) diff --git a/build.ps1 b/build.ps1 index 1653f9b8d..3a5abafe2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,2 @@ -$BIN = "${pwd}/bin" - # Publish PowerShell -cd src/Microsoft.PowerShell.Linux.Host -dotnet publish --framework dnxcore50 --output $BIN -# Copy files that dotnet-publish does not currently deploy -cd ../.. +dotnet publish "src/Microsoft.PowerShell.Linux.Host" --framework "netstandardapp1.5" --output "bin" diff --git a/build.sh b/build.sh index 5750919f9..fa1016a00 100755 --- a/build.sh +++ b/build.sh @@ -12,6 +12,4 @@ cp src/libpsl-native.* $BIN popd # Publish PowerShell -pushd src/Microsoft.PowerShell.Linux.Host -dotnet publish --framework dnxcore50 --output $BIN --configuration Linux -popd +dotnet publish --output $BIN --configuration Linux src/Microsoft.PowerShell.Linux.Host diff --git a/src/Microsoft.Management.Infrastructure.Native/project.json b/src/Microsoft.Management.Infrastructure.Native/project.json index 87e84dc7d..1f1c3c318 100644 --- a/src/Microsoft.Management.Infrastructure.Native/project.json +++ b/src/Microsoft.Management.Infrastructure.Native/project.json @@ -1,16 +1,15 @@ { + "name": "Microsoft.Management.Infrastructure.Native", "version": "1.0.0-*", - "description": "Microsoft.Management.Infrastructure.Native Stub", + "description": "Stub to satisfy PowerShell compilation", "authors": [ "garretts", "andschwa" ], "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "dependencies": { "NETStandard.Library": "1.0.0-rc3-23817", - "System.Security.SecureString": { - "type": "build", - "version": "1.0.0-*" - } + "System.Security.SecureString": "1.0.0-*" } }, "dnx451": { diff --git a/src/Microsoft.Management.Infrastructure/project.json b/src/Microsoft.Management.Infrastructure/project.json index 98b69706e..595e6c59d 100644 --- a/src/Microsoft.Management.Infrastructure/project.json +++ b/src/Microsoft.Management.Infrastructure/project.json @@ -1,6 +1,6 @@ { + "name": "Microsoft.Management.Infrastructure", "version": "1.0.0-*", - "description": "Microsoft.Management.Infrastructure", "authors": [ "garretts", "andschwa" ], "compilationOptions": { @@ -8,14 +8,12 @@ }, "dependencies": { - "Microsoft.Management.Infrastructure.Native" : { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.Management.Infrastructure.Native": "1.0.0-*" }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "compilationOptions": { "define": [ "_CORECLR" ] }, diff --git a/src/Microsoft.PowerShell.Commands.Management/project.json b/src/Microsoft.PowerShell.Commands.Management/project.json index 663f33bc6..918360995 100644 --- a/src/Microsoft.PowerShell.Commands.Management/project.json +++ b/src/Microsoft.PowerShell.Commands.Management/project.json @@ -1,6 +1,6 @@ { + "name": "Microsoft.PowerShell.Commands.Management", "version": "1.0.0-*", - "description": "Microsoft.PowerShell.Commands.Management Library", "authors": [ "garretts", "andschwa" ], "compilationOptions": { @@ -8,14 +8,12 @@ }, "dependencies": { - "Microsoft.PowerShell.Security": { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.PowerShell.Security": "1.0.0-*" }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "compilationOptions": { "define": [ "CORECLR" ] }, @@ -72,7 +70,7 @@ "../monad/monad/src/commands/management/CommitTransactionCommand.cs", "../monad/monad/src/commands/management/Computer.cs", "../monad/monad/src/commands/management/ContentCommandBase.cs", - + "../monad/monad/src/commands/management/ConvertPathCommand.cs", "../monad/monad/src/commands/management/CopyPropertyCommand.cs", "../monad/monad/src/commands/management/Eventlog.cs", diff --git a/src/Microsoft.PowerShell.Commands.Utility/project.json b/src/Microsoft.PowerShell.Commands.Utility/project.json index d9cdc92ce..5eee156ed 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/project.json +++ b/src/Microsoft.PowerShell.Commands.Utility/project.json @@ -1,6 +1,6 @@ { + "name": "Microsoft.PowerShell.Commands.Utility", "version": "1.0.0-*", - "description": "Microsoft.PowerShell.Commands.Utility Library", "authors": [ "garretts", "andschwa" ], "compilationOptions": { @@ -16,18 +16,15 @@ }, "dependencies": { - "System.Management.Automation": { - "type": "build", - "version": "1.0.0-*" - } + "System.Management.Automation": "1.0.0-*" }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { "compilationOptions": { "define": [ "CORECLR" ] }, - "imports": "portable-net45+win8", + "imports": [ "dnxcore50", "portable-net45+win8" ], "dependencies": { "Microsoft.CodeAnalysis.CSharp": "1.1.1", "Newtonsoft.Json": "8.0.2" diff --git a/src/Microsoft.PowerShell.ConsoleHost/project.json b/src/Microsoft.PowerShell.ConsoleHost/project.json index fb4d99d57..c558e9eed 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/project.json +++ b/src/Microsoft.PowerShell.ConsoleHost/project.json @@ -1,6 +1,7 @@ { + "name": "Microsoft.PowerShell.ConsoleHost", "version": "1.0.0-*", - "description": "Microsoft.PowerShell.ConsoleHost Library", + "description": "Full Windows PowerShell Host (requires native host)", "authors": [ "sevoroby", "andschwa" ], "compilationOptions": { @@ -8,14 +9,8 @@ }, "dependencies": { - "Microsoft.PowerShell.Commands.Management": { - "type": "build", - "version": "1.0.0-*" - }, - "Microsoft.PowerShell.Commands.Utility": { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.PowerShell.Commands.Management": "1.0.0-*", + "Microsoft.PowerShell.Commands.Utility": "1.0.0-*" }, "frameworks": { diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json index 3eb4d83f3..1ba074f17 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/project.json @@ -1,6 +1,6 @@ { - "version": "1.0.0.0", - "description": "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext Class", + "name": "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext", + "version": "1.0.0-*", "authors": [ "andschwa" ], "configurations": { @@ -12,7 +12,8 @@ }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "compilationOptions": { "define": [ "CORECLR" ] }, diff --git a/src/Microsoft.PowerShell.Linux.Host/project.json b/src/Microsoft.PowerShell.Linux.Host/project.json index 9f2ea741f..6ff86d98a 100644 --- a/src/Microsoft.PowerShell.Linux.Host/project.json +++ b/src/Microsoft.PowerShell.Linux.Host/project.json @@ -1,7 +1,7 @@ { "name": "powershell", "version": "1.0.0-*", - "description": "PowerShell On Linux Console", + "description": "PowerShell Managed Console for .NET Core", "authors": [ "andschwa" ], "compilationOptions": { @@ -10,14 +10,8 @@ "dependencies": { "Newtonsoft.Json": "8.0.2", - "Microsoft.PowerShell.Commands.Management": { - "type": "build", - "version": "1.0.0-*" - }, - "Microsoft.PowerShell.Commands.Utility": { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.PowerShell.Commands.Management": "1.0.0-*", + "Microsoft.PowerShell.Commands.Utility": "1.0.0-*" }, "content": [ @@ -41,10 +35,17 @@ "WSMan.format.ps1xml" ], - "frameworks": { - "dnxcore50": { - "imports": "portable-net45+win8" + "netstandardapp1.5": { + "imports": [ "dnxcore50", "portable-net45+win8" ] } + }, + + "runtimes": { + "ubuntu.14.04-x64": { }, + "win7-x64": { }, + "win10-x64": { }, + "osx.10.10-x64": { }, + "osx.10.11-x64": { } } } diff --git a/src/Microsoft.PowerShell.Security/project.json b/src/Microsoft.PowerShell.Security/project.json index 2e7ab6ea5..1da073edc 100644 --- a/src/Microsoft.PowerShell.Security/project.json +++ b/src/Microsoft.PowerShell.Security/project.json @@ -1,6 +1,6 @@ { + "name": "Microsoft.PowerShell.Security", "version": "1.0.0-*", - "description": "Microsoft.PowerShell.Security Library", "authors": [ "garretts", "andschwa" ], "compilationOptions": { @@ -8,14 +8,12 @@ }, "dependencies": { - "System.Management.Automation": { - "type": "build", - "version": "1.0.0-*" - } + "System.Management.Automation": "1.0.0-*" }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "compilationOptions": { "define": [ "CORECLR" ] } diff --git a/src/System.Management.Automation/project.json b/src/System.Management.Automation/project.json index f4fdc9eb0..159774713 100644 --- a/src/System.Management.Automation/project.json +++ b/src/System.Management.Automation/project.json @@ -1,7 +1,6 @@ { "name": "System.Management.Automation", "version": "1.0.0-*", - "description": "System.Management.Automation Library", "authors": [ "garretts", "andschwa" ], "compilationOptions": { @@ -17,18 +16,18 @@ }, "dependencies": { - "Microsoft.Management.Infrastructure" : { - "type": "build", - "version": "1.0.0-*" - } + "Microsoft.Management.Infrastructure": "1.0.0-*" }, "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50" ], "compilationOptions": { "define": [ "CORECLR", "NOETW" ] }, "dependencies": { + "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext": "1.0.0-*", + "Microsoft.CSharp": "4.0.1-rc3-23817", "Microsoft.Win32.Registry.AccessControl": "4.0.0-rc3-23817", "System.Collections.Specialized": "4.0.1-rc3-23817", @@ -56,10 +55,6 @@ "System.Xml.XPath.XmlDocument": "4.0.1-rc3-23817", "System.Xml.XmlDocument": "4.0.1-rc3-23817", "System.Xml.XmlSerializer": "4.0.11-rc3-23817", - "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext": { - "type": "build", - "version": "1.0.0-*" - } } }, "dnx451": { diff --git a/src/System.Security.SecureString/project.json b/src/System.Security.SecureString/project.json index b896a5f21..bb14b1379 100644 --- a/src/System.Security.SecureString/project.json +++ b/src/System.Security.SecureString/project.json @@ -1,13 +1,19 @@ { + "name": "System.Security.SecureString", "version": "1.0.0-*", - "description": "SecureString Stub", + "description": "SecureString Stub borrowed from Mono", "authors": [ "garretts" ], - "compilationOptions": { "allowUnsafe": true }, - - "dependencies": { - "NETStandard.Library": "1.0.0-rc3-23817" + "compilationOptions": { + "allowUnsafe": true }, - "frameworks": { "dnxcore50": { } } + "frameworks": { + "netstandard1.5": { + "dependencies": { + "NETStandard.Library": "1.0.0-rc3-23817" + }, + "imports": [ "dnxcore50" ] + } + } } diff --git a/src/TypeCatalogGen/Runtime/project.json b/src/TypeCatalogGen/Runtime/project.json index 90a960e66..b525d9f99 100644 --- a/src/TypeCatalogGen/Runtime/project.json +++ b/src/TypeCatalogGen/Runtime/project.json @@ -36,5 +36,9 @@ "System.Net.NameResolution": "4.0.0-rc3-23817" }, - "frameworks": { "dnxcore50": { } } + "frameworks": { + "netstandard1.5": { + "imports": [ "dnxcore50", "portable-net45+win8" ] + } + } } diff --git a/src/TypeCatalogGen/project.json b/src/TypeCatalogGen/project.json index aa02e09b0..cd5cc8d1a 100644 --- a/src/TypeCatalogGen/project.json +++ b/src/TypeCatalogGen/project.json @@ -1,6 +1,7 @@ { + "name": "TypeCatalogGen", "version": "1.0.0-*", - "description": "PowerShell TypeCatalogGen.exe", + "description": "Generates CorePsTypeCatalog.cs given powershell.inc", "authors": [ "andschwa" ], "compilationOptions": { @@ -8,21 +9,21 @@ }, "dependencies": { - "System.Reflection.Metadata": "1.1.1-beta-23516", - "System.Collections.Immutable": "1.1.38-beta-23516" + "System.Reflection.Metadata": "1.1.1-beta-23516", + "System.Collections.Immutable": "1.1.38-beta-23516" }, "compileFiles": [ - "../monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/TypeCatalogGen/TypeCatalogGen.cs" + "../monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/TypeCatalogGen/TypeCatalogGen.cs" ], "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "", - "System.Reflection.Primitives": "" - } - } + "dnx451": { + "frameworkAssemblies": { + "System.Runtime": "", + "System.IO": "", + "System.Reflection.Primitives": "" + } + } } } diff --git a/test/csharp/project.json b/test/csharp/project.json index ec0f0c699..cadb49ca5 100644 --- a/test/csharp/project.json +++ b/test/csharp/project.json @@ -5,7 +5,8 @@ "authors": [ "andschwa" ], "frameworks": { - "dnxcore50": { + "netstandard1.5": { + "imports": [ "dnxcore50", "portable-net45+win8" ], "dependencies": { "Microsoft.PowerShell.Linux.Host": { "type": "build", @@ -13,8 +14,7 @@ }, "xunit": "2.1.0", "dotnet-test-xunit": "1.0.0-dev-*" - }, - "imports": "portable-net45+win8" + } } },