From e6e4dcafbe52898a8d551f8305f6acfd2566ef24 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 11 Feb 2016 08:25:43 -0800 Subject: [PATCH 1/2] 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 1653f9b8d4..3a5abafe2a 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 5750919f96..fa1016a00d 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 87e84dc7df..1f1c3c3184 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 98b69706e4..595e6c59d2 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 663f33bc67..9183609954 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 d9cdc92cec..5eee156ede 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 fb4d99d571..c558e9eed5 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 3eb4d83f3c..1ba074f172 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 9f2ea741fc..6ff86d98a7 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 2e7ab6ea50..1da073edc4 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 f4fdc9eb0b..159774713b 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 b896a5f216..bb14b13790 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 90a960e66d..b525d9f99b 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 aa02e09b04..cd5cc8d1a3 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 ec0f0c699d..cadb49ca53 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" + } } }, From 5c0abec45bfb8f7dd84e393fbbb7b47cbd973c6e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 17 Feb 2016 18:11:19 -0800 Subject: [PATCH 2/2] Pin CLI to 1.0.0.001425 and update readme --- .travis.yml | 2 +- README.md | 15 +++++++++++++-- appveyor.yml | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9cc1dee3c1..9490263cbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - sudo sh -c 'echo "deb [arch=amd64] http://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 - sudo apt-get -qq update - - sudo apt-get install -y dotnet-nightly=1.0.1.001252-1 + - sudo apt-get install -y dotnet=1.0.0.001425-1 script: - dotnet restore - ./build.sh diff --git a/README.md b/README.md index a7321fb596..9d1ddc2978 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,19 @@ We use the [.NET Command Line Interface][dotnet-cli] (`dotnet-cli`) to build the managed components, and [CMake][] to build the native components (on non-Windows platforms). Install `dotnet-cli` by following their [documentation][]. -**Make sure to `apt-get install dotnet-nightly=1.0.1.001252-1` for a known, -good version.** +The version of .NET CLI is very important, you want a recent 1.0.0 beta +(**not** 1.0.1). + +These are known good versions: + +```sh +sudo apt-get install dotnet=1.0.0.001425-1 +``` + +```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.001425 -channel beta +``` > Note that OS X dependency installation instructions are not yet documented, > and Core PowerShell on Windows only needs `dotnet-cli`. diff --git a/appveyor.yml b/appveyor.yml index 2142682e4c..9a53bddff3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init --recursive -- src/monad src/windows-build src/Microsoft.PowerShell.Linux.Host/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.1.001186" + - ps: ./install.ps1 -version 1.0.0.001425 -channel beta build_script: - ps: $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli\bin"