diff --git a/src/Fallout.Build/Host.cs b/src/Fallout.Build/Host.cs index 96587489a..953e5a580 100644 --- a/src/Fallout.Build/Host.cs +++ b/src/Fallout.Build/Host.cs @@ -27,46 +27,53 @@ protected Host() internal virtual string OutputTemplate => Logging.TimestampOutputTemplate; + // True-color ANSI for Fallout yellow (#F5C800). Modern terminals + // (Windows Terminal, VS Code, macOS Terminal.app, GitHub Actions logs) + // render this directly; older sinks ignore the escape bytes. + + protected virtual string LogoYellow { get => ""; } + + protected virtual string LogoDimmed { get => ""; } + + protected virtual string LogoReset { get => ""; } + protected internal void WriteLogo() { Debug(); - // True-color ANSI for Fallout yellow (#F5C800). Modern terminals - // (Windows Terminal, VS Code, macOS Terminal.app, GitHub Actions logs) - // render this directly; older sinks ignore the escape bytes. - const string Y = ""; - const string D = ""; - const string R = ""; new[] { - $"{Y}███████╗ █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗{R}", - $"{Y}██╔════╝██╔══██╗██║ ██║ ██╔═══██╗██║ ██║╚══██╔══╝{R}", - $"{Y}█████╗ ███████║██║ ██║ ██║ ██║██║ ██║ ██║ {R}", - $"{Y}██╔══╝ ██╔══██║██║ ██║ ██║ ██║██║ ██║ ██║ {R}", - $"{Y}██║ ██║ ██║███████╗███████╗╚██████╔╝╚██████╔╝ ██║ {R}", - $"{Y}╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ {R}", + $"{LogoYellow}███████╗ █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗{LogoReset}", + $"{LogoYellow}██╔════╝██╔══██╗██║ ██║ ██╔═══██╗██║ ██║╚══██╔══╝{LogoReset}", + $"{LogoYellow}█████╗ ███████║██║ ██║ ██║ ██║██║ ██║ ██║ {LogoReset}", + $"{LogoYellow}██╔══╝ ██╔══██║██║ ██║ ██║ ██║██║ ██║ ██║ {LogoReset}", + $"{LogoYellow}██║ ██║ ██║███████╗███████╗╚██████╔╝╚██████╔╝ ██║ {LogoReset}", + $"{LogoYellow}╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ {LogoReset}", string.Empty, - $" {D}.NET build system{R}", - $" {Y}☢{R} {D}survived the NUKE{R}" + $" {LogoDimmed}.NET build system{LogoReset}", + $" {LogoYellow}☢{LogoReset} {LogoDimmed}survived the NUKE{LogoReset}" }.ForEach(x => Debug(x.Replace(" ", " "))); + Debug(); } protected internal virtual IDisposable WriteBlock(string text) { - return DelegateDisposable.CreateBracket( - () => - { - var formattedBlockText = text - .Split(new[] { EnvironmentInfo.NewLine }, StringSplitOptions.None) - .Select(Theme.FormatInformation); - - Debug(); - Debug("╬" + '═'.Repeat(text.Length + 5)); - formattedBlockText.ForEach(x => Debug($"║ {x}")); - Debug("╬" + '═'.Repeat(Math.Max(text.Length - 4, 2))); - Debug(); - }); + return DelegateDisposable.CreateBracket(() => + { + var formattedBlockText = text + .Split(new[] + { + EnvironmentInfo.NewLine + }, StringSplitOptions.None) + .Select(Theme.FormatInformation); + + Debug(); + Debug("╬" + '═'.Repeat(text.Length + 5)); + formattedBlockText.ForEach(x => Debug($"║ {x}")); + Debug("╬" + '═'.Repeat(Math.Max(text.Length - 4, 2))); + Debug(); + }); } protected internal virtual void ReportWarning(string text, string details = null) @@ -144,18 +151,23 @@ static string GetInformation(ExecutableTarget target) case ExecutionStatus.Skipped: Debug(line); break; + case ExecutionStatus.Succeeded: Success(line); break; + case ExecutionStatus.Aborted: case ExecutionStatus.NotRun: Warning(line); break; + case ExecutionStatus.Failed: Error(line); break; + case ExecutionStatus.Collective: break; + default: throw new NotSupportedException(target.Status.ToString()); } diff --git a/src/Fallout.Common/CI/GitLab/GitLab.cs b/src/Fallout.Common/CI/GitLab/GitLab.cs index c89fe2746..8c420de14 100644 --- a/src/Fallout.Common/CI/GitLab/GitLab.cs +++ b/src/Fallout.Common/CI/GitLab/GitLab.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics.CodeAnalysis; -using System.Linq; using Fallout.Common.Utilities; namespace Fallout.Common.CI.GitLab; @@ -19,6 +18,10 @@ public partial class GitLab : Host, IBuildServer private const string SectionStartSequence = "\u001b[0K"; private const string SectionResetSequence = "\r\u001b[0K"; + protected override string LogoYellow => ""; + + protected override string LogoDimmed => ""; + private readonly Action _messageSink; internal GitLab()