2017-03-02 21:04:03 -08:00
|
|
|
|
// 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.Collections.Generic;
|
2016-01-06 02:27:16 -08:00
|
|
|
|
using System.IO;
|
2016-02-10 16:13:30 -08:00
|
|
|
|
using NuGet.Frameworks;
|
2016-01-06 02:27:16 -08:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Utils
|
|
|
|
|
{
|
2016-10-03 21:40:24 -07:00
|
|
|
|
internal class CommandResolver
|
2016-01-06 02:27:16 -08:00
|
|
|
|
{
|
2016-02-24 16:05:55 -08:00
|
|
|
|
public static CommandSpec TryResolveCommandSpec(
|
2016-04-28 16:30:32 -07:00
|
|
|
|
string commandName,
|
|
|
|
|
IEnumerable<string> args,
|
|
|
|
|
NuGetFramework framework = null,
|
|
|
|
|
string configuration = Constants.DefaultConfiguration,
|
2016-08-25 16:01:32 -07:00
|
|
|
|
string outputPath = null,
|
|
|
|
|
string applicationName = null)
|
2016-10-03 21:40:24 -07:00
|
|
|
|
{
|
|
|
|
|
return TryResolveCommandSpec(
|
|
|
|
|
new DefaultCommandResolverPolicy(),
|
|
|
|
|
commandName,
|
|
|
|
|
args,
|
|
|
|
|
framework,
|
|
|
|
|
configuration,
|
|
|
|
|
outputPath,
|
|
|
|
|
applicationName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static CommandSpec TryResolveCommandSpec(
|
|
|
|
|
ICommandResolverPolicy commandResolverPolicy,
|
|
|
|
|
string commandName,
|
|
|
|
|
IEnumerable<string> args,
|
|
|
|
|
NuGetFramework framework = null,
|
|
|
|
|
string configuration = Constants.DefaultConfiguration,
|
|
|
|
|
string outputPath = null,
|
|
|
|
|
string applicationName = null)
|
2016-01-06 02:27:16 -08:00
|
|
|
|
{
|
2016-02-24 16:05:55 -08:00
|
|
|
|
var commandResolverArgs = new CommandResolverArguments
|
2016-01-06 02:27:16 -08:00
|
|
|
|
{
|
2016-02-24 16:05:55 -08:00
|
|
|
|
CommandName = commandName,
|
|
|
|
|
CommandArguments = args,
|
|
|
|
|
Framework = framework,
|
|
|
|
|
ProjectDirectory = Directory.GetCurrentDirectory(),
|
2016-03-03 15:31:04 -08:00
|
|
|
|
Configuration = configuration,
|
2016-08-25 16:01:32 -07:00
|
|
|
|
OutputPath = outputPath,
|
|
|
|
|
ApplicationName = applicationName
|
2016-02-24 16:05:55 -08:00
|
|
|
|
};
|
2016-04-28 16:30:32 -07:00
|
|
|
|
|
2016-10-03 21:40:24 -07:00
|
|
|
|
var defaultCommandResolver = commandResolverPolicy.CreateCommandResolver();
|
2016-04-28 16:30:32 -07:00
|
|
|
|
|
2016-03-07 11:50:52 -08:00
|
|
|
|
return defaultCommandResolver.Resolve(commandResolverArgs);
|
2016-01-22 14:03:40 -08:00
|
|
|
|
}
|
2016-01-06 02:27:16 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-22 14:03:40 -08:00
|
|
|
|
|