Exemplo n.º 1
0
        public static Command Create(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(
                commandResolverPolicy,
                commandName,
                args,
                framework,
                configuration: configuration,
                outputPath: outputPath,
                applicationName: applicationName);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return(command);
        }
Exemplo n.º 2
0
        public static Command Create(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandSpec = CommandResolver.TryResolveCommandSpec(
                commandResolverPolicy,
                commandName,
                args,
                framework,
                configuration: configuration,
                outputPath: outputPath,
                applicationName: applicationName);

            if (commandSpec == null)
            {
                if (_knownCommandsAvailableAsDotNetTool.Contains(commandName, StringComparer.OrdinalIgnoreCase))
                {
                    throw new CommandAvailableAsDotNetToolException(commandName);
                }
                else
                {
                    throw new CommandUnknownException(commandName);
                }
            }

            var command = new Command(commandSpec);

            return(command);
        }
Exemplo n.º 3
0
            override protected Command CreateCommand(ICommandResolverPolicy resolverPolicy, List <string> commandArgs)
            {
                Command command = Command.Create(resolverPolicy, _executablePath, commandArgs);

                foreach (var envVar in _environmentVariables)
                {
                    command.EnvironmentVariable(envVar.Key, envVar.Value);
                }
                return(command);
            }
Exemplo n.º 4
0
            override protected Command CreateCommand(ICommandResolverPolicy resolverPolicy, List <string> commandArgs)
            {
                foreach (var envVar in _environmentVariables)
                {
                    commandArgs.Add("--codegenopt");
                    string complusPrefix = "COMPlus_";
                    commandArgs.Add(String.Format("{0}={1}", envVar.Key.Substring(complusPrefix.Length), envVar.Value));
                }
                Command command = Command.Create(resolverPolicy, _executablePath, commandArgs);

                return(command);
            }
Exemplo n.º 5
0
        public static CommandSpec TryResolveCommandSpec(
            ICommandResolverPolicy commandResolverPolicy,
            string commandName,
            IEnumerable <string> args,
            NuGetFramework framework = null,
            string configuration     = Constants.DefaultConfiguration,
            string outputPath        = null,
            string applicationName   = null)
        {
            var commandResolverArgs = new CommandResolverArguments
            {
                CommandName      = commandName,
                CommandArguments = args,
                Framework        = framework,
                ProjectDirectory = Directory.GetCurrentDirectory(),
                Configuration    = configuration,
                OutputPath       = outputPath,
                ApplicationName  = applicationName
            };

            var defaultCommandResolver = commandResolverPolicy.CreateCommandResolver();

            return(defaultCommandResolver.Resolve(commandResolverArgs));
        }
Exemplo n.º 6
0
 abstract protected Command CreateCommand(ICommandResolverPolicy resolverPolicy, List <string> commandArgs);