Ejemplo n.º 1
0
        public void RestoreNugets(RunnerOptions options, IProgressTask task)
        {
            if (options.NoRestore)
            {
                task.Increment(100);
                return;
            }

            Solutions.IncrementForEach(task, 100, sln => sln.RestoreNugets(options));
        }
Ejemplo n.º 2
0
        public async Task AddTransitiveReferences(RunnerOptions options, IProgressTask task)
        {
            var projects = await Solutions.Select(sln => sln.Projects.Value)
                           .WhenAll(projs => projs.SelectMany(proj => proj)
                                    .Distinct());

            projects.IncrementForEach(task, 100, project =>
            {
                project.AddTransitiveReferences(this, options);
            });
        }
 public Task StartProgressContext(RunnerOptions options, Func <IProgressContext, Task> predicate)
 => AnsiConsole.Progress()
 .AutoRefresh(true)
 .AutoClear(options.Verbosity != TraceLevel.Verbose)
 .Columns(
     new TaskDescriptionColumn()
 {
     Alignment = Justify.Left
 },
     new ProgressBarColumn()
 {
     Width = null
 },
     new PercentageColumn(),
     new ElapsedTimeColumn(),
     new SpinnerColumn(Spinner.Known.Dots12)
     )
 .StartAsync(ctx => predicate(new SpectreProgressContext(ctx)));
Ejemplo n.º 4
0
        public async Task RunAsync(RunnerOptions options)
        {
            try
            {
                await _outputWriter.StartProgressContext(options, async ctx =>
                {
                    _outputWriter.LogLevel = options.Verbosity;

                    var workspace = await ctx.WithTaskAsync("Loading projects/solutions", task => Workspace.CreateAsync(_outputWriter, options.Solutions, task));
                    await LogWorkspaceSolutionsAsync(workspace);

                    if (options.Undo)
                    {
                        await ctx.WithTaskAsync("Removing ProjectReferences", task => workspace.RemoveReferencesAsync(task));
                        await ctx.WithTaskAsync("Removing projects from solution", task => workspace.CleanupSolutionsAsync(task));
                    }
                    else
                    {
                        await ctx.WithTaskAsync("Adding ProjectReferences for direct references", task => workspace.AddReferencesAsync(task));
                        await ctx.WithTaskAsync("Checking for circular references", task => workspace.CheckForCircularReferences(task));
                        ctx.WithTask("Running NuGet restore", task => workspace.RestoreNugets(options, task));
                        await ctx.WithTaskAsync("Adding ProjectReferences for transitive references", task => workspace.AddTransitiveReferences(options, task));
                        await ctx.WithTaskAsync("Populating solutions", task => workspace.PopulateSolutionsAsync(task));
                    }

                    await ctx.WithTaskAsync("Writing changes", task => workspace.CommitChangesAsync(false, task));
                    _outputWriter.PrintComplete(await workspace.Solutions
                                                .Select(sln => sln.Projects.Value)
                                                .WhenAll(projects => projects.SelectMany(projs => projs)
                                                         .Where(proj => proj.Changes.Any())
                                                         .Count()));
                });
            }
            catch (Exception ex)
            {
                HandleExceptions(ex);
            }
        }
Ejemplo n.º 5
0
 public Task StartProgressContext(RunnerOptions options, Func <IProgressContext, Task> predicate)
 => predicate(new NullProgressContext());