Skip to content

Commit 7e34233

Browse files
committed
* Add documentation
1 parent d735317 commit 7e34233

File tree

7 files changed

+879
-13
lines changed

7 files changed

+879
-13
lines changed

Scripts/ModernBuild/General/AppState.cs

Lines changed: 192 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,248 @@
77

88
namespace Krypton.Build;
99

10+
/// <summary>
11+
/// Represents the application state for the Krypton Modern Build tool.
12+
/// This class maintains all the configuration, runtime state, and data necessary for the build process.
13+
/// </summary>
1014
public sealed class AppState
1115
{
16+
#region Build Configuration
17+
18+
/// <summary>
19+
/// Gets or sets the build channel type (Nightly, Canary, Stable, LTS).
20+
/// </summary>
1221
public ChannelType Channel { get; set; }
22+
23+
/// <summary>
24+
/// Gets or sets the build action to perform (Build, Rebuild, Pack, etc.).
25+
/// </summary>
1326
public BuildAction Action { get; set; }
27+
28+
/// <summary>
29+
/// Gets or sets the build configuration (Debug, Release, etc.). Defaults to "Release".
30+
/// </summary>
1431
public string Configuration { get; set; } = "Release";
32+
33+
/// <summary>
34+
/// Gets or sets the root path of the repository.
35+
/// </summary>
1536
public string RootPath { get; set; } = string.Empty;
37+
38+
/// <summary>
39+
/// Gets or sets the path to the MSBuild executable.
40+
/// </summary>
1641
public string MsBuildPath { get; set; } = string.Empty;
17-
42+
43+
/// <summary>
44+
/// Gets or sets the project file path for the build operation.
45+
/// </summary>
1846
public string ProjectFile { get; set; } = string.Empty;
47+
48+
#endregion
49+
50+
#region Logging Configuration
51+
52+
/// <summary>
53+
/// Gets or sets the path for text log output.
54+
/// </summary>
1955
public string TextLogPath { get; set; } = string.Empty;
56+
57+
/// <summary>
58+
/// Gets or sets the path for binary log output.
59+
/// </summary>
2060
public string BinLogPath { get; set; } = string.Empty;
2161

62+
#endregion
63+
64+
#region Runtime State
65+
66+
/// <summary>
67+
/// Gets the tail buffer for capturing and displaying recent build output.
68+
/// </summary>
2269
public TailBuffer Tail { get; } = new TailBuffer(200);
70+
71+
/// <summary>
72+
/// Gets or sets the number of tail lines to display.
73+
/// </summary>
2374
public int TailLines { get; set; }
75+
76+
/// <summary>
77+
/// Gets or sets whether the build process is currently running.
78+
/// </summary>
2479
public bool IsRunning { get; set; }
80+
81+
/// <summary>
82+
/// Gets or sets the last exit code from the build process.
83+
/// </summary>
2584
public int LastExitCode { get; set; }
85+
86+
/// <summary>
87+
/// Gets or sets the UTC start time of the current build operation.
88+
/// </summary>
2689
public DateTime? StartTimeUtc { get; set; }
90+
91+
/// <summary>
92+
/// Gets or sets the count of errors encountered during the build.
93+
/// </summary>
2794
public int ErrorCount { get; set; }
95+
96+
/// <summary>
97+
/// Gets or sets the count of warnings encountered during the build.
98+
/// </summary>
2899
public int WarningCount { get; set; }
29100

101+
#endregion
102+
103+
#region Summary and Output
104+
105+
/// <summary>
106+
/// Gets or sets whether the build summary is ready for display.
107+
/// </summary>
30108
public bool SummaryReady { get; set; }
109+
110+
/// <summary>
111+
/// Gets or sets the lines of the build summary.
112+
/// </summary>
31113
public IReadOnlyList<string>? SummaryLines { get; set; }
114+
115+
/// <summary>
116+
/// Gets or sets the offset for summary display positioning.
117+
/// </summary>
32118
public int SummaryOffset { get; set; }
33-
119+
120+
/// <summary>
121+
/// Gets or sets the callback action for handling output messages.
122+
/// </summary>
34123
public Action<string>? OnOutput { get; set; }
124+
125+
#endregion
126+
127+
#region Process Management
128+
129+
/// <summary>
130+
/// Gets or sets the current build process instance.
131+
/// </summary>
35132
public Process? Process { get; set; }
133+
134+
/// <summary>
135+
/// Gets or sets the queue of pending build targets.
136+
/// </summary>
36137
public Queue<string>? PendingTargets { get; set; }
138+
139+
/// <summary>
140+
/// Gets or sets the last completed build target.
141+
/// </summary>
142+
public string? LastCompletedTarget { get; set; }
143+
144+
#endregion
145+
146+
#region Pack Configuration
147+
148+
/// <summary>
149+
/// Gets or sets the pack mode for NuGet packaging (Pack, PackLite, PackAll).
150+
/// </summary>
37151
public PackMode PackMode { get; set; } = PackMode.Pack;
152+
153+
#endregion
154+
155+
#region UI State
156+
157+
/// <summary>
158+
/// Gets or sets the callback action to request a full UI render.
159+
/// </summary>
38160
public Action? RequestRenderAll { get; set; }
161+
162+
/// <summary>
163+
/// Gets or sets whether auto-scroll is enabled in the output display.
164+
/// </summary>
39165
public bool AutoScroll { get; set; } = true;
40166

167+
#endregion
168+
169+
#region NuGet Configuration
170+
171+
/// <summary>
172+
/// Gets or sets the queue of packages waiting to be pushed to NuGet.
173+
/// </summary>
41174
public Queue<string>? NuGetPushQueue { get; set; }
175+
176+
/// <summary>
177+
/// Gets or sets the current tasks page being displayed (Ops or NuGet).
178+
/// </summary>
42179
public TasksPage TasksPage { get; set; } = TasksPage.Ops;
180+
181+
/// <summary>
182+
/// Gets or sets the NuGet action to perform (RebuildPack, Push, etc.).
183+
/// </summary>
43184
public NuGetAction NuGetAction { get; set; } = NuGetAction.RebuildPack;
185+
186+
/// <summary>
187+
/// Gets or sets the NuGet source for package operations (Default, NuGetOrg, GitHub, Custom).
188+
/// </summary>
44189
public NuGetSource NuGetSource { get; set; } = NuGetSource.Default;
190+
191+
/// <summary>
192+
/// Gets or sets whether to create a ZIP archive of NuGet packages.
193+
/// </summary>
45194
public bool NuGetCreateZip { get; set; }
195+
196+
/// <summary>
197+
/// Gets or sets the custom NuGet source URL when using Custom source type.
198+
/// </summary>
46199
public string NuGetCustomSource { get; set; } = string.Empty;
200+
201+
/// <summary>
202+
/// Gets or sets whether to include symbols in NuGet packages.
203+
/// </summary>
47204
public bool NuGetIncludeSymbols { get; set; }
205+
206+
/// <summary>
207+
/// Gets or sets the path to the last created NuGet ZIP archive.
208+
/// </summary>
48209
public string? NuGetLastZipPath { get; set; }
210+
211+
/// <summary>
212+
/// Gets or sets whether to run NuGet push after MSBuild completes.
213+
/// </summary>
49214
public bool NuGetRunPushAfterMsBuild { get; set; }
215+
216+
/// <summary>
217+
/// Gets or sets whether to run ZIP creation after MSBuild completes.
218+
/// </summary>
50219
public bool NuGetRunZipAfterMsBuild { get; set; }
220+
221+
/// <summary>
222+
/// Gets or sets whether to skip duplicate packages during NuGet operations. Defaults to true.
223+
/// </summary>
51224
public bool NuGetSkipDuplicate { get; set; } = true;
52-
public string? LastCompletedTarget { get; set; }
225+
226+
#endregion
53227
}
54228

229+
/// <summary>
230+
/// A thread-safe circular buffer that maintains a fixed number of recent lines.
231+
/// Used for capturing and displaying the tail of build output in the UI.
232+
/// </summary>
55233
public sealed class TailBuffer
56234
{
57235
private int capacity;
58236
private readonly LinkedList<string> lines = new LinkedList<string>();
59237
private readonly object sync = new object();
60238

239+
/// <summary>
240+
/// Initializes a new instance of the <see cref="TailBuffer"/> class with the specified capacity.
241+
/// </summary>
242+
/// <param name="capacity">The maximum number of lines to store in the buffer.</param>
61243
public TailBuffer(int capacity)
62244
{
63245
this.capacity = capacity;
64246
}
65247

248+
/// <summary>
249+
/// Sets the capacity of the buffer and trims excess lines if necessary.
250+
/// </summary>
251+
/// <param name="newCapacity">The new capacity for the buffer. Must be greater than 0.</param>
66252
public void SetCapacity(int newCapacity)
67253
{
68254
if (newCapacity <= 0)
@@ -79,6 +265,9 @@ public void SetCapacity(int newCapacity)
79265
}
80266
}
81267

268+
/// <summary>
269+
/// Clears all lines from the buffer.
270+
/// </summary>
82271
public void Clear()
83272
{
84273
lock (sync)

0 commit comments

Comments
 (0)