private void PostAnalyzeBuild(Build build)
        {
            if (!build.Succeeded)
            {
                build.AddChild(new Error {
                    Text = "Build failed."
                });
            }
            else
            {
                build.AddChild(new Item {
                    Text = "Build succeeded."
                });
            }

            build.AddChild(new Property {
                Name = "Duration", Value = build.DurationText
            });

            doubleWritesAnalyzer.AppendDoubleWritesFolder(build);
            resolveAssemblyReferenceAnalyzer.AppendFinalReport(build);

            if (build.LogFilePath != null)
            {
                build.AddChildAtBeginning(new Item {
                    Text = build.LogFilePath
                });
            }

            var durations = taskDurations
                            .OrderByDescending(kvp => kvp.Value)
                            .Where(kvp => // no need to include MSBuild and CallTarget tasks as they are not "terminal leaf" tasks
                                   !string.Equals(kvp.Key, "MSBuild", StringComparison.OrdinalIgnoreCase) &&
                                   !string.Equals(kvp.Key, "CallTarget", StringComparison.OrdinalIgnoreCase))
                            .Take(10)
                            .ToArray();

            if (durations.Length > 0)
            {
                var top10Tasks = build.GetOrCreateNodeWithName <Folder>($"Top {durations.Count()} most expensive tasks");
                foreach (var kvp in durations)
                {
                    top10Tasks.AddChild(new Item {
                        Name = kvp.Key, Text = TextUtilities.DisplayDuration(kvp.Value)
                    });
                }
            }

            if (analyzerReports.Count > 0)
            {
                var analyzerReportSummary = build.GetOrCreateNodeWithName <Folder>($"Analyzer Summary");
                CscTaskAnalyzer.CreateMergedReport(analyzerReportSummary, analyzerReports.ToArray());
            }
        }
示例#2
0
        public void BuildFinished(object sender, BuildFinishedEventArgs args)
        {
            try
            {
                lock (syncLock)
                {
                    Build.EndTime   = args.Timestamp;
                    Build.Succeeded = args.Succeeded;

                    if (messageProcessor.DetailedSummary.Length > 0)
                    {
                        var summary = Build.GetOrCreateNodeWithName <Message>(stringTable.Intern(Strings.DetailedSummary));
                        if (messageProcessor.DetailedSummary[0] == '\n')
                        {
                            messageProcessor.DetailedSummary.Remove(0, 1);
                        }

                        summary.Text = messageProcessor.DetailedSummary.ToString();
                    }

                    Build.VisitAllChildren <Project>(p => CalculateTargetGraph(p));
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
        public void BuildStarted(object sender, BuildStartedEventArgs args)
        {
            try
            {
                lock (syncLock)
                {
                    Build.StartTime = args.Timestamp;

                    Build.AddChild(new Property {
                        Name = "Process", Value = Process.GetCurrentProcess().MainModule.FileName
                    });

#if !NETCORE
                    Build.AddChild(new Property {
                        Name = "Command Line", Value = Environment.CommandLine
                    });
                    Build.AddChild(new Property {
                        Name = "Current Directory", Value = Environment.CurrentDirectory
                    });
#endif

                    var properties = Build.GetOrCreateNodeWithName <Folder>(Intern("Environment"));
                    AddProperties(properties, args.BuildEnvironment);
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
示例#4
0
        public void BuildStarted(object sender, BuildStartedEventArgs args)
        {
            try
            {
                lock (syncLock)
                {
                    Build.StartTime = args.Timestamp;
                    var properties = Build.GetOrCreateNodeWithName <Folder>(Intern(Strings.Environment));
                    AddProperties(properties, args.BuildEnvironment);

                    // realize the evaluation folder now so it is ordered before the main solution node
                    _ = EvaluationFolder;
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
示例#5
0
        public void AppendFinalReport(Build build)
        {
            if (UsedLocations.Any())
            {
                var usedLocationsNode = build.GetOrCreateNodeWithName <Folder>(Strings.UsedAssemblySearchPathsLocations);
                foreach (var location in UsedLocations.OrderBy(s => s))
                {
                    usedLocationsNode.AddChild(new Item {
                        Text = location
                    });
                }
            }

            if (UnusedLocations.Any())
            {
                var unusedLocationsNode = build.GetOrCreateNodeWithName <Folder>(Strings.UnusedAssemblySearchPathsLocations);
                foreach (var location in UnusedLocations.OrderBy(s => s))
                {
                    unusedLocationsNode.AddChild(new Item {
                        Text = location
                    });
                }
            }
        }
示例#6
0
 public void BuildStarted(object sender, BuildStartedEventArgs args)
 {
     try
     {
         lock (syncLock)
         {
             Build.StartTime = args.Timestamp;
             var properties = Build.GetOrCreateNodeWithName <Folder>(Intern("Environment"));
             AddProperties(properties, args.BuildEnvironment);
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
 }
        public void AppendDoubleWritesFolder(Build build)
        {
            Folder doubleWrites = null;

            foreach (var bucket in GetDoubleWrites())
            {
                doubleWrites = doubleWrites ?? build.GetOrCreateNodeWithName <Folder>("DoubleWrites");
                var item = new Item {
                    Text = bucket.Key
                };
                doubleWrites.AddChild(item);
                foreach (var source in bucket.Value)
                {
                    item.AddChild(new Item {
                        Text = source
                    });
                }
            }
        }
 private void AnalyzeDoubleWrites()
 {
     foreach (var bucket in fileCopySourcesForDestination)
     {
         if (IsDoubleWrite(bucket))
         {
             var doubleWrites = build.GetOrCreateNodeWithName <Folder>("DoubleWrites");
             var item         = new Item {
                 Text = bucket.Key
             };
             doubleWrites.AddChild(item);
             foreach (var source in bucket.Value)
             {
                 item.AddChild(new Item {
                     Text = source
                 });
             }
         }
     }
 }