[WIP] Removes *3 verbs, making msbuild the driver (#4456)

Removes *3 verbs, making msbuild the driver
This commit is contained in:
Piotr Puszkiewicz 2016-10-27 18:46:43 -07:00 committed by GitHub
parent 55c59d621e
commit 6fcbefa4f7
746 changed files with 4256 additions and 32434 deletions

View file

@ -1,70 +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.Linq;
using System.Threading.Tasks;
using System;
using Microsoft.DotNet.Cli.Utils;
using System.Runtime.InteropServices;
using Microsoft.DotNet.ProjectModel;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public sealed class RunCommand : TestCommand
{
private string _projectPath;
private string _framework;
private string _configuration;
private bool _preserveTemporary;
private string _appArgs;
private string ProjectPathOption => string.IsNullOrEmpty(_projectPath) ? "" : $"-p \"{_projectPath}\"";
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
private string ConfigurationOption => string.IsNullOrEmpty(_configuration) ? "" : $"-c {_configuration}";
private string AppArgsArgument => _appArgs;
public RunCommand(
string projectPath,
string framework = "",
string configuration = "",
string appArgs = "")
public RunCommand()
: base("dotnet")
{
_projectPath = projectPath;
_framework = framework;
_configuration = configuration;
_appArgs = appArgs;
}
public override CommandResult Execute(string args = "")
{
args = $"run {BuildArgs()} {args}";
args = $"run {args}";
return base.Execute(args);
}
public override CommandResult ExecuteWithCapturedOutput(string args = "")
{
args = $"run {BuildArgs()} {args}";
args = $"run {args}";
return base.ExecuteWithCapturedOutput(args);
}
public override Task<CommandResult> ExecuteAsync(string args = "")
{
args = $"run {BuildArgs()} {args}";
return base.ExecuteAsync(args);
}
private string BuildArgs()
{
return string.Join(" ",
new[]
{
ProjectPathOption,
FrameworkOption,
ConfigurationOption,
AppArgsArgument,
}
.Where(s => !string.IsNullOrEmpty(s)));
}
}
}