Skip to content

Commit 9939288

Browse files
committed
separate the tracking parts of TL into a reusable base, so that TL just cares about rendering
1 parent 376bcaf commit 9939288

10 files changed

+723
-389
lines changed

src/Build/Logging/ProjectTrackingLoggerBase.cs

Lines changed: 430 additions & 0 deletions
Large diffs are not rendered by default.

src/Build/Logging/TerminalLogger/StopwatchAbstraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Microsoft.Build.Logging;
55

6-
internal abstract class StopwatchAbstraction
6+
public abstract class StopwatchAbstraction
77
{
88
public abstract void Start();
99
public abstract void Stop();
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
6+
namespace Microsoft.Build.Logging;
7+
8+
/// <summary>
9+
/// Tracks build-level data for the TerminalLogger across an entire build session.
10+
/// </summary>
11+
public sealed class TerminalBuildData
12+
{
13+
/// <summary>
14+
/// The timestamp of the build start event.
15+
/// </summary>
16+
public DateTime BuildStartTime { get; set; }
17+
18+
/// <summary>
19+
/// Number of build errors encountered during the build.
20+
/// </summary>
21+
public int BuildErrorsCount { get; set; }
22+
23+
/// <summary>
24+
/// Number of build warnings encountered during the build.
25+
/// </summary>
26+
public int BuildWarningsCount { get; set; }
27+
28+
/// <summary>
29+
/// The project build context corresponding to the Restore initial target, or null if the build is currently not restoring.
30+
/// </summary>
31+
public int? RestoreContext { get; set; }
32+
33+
/// <summary>
34+
/// True if restore failed and this failure has already been reported.
35+
/// </summary>
36+
public bool RestoreFailed { get; set; }
37+
38+
/// <summary>
39+
/// True if restore happened and finished.
40+
/// </summary>
41+
public bool RestoreFinished { get; set; }
42+
43+
/// <summary>
44+
/// Initializes a new instance of TerminalBuildData.
45+
/// </summary>
46+
/// <param name="buildStartTime">The timestamp when the build started.</param>
47+
public TerminalBuildData(DateTime buildStartTime)
48+
{
49+
BuildStartTime = buildStartTime;
50+
}
51+
}

src/Build/Logging/TerminalLogger/TerminalBuildMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ namespace Microsoft.Build.Logging;
66
/// <summary>
77
/// Represents a piece of diagnostic output (message/warning/error).
88
/// </summary>
9-
internal record struct TerminalBuildMessage(TerminalMessageSeverity Severity, string Message)
9+
public record struct TerminalBuildMessage(TerminalMessageSeverity Severity, string Message)
1010
{ }

0 commit comments

Comments
 (0)