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