| 1 | using CascadeIDE.Cockpit.DataBus; |
| 2 | using CascadeIDE.Contracts; |
| 3 | |
| 4 | namespace CascadeIDE.Cockpit.ComputingUnits.IdeHealth; |
| 5 | |
| 6 | /// <summary>CCU: чистая свёртка событий в <see cref="BuildStateSnapshot"/> (ADR 0097).</summary> |
| 7 | [ComputingUnit] |
| 8 | public static class BuildStateSnapshotUnit |
| 9 | { |
| 10 | public static BuildStateSnapshot Apply(BuildStateSnapshot prior, BuildStateChanged e) |
| 11 | { |
| 12 | if (e.IsBuilding) |
| 13 | return prior with { IsBuilding = true }; |
| 14 | |
| 15 | if (e.LastExitCode is not null || e.LastBuildSucceeded is not null) |
| 16 | { |
| 17 | return new BuildStateSnapshot( |
| 18 | false, |
| 19 | e.LastExitCode ?? prior.LastExitCode, |
| 20 | e.LastBuildSucceeded ?? prior.LastBuildSucceeded); |
| 21 | } |
| 22 | |
| 23 | return prior with { IsBuilding = false }; |
| 24 | } |
| 25 | } |
| 26 | |
View only · write via MCP/CIDE