From 6695936718841ce63fbf66e632109c819f24d170 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Mon, 22 Jan 2018 13:26:57 -0800 Subject: [PATCH 1/4] Updating the CLI branding and version to 2.1.300. --- build/Branding.props | 2 +- build/Version.props | 4 ++-- packaging/osx/clisdk/resources/cs.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/de.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/en.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/es.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/fr.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/it.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ja.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ko.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/pl.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/ru.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/tr.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html | 2 +- packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html | 2 +- packaging/windows/clisdk/bundle.wxl | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build/Branding.props b/build/Branding.props index ade8799ad..eadbd0927 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -1,7 +1,7 @@ cli - Microsoft .NET Core SDK 2.2.0 - Preview + Microsoft .NET Core SDK 2.1.300 - Preview .NET Standard Support for Visual Studio 2015 Microsoft .NET Core Runtime 2.1.0 - Preview Microsoft .NET Core Host 2.1.0 - Preview diff --git a/build/Version.props b/build/Version.props index 6e311dd4d..7c3c70205 100644 --- a/build/Version.props +++ b/build/Version.props @@ -1,8 +1,8 @@ 2 - 2 - 0 + 1 + 300 preview1 $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix) diff --git a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/cs.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/cs.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/de.lproj/conclusion.html b/packaging/osx/clisdk/resources/de.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/de.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/de.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/en.lproj/conclusion.html b/packaging/osx/clisdk/resources/en.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/en.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/en.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/es.lproj/conclusion.html b/packaging/osx/clisdk/resources/es.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/es.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/es.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/fr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/fr.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/it.lproj/conclusion.html b/packaging/osx/clisdk/resources/it.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/it.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/it.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ja.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ja.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ko.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ko.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/pl.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pl.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/pt-br.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/ru.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/ru.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/tr.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/tr.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hans.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html index 6aa49976a..7d91816fd 100644 --- a/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html +++ b/packaging/osx/clisdk/resources/zh-hant.lproj/conclusion.html @@ -7,7 +7,7 @@

The following was installed at /usr/local/share/dotnet

    -
  • .NET Core SDK 2.2.0
  • +
  • .NET Core SDK 2.1.300
  • .NET Core Runtime 2.1.0
  • ASP.NET Core Runtime 2.1.0
diff --git a/packaging/windows/clisdk/bundle.wxl b/packaging/windows/clisdk/bundle.wxl index 2a8b6148f..09d08194b 100644 --- a/packaging/windows/clisdk/bundle.wxl +++ b/packaging/windows/clisdk/bundle.wxl @@ -50,7 +50,7 @@ The installation was successful The following were installed at [DOTNETHOME] - • .NET Core SDK 2.2.0 + • .NET Core SDK 2.1.300 • .NET Core Runtime 2.1.0 • ASP.NET Core Runtime 2.1.0 From 36c01137ad50e8a682d3d87df9d5529540c3a942 Mon Sep 17 00:00:00 2001 From: William Li Date: Mon, 22 Jan 2018 13:49:06 -0800 Subject: [PATCH 2/4] Separate tool package and shim file location --- .../CliFolderPathCalculator.cs | 13 +++++++---- .../ShellShim/EnvironmentPathFactory.cs | 6 ++--- src/dotnet/ShellShim/ShellShimMaker.cs | 5 ++++ .../dotnet-install-tool/InstallToolCommand.cs | 7 +++--- .../GivenAPathCalculator.cs | 23 +++++++++++++++++++ .../ShellShimMakerTests.cs | 14 +++++++++++ 6 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 test/Microsoft.DotNet.Configurer.UnitTests/GivenAPathCalculator.cs diff --git a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs index 71f740131..20901eb48 100644 --- a/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs +++ b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs @@ -12,20 +12,23 @@ namespace Microsoft.DotNet.Configurer { public class CliFolderPathCalculator { - private const string ToolsFolderName = "tools"; + // ToolsShimFolderName ToolPackageFolderName cannot be the same + // or if the PackageId is the same as CommandName, they will conflict on unix. + private const string ToolsShimFolderName = "tools"; + private const string ToolPackageFolderName = "toolspkgs"; private const string DotnetProfileDirectoryName = ".dotnet"; public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ?? Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder"); - public string ExecutablePackagesPath => Path.Combine(DotnetUserProfileFolderPath, ToolsFolderName); - - public BashPathUnderHomeDirectory ExecutablePackagesPathInUnix + public string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName); + public string ToolsPackagePath => Path.Combine(DotnetUserProfileFolderPath, ToolPackageFolderName); + public BashPathUnderHomeDirectory ToolsShimPathInUnix { get { return new BashPathUnderHomeDirectory(Environment.GetEnvironmentVariable("HOME"), - Path.Combine(DotnetProfileDirectoryName, ToolsFolderName)); + Path.Combine(DotnetProfileDirectoryName, ToolsShimFolderName)); } } diff --git a/src/dotnet/ShellShim/EnvironmentPathFactory.cs b/src/dotnet/ShellShim/EnvironmentPathFactory.cs index 55daa11f6..a60a4ba86 100644 --- a/src/dotnet/ShellShim/EnvironmentPathFactory.cs +++ b/src/dotnet/ShellShim/EnvironmentPathFactory.cs @@ -32,20 +32,20 @@ namespace Microsoft.DotNet.ShellShim if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { environmentPath = new WindowsEnvironmentPath( - cliFolderPathCalculator.ExecutablePackagesPath, + cliFolderPathCalculator.ToolsShimPath, Reporter.Output); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && hasSuperUserAccess) { environmentPath = new LinuxEnvironmentPath( - cliFolderPathCalculator.ExecutablePackagesPathInUnix, + cliFolderPathCalculator.ToolsShimPathInUnix, Reporter.Output, environmentProvider, new FileWrapper()); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && hasSuperUserAccess) { environmentPath = new OSXEnvironmentPath( - executablePath: cliFolderPathCalculator.ExecutablePackagesPathInUnix, + executablePath: cliFolderPathCalculator.ToolsShimPathInUnix, reporter: Reporter.Output, environmentProvider: environmentProvider, fileSystem: new FileWrapper()); diff --git a/src/dotnet/ShellShim/ShellShimMaker.cs b/src/dotnet/ShellShim/ShellShimMaker.cs index bf204a1ef..fe435ac0c 100644 --- a/src/dotnet/ShellShim/ShellShimMaker.cs +++ b/src/dotnet/ShellShim/ShellShimMaker.cs @@ -30,6 +30,11 @@ namespace Microsoft.DotNet.ShellShim { FilePath shimPath = GetShimPath(shellCommandName); + if (!Directory.Exists(shimPath.GetDirectoryPath().Value)) + { + Directory.CreateDirectory(shimPath.GetDirectoryPath().Value); + } + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { CreateConfigFile(shimPath.Value + ".config", entryPoint: packageExecutablePath, runner: "dotnet"); diff --git a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs index 276a681f5..7a689f9f1 100644 --- a/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs +++ b/src/dotnet/commands/dotnet-install/dotnet-install-tool/InstallToolCommand.cs @@ -49,12 +49,13 @@ namespace Microsoft.DotNet.Tools.Install.Tool } var cliFolderPathCalculator = new CliFolderPathCalculator(); - var executablePackagePath = new DirectoryPath(cliFolderPathCalculator.ExecutablePackagesPath); var offlineFeedPath = new DirectoryPath(cliFolderPathCalculator.CliFallbackFolderPath); - var toolConfigurationAndExecutablePath = ObtainPackage(executablePackagePath, offlineFeedPath); + var toolConfigurationAndExecutablePath = ObtainPackage( + executablePackagePath: new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath), + offlineFeedPath: offlineFeedPath); - var shellShimMaker = new ShellShimMaker(executablePackagePath.Value); + var shellShimMaker = new ShellShimMaker(cliFolderPathCalculator.ToolsShimPath); var commandName = toolConfigurationAndExecutablePath.Configuration.CommandName; shellShimMaker.EnsureCommandNameUniqueness(commandName); diff --git a/test/Microsoft.DotNet.Configurer.UnitTests/GivenAPathCalculator.cs b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAPathCalculator.cs new file mode 100644 index 000000000..a4d6eb558 --- /dev/null +++ b/test/Microsoft.DotNet.Configurer.UnitTests/GivenAPathCalculator.cs @@ -0,0 +1,23 @@ +// 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; +using System.Collections.Generic; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Tools.Test.Utilities; +using FluentAssertions; + +namespace Microsoft.DotNet.Configurer.UnitTests +{ + public class GivenAPathCalculator + { + [NonWindowsOnlyFact] + public void It_does_not_return_same_path_for_tools_package_and_tool_shim() + { + // shim name will conflict with the folder that is PackageId, if commandName and packageId are the same. + var cliFolderPathCalculator = new CliFolderPathCalculator(); + cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPath); + cliFolderPathCalculator.ToolsPackagePath.Should().NotBe(cliFolderPathCalculator.ToolsShimPathInUnix.Path); + } + } +} diff --git a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs index 75379aaae..fb6ea25e8 100644 --- a/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs +++ b/test/Microsoft.DotNet.ShellShim.Tests/ShellShimMakerTests.cs @@ -68,6 +68,20 @@ namespace Microsoft.DotNet.ShellShim.Tests stdOut.Should().Contain("Hello World"); } + [Fact] + public void GivenAnExecutablePathDirectoryThatDoesNotExistItCanGenerateShimFile() + { + var outputDll = MakeHelloWorldExecutableDll(); + var extraNonExistDirectory = Path.GetRandomFileName(); + var shellShimMaker = new ShellShimMaker(Path.Combine(TempRoot.Root, extraNonExistDirectory)); + var shellCommandName = nameof(ShellShimMakerTests) + Path.GetRandomFileName(); + + Action a = () => shellShimMaker.CreateShim( + outputDll.FullName, + shellCommandName); + a.ShouldNotThrow(); + } + [Theory] [InlineData("arg1 arg2", new[] { "arg1", "arg2" })] [InlineData(" \"arg1 with space\" arg2", new[] { "arg1 with space", "arg2" })] From 954e2de29e898258ce7d999eb2e1f8e1cb7a3de2 Mon Sep 17 00:00:00 2001 From: jbeisner Date: Tue, 23 Jan 2018 23:59:31 +0000 Subject: [PATCH 3/4] Fix non-fatal null exception when no extra parameters are passed. --- run-build.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 254da25d2..e7e5f7fb6 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -30,11 +30,14 @@ if($Help) # The first 'pass' call to "dotnet msbuild build.proj" has a hard-coded "WriteDynamicPropsToStaticPropsFiles" target # therefore, this call should not have other targets defined. Remove all targets passed in as 'extra parameters'. $ExtraParametersNoTargets = "" -foreach ($param in $ExtraParameters.split()) +if ($ExtraParameters) { - if((-not $param.StartsWith("/t")) -and (-not $param.StartsWith("/T"))) + foreach ($param in $ExtraParameters.split()) { - $ExtraParametersNoTargets += "{0} " -f $param + if((-not $param.StartsWith("/t")) -and (-not $param.StartsWith("/T"))) + { + $ExtraParametersNoTargets += "{0} " -f $param + } } } From c20517094dd0214a73ff4dbc82b01990bc8842e2 Mon Sep 17 00:00:00 2001 From: Vijay Ramakrishnan Date: Fri, 26 Jan 2018 18:12:54 -0800 Subject: [PATCH 4/4] Updating the WebSdk DependencyVersion to support local build --- build/DependencyVersions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index 22bc3d9cf..0d7d0712a 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,7 +16,7 @@ $(MicrosoftCodeAnalysisCSharpPackageVersion) 2.1.0-preview1-62516-03 $(MicrosoftNETSdkPackageVersion) - 2.0.0-rel-20171110-671 + 2.1.0-release21-20180126-1326543 $(MicrosoftNETSdkWebPackageVersion) $(MicrosoftNETSdkWebPackageVersion) 1.0.1-beta3-20180104-1263555