Exemplo n.º 1
0
        void BuildFinished(object sender, BuildFinishedEventArgs e)
        {
            AppendLine(string.Format("#Build Finished"));
            if (IsVerbosityAtLeast(LoggerVerbosity.Detailed))
            {
                AppendLine(e.ToPropertyValues().ToMarkdownTable().ToMarkdown());
            }

            AppendLine("Target summary".ToMarkdownSubHeader().ToMarkdown());
            var targetSummary = from t in this._targetsExecuted
                                orderby t.Value.TimeSpent descending
                                select new Tuple <string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(targetSummary.ToList().ToMarkdownBarChart().ToMarkdown());

            AppendLine("Task summary".ToMarkdownSubHeader().ToMarkdown());
            var taskSummary = from t in this._taskExecuted
                              orderby t.Value.TimeSpent descending
                              select new Tuple <string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

            AppendLine(taskSummary.ToList().ToMarkdownBarChart().ToMarkdown());
        }
Exemplo n.º 2
0
        void BuildFinished(object sender, BuildFinishedEventArgs e)
        {
            AppendLine(string.Format("####Build Finished").ToMarkdownRawMarkdown());
            AppendLine(e.Message.ToMarkdownParagraph());

            if (IsVerbosityAtLeast(LoggerVerbosity.Diagnostic))
            {
                AppendLine(e.ToPropertyValues().ToMarkdownTable().ToMarkdown().ToMarkdownRawMarkdown());

                if (e.BuildEventContext != null)
                {
                    AppendLine(e.BuildEventContext.ToPropertyValues().ToMarkdownTable().ToMarkdown().ToMarkdownRawMarkdown());
                }


                AppendLine("Target summary".ToMarkdownSubHeader());
                var targetSummary = from t in this._targetsExecuted
                                    orderby t.Value.TimeSpent descending
                                    select new Tuple <string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

                AppendLine(targetSummary.ToList().ToMarkdownBarChart());

                AppendLine("Task summary".ToMarkdownSubHeader());
                var taskSummary = from t in this._taskExecuted
                                  orderby t.Value.TimeSpent descending
                                  select new Tuple <string, int>(t.Value.Name, t.Value.TimeSpent.Milliseconds);

                AppendLine(taskSummary.ToList().ToMarkdownBarChart());
            }

            List <IMarkdownElement> toc = new List <IMarkdownElement>();

            toc.Add("#### Build Summary\r\n".ToMarkdownRawMarkdown());
            // toc.Add(new HorizontalRule());

            foreach (var project in this._projectsExecuted.OrderBy(p => p.StartedArgs.Timestamp))
            {
                string formatStr = @" - [{0}]({1}) | {2} | ```time={3} targets={4}```";

                ProjectFinishedEventArgs finishedArgs = project.FinishedArgs as ProjectFinishedEventArgs;
                string failStr = finishedArgs.Succeeded ? string.Empty : @"<font color=""red"">Failed</font>";

                string color = finishedArgs.Succeeded ? "green" : "red";

                string statusString = string.Format(
                    @"<font color=""{0}"">{1}</font>",
                    color,
                    finishedArgs.Succeeded ? "Succeeded" : "Failed");

                string targetNames = (project.StartedArgs as ProjectStartedEventArgs).TargetNames;
                if (string.IsNullOrEmpty(targetNames))
                {
                    targetNames = "(default targets)";
                }

                string md = string.Format(
                    formatStr,
                    Path.GetFileName(project.Name),
                    this.GetLinkNameFor(project.StartedArgs as ProjectStartedEventArgs),
                    statusString,
                    string.Format("{0}s", project.TimeSpent.TotalSeconds),
                    targetNames
                    );

                toc.Add(md.ToMarkdownRawMarkdown());
            }
            toc.AddRange(MdElements);
            MdElements = toc;
        }