From 4a2d3fae1684db789165fc8e8be73fe0a5bf788d Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Thu, 28 Sep 2017 17:49:58 -0700 Subject: [PATCH 1/8] Fix up roslyn satellite assembly handling to match new insertion mechanism 1. Publish satellites with a separate project and merge the resulting .deps.json into (csc|vbc).deps.json 2. Move the build tasks satellites to the correct location next to main assembly (one level higher than bincore\) --- build/Microsoft.DotNet.Cli.tasks | 1 + build_projects/dotnet-cli-build/AddToDeps.cs | 67 +++++++++++++++++++ .../dotnet-cli-build/dotnet-cli-build.csproj | 1 + src/redist/redist.csproj | 21 +++--- .../tool_roslyn_satellites.csproj | 35 ++++++++++ 5 files changed, 117 insertions(+), 8 deletions(-) create mode 100644 build_projects/dotnet-cli-build/AddToDeps.cs create mode 100644 src/tool_roslyn_satellites/tool_roslyn_satellites.csproj diff --git a/build/Microsoft.DotNet.Cli.tasks b/build/Microsoft.DotNet.Cli.tasks index 901a48f84..1c846d8b0 100644 --- a/build/Microsoft.DotNet.Cli.tasks +++ b/build/Microsoft.DotNet.Cli.tasks @@ -1,6 +1,7 @@ + diff --git a/build_projects/dotnet-cli-build/AddToDeps.cs b/build_projects/dotnet-cli-build/AddToDeps.cs new file mode 100644 index 000000000..ca02cd474 --- /dev/null +++ b/build_projects/dotnet-cli-build/AddToDeps.cs @@ -0,0 +1,67 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.IO; +using System.Linq; + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Microsoft.Extensions.DependencyModel; + +namespace Microsoft.DotNet.Cli.Build +{ + /// + /// Merges additional .deps.json files into target .deps.json files. + /// + public class AddToDeps : Task + { + /// + /// Paths to target .deps.json files, into which will be merged. + /// These files will be overwritten with the merge result. + /// + [Required] + public string[] TargetDeps { get; set; } + + /// + /// Paths to additional .deps.json files to merge into . + /// + [Required] + public string[] AdditionalDeps { get; set; } + + public override bool Execute() + { + DependencyContext additionalContext = Read(AdditionalDeps.First()); + + foreach (string additionalPath in AdditionalDeps.Skip(1)) + { + additionalContext = additionalContext.Merge(Read(additionalPath)); + } + + foreach (string targetPath in TargetDeps) + { + DependencyContext targetContext = Read(targetPath).Merge(additionalContext); + Write(targetContext, targetPath); + } + + return true; + } + + private static DependencyContext Read(string path) + { + using (FileStream stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (var reader = new DependencyContextJsonReader()) + { + return reader.Read(stream); + } + } + + private static void Write(DependencyContext context, string path) + { + using (FileStream stream = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Read)) + { + var writer = new DependencyContextWriter(); // unlike reader, writer is not disposable + writer.Write(context, stream); + } + } + } +} \ No newline at end of file diff --git a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj index 872cae995..2db08aaa8 100644 --- a/build_projects/dotnet-cli-build/dotnet-cli-build.csproj +++ b/build_projects/dotnet-cli-build/dotnet-cli-build.csproj @@ -29,5 +29,6 @@ + diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 4dbd46f5d..685e89d79 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -24,9 +24,6 @@ All - - All - @@ -77,23 +74,31 @@ - - - + + + + + "version": ".*" "version": "$(CLI_SharedFrameworkVersion)" + + + + + + + + $(CliVersionPrefix) + $(CliTargetFramework) + $(CLI_SharedFrameworkVersion) + $(RoslynDirectory)/bincore + $(CommitCount) + false + false + false + + + + + + + + + + + + + + + + + + From cd68283018f7b15474c63a93a6405eace0f5bcbc Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Tue, 3 Oct 2017 16:01:08 -0700 Subject: [PATCH 2/8] Update cli-deps-satellites --- build/DependencyVersions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ac4e34adb..2d518164e 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -4,10 +4,10 @@ 2.0.1 15.5.0-preview-000113-1032064 2.6.0-beta1-62126-01 - 2.3.0-pre-20170727-1 + 2.6.0-pre-20171003-1 1.6.0-beta2-25304 4.2.0-rtm-170926-0 - 4.4.1-pre-20170727-1 + 4.4.1-pre-20171003-1 + diff --git a/NuGet.master.config b/NuGet.master.config index b004e5cc7..0d17ce122 100644 --- a/NuGet.master.config +++ b/NuGet.master.config @@ -2,6 +2,6 @@ - + \ No newline at end of file From ddae0875cf1adaeb0575bffc34630a078d6b8cca Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Mon, 9 Oct 2017 13:55:13 -0700 Subject: [PATCH 4/8] Revert release/2.0.0 back to 1bcee43995cd6e01b5abc67b5f7b4422c32d5491 There were incorrect merges from release/15.5 to release/2.0.0 since then --- Microsoft.DotNet.Cli.sln | 27 +++++ .../MSBuildIntegration/build.proj | 3 + build/DependencyVersions.props | 12 +- build/Microsoft.DotNet.Cli.tasks | 1 - .../InvokeWithStage2.proj | 2 + build_projects/dotnet-cli-build/AddToDeps.cs | 67 ----------- .../dotnet-cli-build/dotnet-cli-build.csproj | 1 - .../MSBuildForwardingAppWithoutLogging.cs | 20 +++- .../dotnet-run/LocalizableStrings.resx | 2 +- .../dotnet-run/xlf/LocalizableStrings.cs.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.de.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.es.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.fr.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.it.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.ja.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.ko.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.pl.xlf | 4 +- .../xlf/LocalizableStrings.pt-BR.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.ru.xlf | 4 +- .../dotnet-run/xlf/LocalizableStrings.tr.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hans.xlf | 4 +- .../xlf/LocalizableStrings.zh-Hant.xlf | 4 +- src/redist/redist.csproj | 107 +++++------------- src/tool_roslyn/RunCsc.cmd | 6 + src/tool_roslyn/RunCsc.sh | 17 +++ src/tool_roslyn/RunVbc.cmd | 6 + src/tool_roslyn/RunVbc.sh | 17 +++ src/tool_roslyn/tool_roslyn.csproj | 68 +++++++++++ .../tool_roslyn_satellites.csproj | 35 ------ .../GivenAProjectToolsCommandResolver.cs | 2 +- .../GivenMsbuildForwardingApp.cs | 23 ++++ 31 files changed, 247 insertions(+), 221 deletions(-) delete mode 100644 build_projects/dotnet-cli-build/AddToDeps.cs create mode 100644 src/tool_roslyn/RunCsc.cmd create mode 100755 src/tool_roslyn/RunCsc.sh create mode 100644 src/tool_roslyn/RunVbc.cmd create mode 100755 src/tool_roslyn/RunVbc.sh create mode 100644 src/tool_roslyn/tool_roslyn.csproj delete mode 100644 src/tool_roslyn_satellites/tool_roslyn_satellites.csproj diff --git a/Microsoft.DotNet.Cli.sln b/Microsoft.DotNet.Cli.sln index 271579431..3733528eb 100644 --- a/Microsoft.DotNet.Cli.sln +++ b/Microsoft.DotNet.Cli.sln @@ -147,6 +147,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.TestFramew EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redist", "src\redist\redist.csproj", "{098D9321-1201-4974-A75E-F58EBCD98ACF}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_roslyn", "src\tool_roslyn\tool_roslyn.csproj", "{A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_msbuild", "src\tool_msbuild\tool_msbuild.csproj", "{D82A3246-9831-4024-A9B2-1932EEF3D56F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_nuget", "src\tool_nuget\tool_nuget.csproj", "{BE4C655A-DC54-4408-B739-743456D34111}" @@ -703,6 +705,30 @@ Global {098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x64.Build.0 = Release|Any CPU {098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU {098D9321-1201-4974-A75E-F58EBCD98ACF}.RelWithDebInfo|x86.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x64.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x64.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x86.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Debug|x86.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x64.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x64.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x86.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.MinSizeRel|x86.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|Any CPU.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x64.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x64.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x86.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.Release|x86.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C}.RelWithDebInfo|x86.Build.0 = Release|Any CPU {D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|Any CPU.Build.0 = Debug|Any CPU {D82A3246-9831-4024-A9B2-1932EEF3D56F}.Debug|x64.ActiveCfg = Release|Any CPU @@ -1599,6 +1625,7 @@ Global {570950AD-A080-4F32-980C-F50E312910DF} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {6592A22C-2386-4E83-A4D3-FC08075C723A} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {098D9321-1201-4974-A75E-F58EBCD98ACF} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} + {A0670C63-BA7A-4C1B-B9A7-1CA26A7F235C} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {D82A3246-9831-4024-A9B2-1932EEF3D56F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {BE4C655A-DC54-4408-B739-743456D34111} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {2DFCC95F-75F7-46E1-8F56-256DB4CA98B2} = {0722D325-24C8-4E83-B5AF-0A083E7F0749} diff --git a/TestAssets/TestProjects/MSBuildIntegration/build.proj b/TestAssets/TestProjects/MSBuildIntegration/build.proj index 8b2a7851e..203f96df3 100644 --- a/TestAssets/TestProjects/MSBuildIntegration/build.proj +++ b/TestAssets/TestProjects/MSBuildIntegration/build.proj @@ -29,6 +29,9 @@ + + diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 5f02dd04b..3c43151c8 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,13 +1,13 @@ - 2.0.0 - 15.5.0-preview-000113-1032064 - 2.6.0-beta1-62126-01 - 2.6.0-pre-20171003-1 + 2.0.1 + 15.4.7 + 2.3.2-beta1-61921-05 + 2.3.0-pre-20170727-1 1.6.0-beta2-25304 - 4.2.0-rtm-170926-0 - 4.4.1-pre-20171003-1 + 4.2.0-rc-170630-0 + 4.4.1-pre-20170727-1 + @@ -72,33 +74,9 @@ - - - - - - - - - - - - - - "version": ".*" - "version": "$(CLI_SharedFrameworkVersion)" - - - - - + - - - - - - + - + - + - - - - - - - - + + - - - - - - - - - - + + + + + - - - - - + + + diff --git a/src/tool_roslyn/RunCsc.cmd b/src/tool_roslyn/RunCsc.cmd new file mode 100644 index 000000000..7398082b2 --- /dev/null +++ b/src/tool_roslyn/RunCsc.cmd @@ -0,0 +1,6 @@ +@echo off + +REM Copyright (c) .NET Foundation and contributors. All rights reserved. +REM Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"%~dp0..\..\..\dotnet" "%~dp0csc.exe" %* diff --git a/src/tool_roslyn/RunCsc.sh b/src/tool_roslyn/RunCsc.sh new file mode 100755 index 000000000..47aed63d1 --- /dev/null +++ b/src/tool_roslyn/RunCsc.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +"$DIR/../../../dotnet" "$DIR/csc.exe" "$@" diff --git a/src/tool_roslyn/RunVbc.cmd b/src/tool_roslyn/RunVbc.cmd new file mode 100644 index 000000000..e891b1bf5 --- /dev/null +++ b/src/tool_roslyn/RunVbc.cmd @@ -0,0 +1,6 @@ +@echo off + +REM Copyright (c) .NET Foundation and contributors. All rights reserved. +REM Licensed under the MIT license. See LICENSE file in the project root for full license information. + +"%~dp0..\..\..\dotnet" "%~dp0vbc.exe" %* diff --git a/src/tool_roslyn/RunVbc.sh b/src/tool_roslyn/RunVbc.sh new file mode 100755 index 000000000..3dda886a0 --- /dev/null +++ b/src/tool_roslyn/RunVbc.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +set -e + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +"$DIR/../../../dotnet" "$DIR/vbc.exe" "$@" diff --git a/src/tool_roslyn/tool_roslyn.csproj b/src/tool_roslyn/tool_roslyn.csproj new file mode 100644 index 000000000..bd702ca7c --- /dev/null +++ b/src/tool_roslyn/tool_roslyn.csproj @@ -0,0 +1,68 @@ + + + + + + $(CliVersionPrefix) + netcoreapp2.0 + $(CLI_SharedFrameworkVersion) + true + $(RoslynDirectory) + $(CommitCount) + + + + + + + + + + + + + + PreserveNewest + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tool_roslyn_satellites/tool_roslyn_satellites.csproj b/src/tool_roslyn_satellites/tool_roslyn_satellites.csproj deleted file mode 100644 index 9c6a3a346..000000000 --- a/src/tool_roslyn_satellites/tool_roslyn_satellites.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - $(CliVersionPrefix) - $(CliTargetFramework) - $(CLI_SharedFrameworkVersion) - $(RoslynDirectory)/bincore - $(CommitCount) - false - false - false - - - - - - - - - - - - - - - - - - diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 83a877151..7fe281b5d 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -309,7 +309,7 @@ namespace Microsoft.DotNet.Tests result.Should().NotBeNull(); - result.Args.Should().Contain("--fx-version 2.0.0"); + result.Args.Should().Contain("--fx-version 2.0.1"); } [Fact] diff --git a/test/dotnet-msbuild.Tests/GivenMsbuildForwardingApp.cs b/test/dotnet-msbuild.Tests/GivenMsbuildForwardingApp.cs index 4dad315e3..4450258ee 100644 --- a/test/dotnet-msbuild.Tests/GivenMsbuildForwardingApp.cs +++ b/test/dotnet-msbuild.Tests/GivenMsbuildForwardingApp.cs @@ -31,6 +31,8 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests [Theory] [InlineData("MSBuildExtensionsPath")] + [InlineData("CscToolExe")] + [InlineData("VbcToolExe")] [InlineData("MSBuildSDKsPath")] [InlineData("DOTNET_CLI_TELEMETRY_SESSIONID")] public void ItSetsEnvironmentalVariables(string envVarName) @@ -64,6 +66,27 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests .Exist(); } + [Fact] + public void ItSetsCscToolExePathToValidPath() + { + var msbuildPath = ""; + var envVar = "CscToolExe"; + new FileInfo(new MSBuildForwardingApp(new string[0], msbuildPath) + .GetProcessStartInfo() + .Environment[envVar]) + .Should().NotBeNull("constructor will throw on invalid path"); + } + + [Fact] + public void ItSetsVbcToolExePathToValidPath() + { + var msbuildPath = ""; + var envVar = "VbcToolExe"; + new FileInfo(new MSBuildForwardingApp(new string[0], msbuildPath) + .GetProcessStartInfo() + .Environment[envVar]) + .Should().NotBeNull("constructor will throw on invalid path"); + } [Fact] public void ItSetsOrIgnoresTelemetrySessionId() From fead8521c3ace140ab127249c2f1d217c2dbcafc Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 3 Oct 2017 16:46:15 -0700 Subject: [PATCH 5/8] Moving the runtime version to 2.0.0 for the SDK. (cherry picked from commit e24b53dda7b05854085160c5214dcf75ead562b6) --- build/DependencyVersions.props | 2 +- .../GivenAProjectToolsCommandResolver.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 3c43151c8..4e39a1858 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -1,7 +1,7 @@ - 2.0.1 + 2.0.0 15.4.7 2.3.2-beta1-61921-05 2.3.0-pre-20170727-1 diff --git a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs index 7fe281b5d..83a877151 100644 --- a/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs +++ b/test/Microsoft.DotNet.Cli.Utils.Tests/GivenAProjectToolsCommandResolver.cs @@ -309,7 +309,7 @@ namespace Microsoft.DotNet.Tests result.Should().NotBeNull(); - result.Args.Should().Contain("--fx-version 2.0.1"); + result.Args.Should().Contain("--fx-version 2.0.0"); } [Fact] From b951b946293607b7789a6c4e39d2cb0b7b6eee36 Mon Sep 17 00:00:00 2001 From: jbeisner Date: Tue, 10 Oct 2017 10:34:32 -0700 Subject: [PATCH 6/8] Reverting previous change to: 'NuGet.master.config' --- NuGet.master.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.master.config b/NuGet.master.config index 0d17ce122..b004e5cc7 100644 --- a/NuGet.master.config +++ b/NuGet.master.config @@ -2,6 +2,6 @@ - + \ No newline at end of file From 903001c51c7bca5f37d340778e7a60611df13cb2 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Wed, 11 Oct 2017 10:25:55 -0700 Subject: [PATCH 7/8] 'NuGet.master.config' does not appear to be used. --- NuGet.master.config | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 NuGet.master.config diff --git a/NuGet.master.config b/NuGet.master.config deleted file mode 100644 index b004e5cc7..000000000 --- a/NuGet.master.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From 282de2bfe2d31d2a1aa2e8cc99115c8fe929ae8c Mon Sep 17 00:00:00 2001 From: John Beisner Date: Wed, 11 Oct 2017 10:53:53 -0700 Subject: [PATCH 8/8] Porting 'dotnet-install.sh' from CLI:master to CLI:release/2.0.0 --- scripts/obtain/dotnet-install.sh | 171 ++++++++++++++++--------------- 1 file changed, 86 insertions(+), 85 deletions(-) diff --git a/scripts/obtain/dotnet-install.sh b/scripts/obtain/dotnet-install.sh index a3a7b6ed8..1db273f24 100755 --- a/scripts/obtain/dotnet-install.sh +++ b/scripts/obtain/dotnet-install.sh @@ -240,7 +240,7 @@ to_lowercase() { remove_trailing_slash() { #eval $invocation - local input=${1:-} + local input="${1:-}" echo "${input%/}" return 0 } @@ -250,7 +250,7 @@ remove_trailing_slash() { remove_beginning_slash() { #eval $invocation - local input=${1:-} + local input="${1:-}" echo "${input#/}" return 0 } @@ -267,8 +267,8 @@ combine_paths() { return 1 fi - local root_path=$(remove_trailing_slash $1) - local child_path=$(remove_beginning_slash ${2:-}) + local root_path="$(remove_trailing_slash "$1")" + local child_path="$(remove_beginning_slash "${2:-}")" say_verbose "combine_paths: root_path=$root_path" say_verbose "combine_paths: child_path=$child_path" echo "$root_path/$child_path" @@ -288,10 +288,10 @@ get_machine_architecture() { get_normalized_architecture_from_architecture() { eval $invocation - local architecture=$(to_lowercase $1) - case $architecture in + local architecture="$(to_lowercase "$1")" + case "$architecture" in \) - echo "$(get_normalized_architecture_from_architecture $(get_machine_architecture))" + echo "$(get_normalized_architecture_from_architecture "$(get_machine_architecture)")" return 0 ;; amd64|x64) @@ -338,11 +338,11 @@ get_commit_hash_from_version_info() { is_dotnet_package_installed() { eval $invocation - local install_root=$1 - local relative_path_to_package=$2 - local specific_version=${3//[$'\t\r\n']} + local install_root="$1" + local relative_path_to_package="$2" + local specific_version="${3//[$'\t\r\n']}" - local dotnet_package_path=$(combine_paths $(combine_paths $install_root $relative_path_to_package) $specific_version) + local dotnet_package_path="$(combine_paths "$(combine_paths "$install_root" "$relative_path_to_package")" "$specific_version")" say_verbose "is_dotnet_package_installed: dotnet_package_path=$dotnet_package_path" if [ -d "$dotnet_package_path" ]; then @@ -360,10 +360,10 @@ is_dotnet_package_installed() { get_latest_version_info() { eval $invocation - local azure_feed=$1 - local channel=$2 - local normalized_architecture=$3 - local coherent=$4 + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local coherent="$4" local version_file_url=null if [ "$shared_runtime" = true ]; then @@ -377,7 +377,7 @@ get_latest_version_info() { fi say_verbose "get_latest_version_info: latest url: $version_file_url" - download $version_file_url + download "$version_file_url" return $? } @@ -389,28 +389,28 @@ get_latest_version_info() { get_specific_version_from_version() { eval $invocation - local azure_feed=$1 - local channel=$2 - local normalized_architecture=$3 - local version=$(to_lowercase $4) + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local version="$(to_lowercase "$4")" - case $version in + case "$version" in latest) local version_info - version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture false)" || return 1 + version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1 say_verbose "get_specific_version_from_version: version_info=$version_info" echo "$version_info" | get_version_from_version_info return 0 ;; coherent) local version_info - version_info="$(get_latest_version_info $azure_feed $channel $normalized_architecture true)" || return 1 + version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" true)" || return 1 say_verbose "get_specific_version_from_version: version_info=$version_info" echo "$version_info" | get_version_from_version_info return 0 ;; *) - echo $version + echo "$version" return 0 ;; esac @@ -424,13 +424,13 @@ get_specific_version_from_version() { construct_download_link() { eval $invocation - local azure_feed=$1 - local channel=$2 - local normalized_architecture=$3 - local specific_version=${4//[$'\t\r\n']} + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" local osname - osname=$(get_current_os_name) || return 1 + osname="$(get_current_os_name)" || return 1 local download_link=null if [ "$shared_runtime" = true ]; then @@ -451,13 +451,13 @@ construct_download_link() { construct_legacy_download_link() { eval $invocation - local azure_feed=$1 - local channel=$2 - local normalized_architecture=$3 - local specific_version=${4//[$'\t\r\n']} + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" local distro_specific_osname - distro_specific_osname=$(get_distro_specific_os_name) || return 1 + distro_specific_osname="$(get_distro_specific_os_name)" || return 1 local legacy_download_link=null if [ "$shared_runtime" = true ]; then @@ -474,7 +474,7 @@ get_user_install_path() { eval $invocation if [ ! -z "${DOTNET_INSTALL_DIR:-}" ]; then - echo $DOTNET_INSTALL_DIR + echo "$DOTNET_INSTALL_DIR" else echo "$HOME/.dotnet" fi @@ -488,7 +488,7 @@ resolve_installation_path() { local install_dir=$1 if [ "$install_dir" = "" ]; then - local user_install_path=$(get_user_install_path) + local user_install_path="$(get_user_install_path)" say_verbose "resolve_installation_path: user_install_path=$user_install_path" echo "$user_install_path" return 0 @@ -503,11 +503,11 @@ resolve_installation_path() { get_installed_version_info() { eval $invocation - local install_root=$1 - local version_file=$(combine_paths "$install_root" "$local_version_file_relative_path") + local install_root="$1" + local version_file="$(combine_paths "$install_root" "$local_version_file_relative_path")" say_verbose "Local version file: $version_file" if [ ! -z "$version_file" ] | [ -r "$version_file" ]; then - local version_info="$(cat $version_file)" + local version_info="$(cat "$version_file")" echo "$version_info" return 0 fi @@ -522,7 +522,7 @@ get_absolute_path() { eval $invocation local relative_or_absolute_path=$1 - echo $(cd $(dirname "$1") && pwd -P)/$(basename "$1") + echo "$(cd "$(dirname "$1")" && pwd -P)/$(basename "$1")" return 0 } @@ -534,17 +534,17 @@ get_absolute_path() { copy_files_or_dirs_from_list() { eval $invocation - local root_path=$(remove_trailing_slash $1) - local out_path=$(remove_trailing_slash $2) - local override=$3 + local root_path="$(remove_trailing_slash "$1")" + local out_path="$(remove_trailing_slash "$2")" + local override="$3" local override_switch=$(if [ "$override" = false ]; then printf -- "-n"; fi) cat | uniq | while read -r file_path; do - local path=$(remove_beginning_slash ${file_path#$root_path}) - local target=$out_path/$path + local path="$(remove_beginning_slash "${file_path#$root_path}")" + local target="$out_path/$path" if [ "$override" = true ] || (! ([ -d "$target" ] || [ -e "$target" ])); then - mkdir -p $out_path/$(dirname $path) - cp -R $override_switch $root_path/$path $target + mkdir -p "$out_path/$(dirname "$path")" + cp -R $override_switch "$root_path/$path" "$target" fi done } @@ -555,19 +555,19 @@ copy_files_or_dirs_from_list() { extract_dotnet_package() { eval $invocation - local zip_path=$1 - local out_path=$2 + local zip_path="$1" + local out_path="$2" - local temp_out_path=$(mktemp -d $temporary_file_template) + local temp_out_path="$(mktemp -d "$temporary_file_template")" local failed=false tar -xzf "$zip_path" -C "$temp_out_path" > /dev/null || failed=true local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' - find $temp_out_path -type f | grep -Eo $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path false - find $temp_out_path -type f | grep -Ev $folders_with_version_regex | copy_files_or_dirs_from_list $temp_out_path $out_path $override_non_versioned_files + find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false + find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - rm -rf $temp_out_path + rm -rf "$temp_out_path" if [ "$failed" = true ]; then say_err "Extraction failed" @@ -581,14 +581,14 @@ extract_dotnet_package() { download() { eval $invocation - local remote_path=$1 - local out_path=${2:-} + local remote_path="$1" + local out_path="${2:-}" local failed=false if machine_has "curl"; then - downloadcurl $remote_path $out_path || failed=true + downloadcurl "$remote_path" "$out_path" || failed=true elif machine_has "wget"; then - downloadwget $remote_path $out_path || failed=true + downloadwget "$remote_path" "$out_path" || failed=true else failed=true fi @@ -601,14 +601,14 @@ download() { downloadcurl() { eval $invocation - local remote_path=$1 - local out_path=${2:-} + local remote_path="$1" + local out_path="${2:-}" local failed=false if [ -z "$out_path" ]; then - curl --retry 10 -sSL -f --create-dirs $remote_path || failed=true + curl --retry 10 -sSL -f --create-dirs "$remote_path" || failed=true else - curl --retry 10 -sSL -f --create-dirs -o $out_path $remote_path || failed=true + curl --retry 10 -sSL -f --create-dirs -o "$out_path" "$remote_path" || failed=true fi if [ "$failed" = true ]; then say_verbose "Curl download failed" @@ -619,14 +619,14 @@ downloadcurl() { downloadwget() { eval $invocation - local remote_path=$1 - local out_path=${2:-} + local remote_path="$1" + local out_path="${2:-}" local failed=false if [ -z "$out_path" ]; then - wget -q --tries 10 -O - $remote_path || failed=true + wget -q --tries 10 -O - "$remote_path" || failed=true else - wget -v --tries 10 -O $out_path $remote_path || failed=true + wget -v --tries 10 -O "$out_path" "$remote_path" || failed=true fi if [ "$failed" = true ]; then say_verbose "Wget download failed" @@ -639,20 +639,20 @@ calculate_vars() { eval $invocation valid_legacy_download_link=true - normalized_architecture=$(get_normalized_architecture_from_architecture "$architecture") + normalized_architecture="$(get_normalized_architecture_from_architecture "$architecture")" say_verbose "normalized_architecture=$normalized_architecture" - specific_version=$(get_specific_version_from_version $azure_feed $channel $normalized_architecture $version) + specific_version="$(get_specific_version_from_version "$azure_feed" "$channel" "$normalized_architecture" "$version")" say_verbose "specific_version=$specific_version" if [ -z "$specific_version" ]; then say_err "Could not get version information." return 1 fi - download_link=$(construct_download_link $azure_feed $channel $normalized_architecture $specific_version) + download_link="$(construct_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")" say_verbose "download_link=$download_link" - legacy_download_link=$(construct_legacy_download_link $azure_feed $channel $normalized_architecture $specific_version) || valid_legacy_download_link=false + legacy_download_link="$(construct_legacy_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")" || valid_legacy_download_link=false if [ "$valid_legacy_download_link" = true ]; then say_verbose "legacy_download_link=$legacy_download_link" @@ -660,7 +660,7 @@ calculate_vars() { say_verbose "Cound not construct a legacy_download_link; omitting..." fi - install_root=$(resolve_installation_path $install_dir) + install_root="$(resolve_installation_path "$install_dir")" say_verbose "install_root=$install_root" } @@ -668,32 +668,33 @@ install_dotnet() { eval $invocation local download_failed=false - if is_dotnet_package_installed $install_root "sdk" $specific_version; then + if is_dotnet_package_installed "$install_root" "sdk" "$specific_version"; then say ".NET SDK version $specific_version is already installed." return 0 fi - mkdir -p $install_root - zip_path=$(mktemp $temporary_file_template) + mkdir -p "$install_root" + zip_path="$(mktemp "$temporary_file_template")" say_verbose "Zip path: $zip_path" say "Downloading link: $download_link" + # Failures are normal in the non-legacy case for ultimately legacy downloads. # Do not output to stderr, since output to stderr is considered an error. - download "$download_link" $zip_path 2>&1 || download_failed=true + download "$download_link" "$zip_path" 2>&1 || download_failed=true # if the download fails, download the legacy_download_link if [ "$download_failed" = true ] && [ "$valid_legacy_download_link" = true ]; then say "Cannot download: $download_link" - download_link=$legacy_download_link - zip_path=$(mktemp $temporary_file_template) + download_link="$legacy_download_link" + zip_path="$(mktemp "$temporary_file_template")" say_verbose "Legacy zip path: $zip_path" say "Downloading legacy link: $download_link" - download "$download_link" $zip_path + download "$download_link" "$zip_path" fi say "Extracting zip from $download_link" - extract_dotnet_package $zip_path $install_root + extract_dotnet_package "$zip_path" "$install_root" return 0 } @@ -717,11 +718,11 @@ override_non_versioned_files=true while [ $# -ne 0 ] do - name=$1 - case $name in + name="$1" + case "$name" in -c|--channel|-[Cc]hannel) shift - channel=$1 + channel="$1" ;; -v|--version|-[Vv]ersion) shift @@ -764,7 +765,7 @@ do override_non_versioned_files=false ;; -?|--?|-h|--help|-[Hh]elp) - script_name="$(basename $0)" + script_name="$(basename "$0")" echo ".NET Tools Installer" echo "Usage: $script_name [-c|--channel ] [-v|--version ] [-p|--prefix ]" echo " $script_name -h|-?|--help" @@ -830,17 +831,17 @@ if [ "$dry_run" = true ]; then if [ "$valid_legacy_download_link" = true ]; then say "Legacy payload URL: $legacy_download_link" fi - say "Repeatable invocation: ./$(basename $0) --version $specific_version --channel $channel --install-dir $install_dir" + say "Repeatable invocation: ./$(basename "$0") --version $specific_version --channel $channel --install-dir $install_dir" exit 0 fi check_pre_reqs install_dotnet -bin_path=$(get_absolute_path $(combine_paths $install_root $bin_folder_relative_path)) +bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")" if [ "$no_path" = false ]; then say "Adding to current process PATH: \`$bin_path\`. Note: This change will be visible only when sourcing script." - export PATH=$bin_path:$PATH + export PATH="$bin_path":"$PATH" else say "Binaries of dotnet can be found in $bin_path" fi