private void PopulatePipsAndFilesInGraph() { var pips = CachedGraph .PipTable .Keys .Where(IsRelevantPipType) .Select(CachedGraph.PipGraph.GetPipFromPipId); foreach (var pip in pips) { var allInputs = new List <AbsolutePath>(); var allOutputs = new List <AbsolutePath>(); GetDeclaredInputsForPip(pip, allInputs); GetObservedInputsForPip(pip, allInputs); GetOutputFilesForPip(pip, allOutputs); var downstreamPips = GetDownstreamPips(pip); var process = pip as Process; var inputDirs = (process != null && m_includeDirs) ? process.DirectoryDependencies.Select(x => x.Path).ToList() : new List <AbsolutePath>(); var outputDirs = (process != null && m_includeDirs) ? process.DirectoryOutputs.Select(x => x.Path).ToList() : new List <AbsolutePath>(); AddRange(m_allFiles, allInputs.Concat(allOutputs)); AddRange(m_allDirs, inputDirs.Concat(outputDirs)); var dependencyAnalyzerPip = new DependencyAnalyzerPip { PipId = pip.PipId, Description = GetPipDescription(pip), InputFiles = allInputs, InputDirs = inputDirs, OutputFiles = allOutputs, OutputDirs = outputDirs, DownstreamPips = downstreamPips, }; m_allPips.Add(dependencyAnalyzerPip); void AddRange <T>(HashSet <T> set, IEnumerable <T> elems) { foreach (var e in elems) { set.Add(e); } } } }
private void PopulatePipsAndFilesInGraph() { var pips = CachedGraph .PipTable .Keys .Where(IsRelevantPipType) .Select(CachedGraph.PipGraph.GetPipFromPipId); foreach (var pip in pips) { var allInputs = new HashSet <AbsolutePath>(); var allOutputs = new HashSet <AbsolutePath>(); GetDeclaredInputsForPip(pip, allInputs); GetObservedInputsForPip(pip, allInputs); GetOutputFilesForPip(pip, allOutputs); var downstreamPips = GetDownstreamPips(pip); var process = pip as Process; var inputDirs = (process != null && m_includeDirs) ? new HashSet <AbsolutePath>(process.DirectoryDependencies.Select(x => x.Path)) : new HashSet <AbsolutePath>(); var outputDirs = (process != null && m_includeDirs) ? new HashSet <AbsolutePath>(process.DirectoryOutputs.Select(x => x.Path)) : new HashSet <AbsolutePath>(); // Get all file members of opaque directory outputs, and add them to the // output files list of this pip if (process != null) { var outputFilesInOpaques = process.DirectoryOutputs.SelectMany(dir => { if (m_directoryContents.TryGetValue(dir, out var fileMembers)) { return(fileMembers); } else { return(Enumerable.Empty <FileArtifact>()); } }) .Select(fileArtifact => fileArtifact.Path); allOutputs.UnionWith(outputFilesInOpaques); } m_allFiles.UnionWith(allInputs); m_allFiles.UnionWith(allOutputs); m_allDirs.UnionWith(inputDirs); m_allDirs.UnionWith(outputDirs); var dependencyAnalyzerPip = new DependencyAnalyzerPip { PipId = pip.PipId, Description = GetPipDescription(pip), InputFiles = allInputs, InputDirs = inputDirs, OutputFiles = allOutputs, OutputDirs = outputDirs, DownstreamPips = downstreamPips, }; m_allPips.Add(dependencyAnalyzerPip); } }