Merge pull request #2586 from Sridhar-MS/binding-redirects

Generate binding redirects for all executable package dependencies.
This commit is contained in:
Piotr Puszkiewicz 2016-04-25 17:04:19 -07:00
commit 7e0714d781
27 changed files with 765 additions and 84 deletions

View file

@ -266,7 +266,11 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public string GetExecutableExtension()
{
#if NET451
return ".exe";
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "";
#endif
}
private string BuildArgs()

View file

@ -0,0 +1,30 @@
// 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 Microsoft.DotNet.Cli.Utils;
using System.Runtime.InteropServices;
using Microsoft.DotNet.ProjectModel;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public class DependencyToolInvokerCommand : TestCommand
{
public DependencyToolInvokerCommand()
: base("dotnet")
{
}
public CommandResult Execute(string commandName, string framework, string additionalArgs)
{
var args = $"dependency-tool-invoker {commandName} --framework {framework} {additionalArgs}";
return base.Execute(args);
}
public CommandResult ExecuteWithCapturedOutput(string commandName, string framework, string additionalArgs)
{
var args = $"dependency-tool-invoker {commandName} --framework {framework} {additionalArgs}";
return base.ExecuteWithCapturedOutput(args);
}
}
}

View file

@ -104,7 +104,11 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public string GetExecutableExtension()
{
#if NET451
return ".exe";
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : "";
#endif
}
private string BuildArgs()

View file

@ -14,6 +14,8 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public class TestCommand
{
protected string _command;
private string _baseDirectory;
public string WorkingDirectory { get; set; }
@ -24,6 +26,11 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public TestCommand(string command)
{
_command = command;
#if NET451
_baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
#else
_baseDirectory = AppContext.BaseDirectory;
#endif
}
public virtual CommandResult Execute(string args = "")
@ -63,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
var command = _command;
ResolveCommand(ref command, ref args);
var commandPath = Env.GetCommandPath(command, ".exe", ".cmd", "") ??
Env.GetCommandPathFromRootPath(AppContext.BaseDirectory, command, ".exe", ".cmd", "");
Env.GetCommandPathFromRootPath(_baseDirectory, command, ".exe", ".cmd", "");
Console.WriteLine($"Executing (Captured Output) - {commandPath} {args}");
@ -102,7 +109,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
if (!Path.IsPathRooted(executable))
{
executable = Env.GetCommandPath(executable) ??
Env.GetCommandPathFromRootPath(AppContext.BaseDirectory, executable);
Env.GetCommandPathFromRootPath(_baseDirectory, executable);
}
}
@ -153,12 +160,17 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
Arguments = args,
RedirectStandardError = true,
RedirectStandardOutput = true,
RedirectStandardInput = true
RedirectStandardInput = true,
UseShellExecute = false
};
foreach (var item in Environment)
{
#if NET451
psi.EnvironmentVariables[item.Key] = item.Value;
#else
psi.Environment[item.Key] = item.Value;
#endif
}
if (!string.IsNullOrWhiteSpace(WorkingDirectory))