Example #1
0
        public Component.Build HandleEvents(params BuildEventArgs[] buildEvents)
        {
            foreach (var buildEvent in buildEvents)
            {
                _eventArgsDispatcher.Dispatch(buildEvent);
            }

            var build = new Component.Build();

            AddProjects(build);
            AddLogs(build);

            return(build);
        }
Example #2
0
        private static void PrintProjectNodes(Component.Build build)
        {
            PrintBuild(build, printErrors: true, printWarnings: true);

            var projectGraph = new DirectedAcyclicGraph <ProjectNode_BeforeThis>(build.ProjectsById.Values.Select(project => project.Node_BeforeThis));

            PrintProjectGraph(projectGraph);
            PrintProjectTopologicalOrdering(projectGraph);
            PrintReachableProjects(projectGraph);
            PrintReversedProjectGraph(projectGraph);

            // PrintAllLogs(build.AllMessages, "all messages:");
            PrintAllLogs(build.AllWarnings, "all warnings:");
            PrintAllLogs(build.AllErrors, "all errors:");
        }
Example #3
0
        private static void PrintBuild(
            Component.Build build,
            string header         = "build:",
            bool printTargetGraph = false,
            bool printMessages    = false,
            bool printWarnings    = false,
            bool printErrors      = false)
        {
            Console.WriteLine(header);

            foreach (var project in build.ProjectsById.Values)
            {
                Console.WriteLine($"  project #{project.Id}: {project.ProjectFile}");

                foreach (var target in project.OrderedTargets)
                {
                    Console.WriteLine($"    target #{target.Id} {target.Name}");

                    if (printTargetGraph)
                    {
                        Console.WriteLine($"      directly before this: {string.Join(";", target.Node_BeforeThis.AdjacentNodes.Select(beforeThis => beforeThis.TargetInfo.Name))}");
                        Console.WriteLine($"      directly after this: {string.Join(";", target.Node_AfterThis.AdjacentNodes.Select(afterThis => afterThis.TargetInfo.Name))}");
                    }

                    foreach (var task in target.OrderedTasks)
                    {
                        Console.WriteLine($"      task #{task.Id} {task.Name}");
                        PrintComponentLogs(task, printMessages, printWarnings, printErrors, "        ");
                    }

                    PrintComponentLogs(target, printMessages, printWarnings, printErrors, "      ");
                }

                PrintComponentLogs(project, printMessages, printWarnings, printErrors, "    ");
            }

            PrintComponentLogs(build, printMessages, printWarnings, printErrors, "  ");

            Console.WriteLine();
        }