示例#1
0
        public static void Main(String[] args)
        {
            String toolName = typeof(Program).GetTypeInfo().Assembly.GetName().Name;
            String path = Path.GetFullPath(Directory.GetCurrentDirectory());
            GennyApplication application = new GennyApplication();
            Project project = ProjectReader.GetProject(path);
            application.Name = project.Name;
            application.BasePath = path;

            if (args.Contains("--no-dispatch"))
            {
                new GennyCommand(application).Execute(args.Where(arg => arg != "--no-dispatch").ToArray());
            }
            else
            {
                ProjectDependenciesCommandFactory factory = new ProjectDependenciesCommandFactory(
                    project.GetTargetFrameworks().FirstOrDefault().FrameworkName,
                    Constants.DefaultConfiguration,
                    null,
                    null,
                    path);

                factory
                    .Create(toolName, args.Concat(new[] { "--no-dispatch" }).ToArray())
                    .ForwardStdErr()
                    .ForwardStdOut()
                    .Execute();
            }
        }
示例#2
0
        public static int Main(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            var dotnetParams = new DotnetBaseParams("dotnet-dependency-tool-invoker", "DotNet Dependency Tool Invoker", "Invokes tools declared as NuGet dependencies of a project");
            
            dotnetParams.Parse(args);
            
            if (string.IsNullOrEmpty(dotnetParams.Command))
            {
                Console.WriteLine("A command name must be provided");
                
                return 1;
            }
            
            var projectContexts = 
                CreateProjectContexts(dotnetParams.ProjectPath)
                    .Where(p => dotnetParams.Framework == null ||
                                dotnetParams.Framework.GetShortFolderName()
                                .Equals(p.TargetFramework.GetShortFolderName()));
            
            var commandFactory =
                new ProjectDependenciesCommandFactory(
                    dotnetParams.Framework,
                    dotnetParams.Config,
                    dotnetParams.Output,
                    dotnetParams.BuildBasePath,
                    projectContexts.First().ProjectDirectory);
                    
            foreach (var projectContext in projectContexts)
            {
                Console.WriteLine($"Invoking '{dotnetParams.Command}' for '{projectContext.TargetFramework}'.");

                try
                {
                    var exitCode = commandFactory.Create(
                            $"dotnet-{dotnetParams.Command}",
                            dotnetParams.RemainingArguments,
                            projectContext.TargetFramework,
                            dotnetParams.Config)
                        .ForwardStdErr()
                        .ForwardStdOut()
                        .Execute()
                        .ExitCode;
                    
                    Console.WriteLine($"Command returned {exitCode}");
                }
                catch (CommandUnknownException)
                {
                    Console.WriteLine($"Command not found");
                    return 1;
                }
            }
            return 0;
        }
示例#3
0
        public static int Main(string[] args)
        {
            return StorytellerRunner.Program.Main(args);


            var dotnetParams = new DotnetBaseParams("dotnet-storyteller", "Storyteller Runner", "Run or edit Storyteller specifications");

            dotnetParams.Parse(args);

            var projectContexts =
                CreateProjectContexts(dotnetParams.ProjectPath)
                    .Where(p => dotnetParams.Framework == null ||
                                dotnetParams.Framework.GetShortFolderName()
                                .Equals(p.TargetFramework.GetShortFolderName()));

            var commandFactory =
                new ProjectDependenciesCommandFactory(
                    dotnetParams.Framework,
                    dotnetParams.Config,
                    dotnetParams.Output,
                    dotnetParams.BuildBasePath,
                    projectContexts.First().ProjectDirectory);

            

            foreach (var projectContext in projectContexts)
            {
                Console.WriteLine($"Invoking '{dotnetParams.Command}' for '{projectContext.TargetFramework}'.");

                try
                {
                    var exitCode = commandFactory.Create(
                            $"StorytellerRunner",
                            dotnetParams.RemainingArguments,
                            projectContext.TargetFramework,
                            dotnetParams.Config)
                        .ForwardStdErr()
                        .ForwardStdOut()
                        .Execute()
                        .ExitCode;

                    Console.WriteLine($"Command returned {exitCode}");
                }
                catch (CommandUnknownException)
                {
                    Console.WriteLine($"Command not found");
                    return 1;
                }
            }
            return 0;
        }
示例#4
0
        internal override int DoRunTests(ProjectContext projectContext, DotnetTestParams dotnetTestParams)
        {
            var commandFactory =
                new ProjectDependenciesCommandFactory(
                    projectContext.TargetFramework,
                    dotnetTestParams.Config,
                    dotnetTestParams.Output,
                    dotnetTestParams.BuildBasePath,
                    projectContext.ProjectDirectory);

            return commandFactory.Create(
                    GetCommandName(projectContext.ProjectFile.TestRunner),
                    GetCommandArgs(projectContext, dotnetTestParams),
                    projectContext.TargetFramework,
                    dotnetTestParams.Config)
                .Execute()
                .ExitCode;
        }
示例#5
0
文件: Program.cs 项目: ericstj/cli
        private static int RunConsole(
            ProjectContext projectContext,
            CommandLineApplication app,
            string testRunner,
            string configuration,
            string outputPath)
        {
            var commandArgs = new List<string> { GetAssemblyUnderTest(projectContext, configuration, outputPath) };
            commandArgs.AddRange(app.RemainingArguments);

            var commandFactory = 
                new ProjectDependenciesCommandFactory(
                    projectContext.TargetFramework, 
                    configuration, 
                    outputPath,
                    projectContext.ProjectDirectory);
            

            return commandFactory.Create(
                    $"dotnet-{GetCommandName(testRunner)}",
                    commandArgs,
                    projectContext.TargetFramework,
                    configuration)
                .ForwardStdErr()
                .ForwardStdOut()
                .Execute()
                .ExitCode;
        }