public void TestAddSealDirectory() { var root = CreateUniqueSourcePath("root"); var seal = CreateSealDirectory(root, SealDirectoryKind.Partial); PipGraphBuilder.AddSealDirectory(seal); var builder = new PatchablePipGraph( oldPipGraph: PipGraphBuilder.DirectedGraph, oldPipTable: PipTable, graphBuilder: CreatePipGraphBuilder(), maxDegreeOfParallelism: Environment.ProcessorCount); var stats = builder.PartiallyReloadGraph(new HashSet <AbsolutePath>()); Assert.Equal(1, stats.NumPipsReloaded); }
private GraphReloadResult ReloadGraph(Pip[] procs, params int[] affectedIndexes) { XAssert.All(affectedIndexes, i => Assert.True(i >= 0 && i < procs.Length)); // add meta pips only for non-affected processes, because they should be present in the reloaded graph var nonAffectedIndexes = Enumerable.Range(0, procs.Length).Except(affectedIndexes); var nonAffectedProcs = nonAffectedIndexes.Select(i => procs[i]).ToArray(); // partially reload graph into the newly created PipGraph.Builder var builder = new PatchablePipGraph( oldPipGraph: PipGraphBuilder.DirectedGraph, oldPipTable: PipTable, graphBuilder: CreatePipGraphBuilder(), maxDegreeOfParallelism: Environment.ProcessorCount); var affectedSpecs = affectedIndexes.Select(i => procs[i].Provenance.Token.Path); var reloadingStats = builder.PartiallyReloadGraph(new HashSet <AbsolutePath>(affectedSpecs)); // build and return the new PipGraph together with the statistics of graph reloading return(new GraphReloadResult() { PipGraph = builder.Build(), Stats = reloadingStats }); }