static int Execute(int maxLogsPerGraph, bool writeGraphviz, List <string> excludeVariants) { if (!Helper.TryFindRoot(out var rootDir)) { return(1); } if (maxLogsPerGraph == int.MaxValue) { Console.WriteLine($"The first {maxLogsPerGraph} restore logs will be used per request graph."); } else { Console.WriteLine($"No limit will be applied to the number of restore logs per request graph."); } var logDir = Path.Combine(rootDir, "out", "logs"); var graphs = RestoreLogParser.ParseAndMergeGraphs(logDir, excludeVariants.ToHashSet(), maxLogsPerGraph); var writtenNames = new HashSet <string>(); for (int index = 0; index < graphs.Count; index++) { var graph = graphs[index]; string fileName = Helper.GetGraphFileName(RequestGraph.Type, graph.VariantName, graph.SolutionName); if (writtenNames.Contains(fileName)) { Console.WriteLine($" WARNING: The output file {fileName} has already been written."); Console.WriteLine($" Consider including a variant name in the restore log file name to differentiate variants."); Console.WriteLine($" Output data is grouped by variant name, solution name, and set of package sources."); } Console.WriteLine($"Preparing {fileName}..."); GraphOperations.LazyTransitiveReduction(graph.Graph); var filePath = Path.Combine(rootDir, "out", "graphs", fileName); var outDir = Path.GetDirectoryName(filePath); Directory.CreateDirectory(outDir); if (writeGraphviz) { var gvPath = $"{filePath}.gv"; Console.WriteLine($" Writing {gvPath}..."); RequestGraphSerializer.WriteToGraphvizFile(gvPath, graph.Graph); } var jsonGzPath = $"{filePath}.json.gz"; Console.WriteLine($" Writing {jsonGzPath}..."); RequestGraphSerializer.WriteToFile(jsonGzPath, graph.Graph); writtenNames.Add(fileName); } return(0); }