Merge branch 'master' of /Users/livarcocc/Documents/git/cli into merge_master_cli

* 'master' of /Users/livarcocc/Documents/git/cli: (1063 commits)
  Updating signing project to use new intermediate directory (int).
  Update runtimeconfig.json doc for 2.1 (#9382)
  Shortening the path to the intermediate folder by renaming it to int.
  fix typo (#9364)
  Updating asp.net to 2.2.0 as well.
  Updating the build and tests to work with the 2.2.0 runtime.
  Simplified combining dictionaries in Telemetry
  Fixing 'Channel' and 'BranchName': "release/2.1.4xx" to "master" (#9362)
  Fix extraction of folders (#9335)
  Update Sha256Hasher.cs
  Fix relative path tool path (#9330)
  Insert updated SDK from 2.1.4xx branch
  MSBuild 15.8.60
  Fix crash when user home directory cannot be determined.
  Make `CliFolderPathCalculator` a static class.
  Don't add the ReleaseSuffix to the branding on the CLI when DropSuffix is set to true.
  Add retry when Directory.Move (#9313)
  Override new SdkResult public properties
  Add reference to Microsoft.Build.NuGetSdkResolver
  Disable crossgen for MSBuild inline-task refs
  ...
This commit is contained in:
Livar Cunha 2018-06-25 22:38:01 -07:00
commit e2b679c4bb
210 changed files with 4436 additions and 1701 deletions

View file

@ -69,6 +69,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return new AndConstraint<CommandResultAssertions>(this);
}
public AndConstraint<CommandResultAssertions> NotHaveStdOutContaining(string pattern)
{
Execute.Assertion.ForCondition(!_commandResult.StdOut.Contains(pattern))
.FailWith(AppendDiagnosticsTo($"The command output contained a result it should not have contained: {pattern}{Environment.NewLine}"));
return new AndConstraint<CommandResultAssertions>(this);
}
public AndConstraint<CommandResultAssertions> HaveStdOutMatching(string pattern, RegexOptions options = RegexOptions.None)
{
Execute.Assertion.ForCondition(Regex.Match(_commandResult.StdOut, pattern, options).Success)

View file

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class BufferedReporter : IReporter
{
public List<string> Lines { get; private set; } = new List<string>();
public void WriteLine(string message)
{
Lines.Add(message);
}
public void WriteLine()
{
Lines.Add("");
}
public void Write(string message)
{
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,20 @@
// 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 Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public sealed class BuildServerCommand : DotnetCommand
{
public override CommandResult Execute(string args = "")
{
return base.Execute($"build-server {args}");
}
public override CommandResult ExecuteWithCapturedOutput(string args = "")
{
return base.ExecuteWithCapturedOutput($"build-server {args}");
}
}
}

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return null;
}
return $"/p:RuntimeIdentifier={_runtime}";
return $"-property:RuntimeIdentifier={_runtime}";
}
}
}

View file

@ -35,7 +35,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return null;
}
return $"/p:RuntimeIdentifier={_runtime}";
return $"-property:RuntimeIdentifier={_runtime}";
}
}
}

View file

@ -0,0 +1,20 @@
// 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 Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public sealed class ToolCommand : DotnetCommand
{
public override CommandResult Execute(string args = "")
{
return base.Execute($"tool {args}");
}
public override CommandResult ExecuteWithCapturedOutput(string args = "")
{
return base.ExecuteWithCapturedOutput($"tool {args}");
}
}
}

View file

@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Description>Microsoft.DotNet.Tools.Tests.Utilities Class Library</Description>
<TargetFramework>netstandard1.5</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Microsoft.DotNet.Tools.Tests.Utilities</AssemblyName>
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
@ -16,7 +17,7 @@
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.18.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(ToolsetVersion)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.Utils" Version="$(MicrosoftDotNetCliUtilsPackageVersion)" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,17 @@
using NuGet.Frameworks;
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.DotNet.Tools.Tests.Utilities
{
// This class is for frameworks that aren't yet in NuGet's FrameworkConstants.CommonFrameworks class
public static class NuGetFrameworks
{
public static readonly NuGetFramework NetCoreApp21
= new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.NetCoreApp, new Version(2, 1, 0, 0));
public static readonly NuGetFramework NetCoreApp22
= new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.NetCoreApp, new Version(2, 2, 0, 0));
}
}

View file

@ -3,5 +3,8 @@
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyModel.Tests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.Configurer.UnitTests , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ToolPackage.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.DotNet.ShellShim.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

View file

@ -15,6 +15,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private static string s_buildRid;
private string _artifacts;
private string _dotnetRoot;
private string _builtDotnet;
private string _nugetPackages;
private string _stage2Sdk;
@ -37,9 +38,14 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
string directory = AppContext.BaseDirectory;
#endif
while (!Directory.Exists(Path.Combine(directory, ".git")) && directory != null)
while (directory != null)
{
directory = Directory.GetParent(directory).FullName;
var gitDirOrFile = Path.Combine(directory, ".git");
if (Directory.Exists(gitDirOrFile) || File.Exists(gitDirOrFile))
{
break;
}
directory = Directory.GetParent(directory)?.FullName;
}
if (directory == null)
@ -80,6 +86,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public string Artifacts => _artifacts;
public string BuiltDotnet => _builtDotnet;
public string DotnetRoot => _dotnetRoot;
public string NugetPackages => _nugetPackages;
public string Stage2Sdk => _stage2Sdk;
public string Stage2WithBackwardsCompatibleRuntimesDirectory => _stage2WithBackwardsCompatibleRuntimesDirectory;
@ -101,6 +108,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
previousStage.ToString(),
BuildRid);
_builtDotnet = builtDotnet ?? Path.Combine(_artifacts, "intermediate", "sharedFrameworkPublish");
_dotnetRoot = Path.Combine(_artifacts, "dotnet");
_nugetPackages = nugetPackages ?? Path.Combine(RepoRoot, ".nuget", "packages");
_stage2Sdk = Directory
.EnumerateDirectories(Path.Combine(_artifacts, "dotnet", "sdk"))
@ -112,7 +120,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
_testPackages = Environment.GetEnvironmentVariable("TEST_PACKAGES");
if (string.IsNullOrEmpty(_testPackages))
{
throw new InvalidOperationException("TEST_PACKAGES environment variable not set");
_testPackages = Path.Combine(_artifacts, "test", "packages");
}
_testWorkingFolder = Path.Combine(RepoRoot,

View file

@ -0,0 +1,19 @@
// 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 Microsoft.DotNet.PlatformAbstractions;
using Xunit;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class UnixOnlyFactAttribute : FactAttribute
{
public UnixOnlyFactAttribute()
{
if (RuntimeEnvironment.OperatingSystemPlatform == Platform.Windows)
{
this.Skip = "This test requires Unix to run";
}
}
}
}