diff --git a/CHANGELOG.md b/CHANGELOG.md index ae677ac4a..b5458c569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [vNext] +## [6.0.1] / 2022-01-10 +- Fixed invisible output for `SystemConsoleHostTheme` +- Fixed `GetRelativePath` for same parts in different places + ## [6.0.0] / 2022-01-07 - Removed `ToolSettings.ProcessLogFile` and `ProcessLogTimestamp` - Removed `GitHub` prefix for `GitHubActions` environment variables @@ -877,7 +881,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added CLT tasks for Git - Fixed background color in console output -[vNext]: https://github.com/nuke-build/nuke/compare/6.0.0...HEAD +[vNext]: https://github.com/nuke-build/nuke/compare/6.0.1...HEAD +[6.0.1]: https://github.com/nuke-build/nuke/compare/6.0.0...6.0.1 [6.0.0]: https://github.com/nuke-build/nuke/compare/5.3.0...6.0.0 [5.3.0]: https://github.com/nuke-build/nuke/compare/5.2.1...5.3.0 [5.2.1]: https://github.com/nuke-build/nuke/compare/5.2.0...5.2.1 diff --git a/appveyor.yml b/appveyor.yml index c74174820..3d208fb1c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ # ------------------------------------------------------------------------------ image: - - Visual Studio 2019 + - Visual Studio 2022 branches: only: @@ -49,4 +49,4 @@ environment: GitterAuthToken: secure: Fy//YC4mL9IipkXG3OENTpC9g2qOtU32/5WU6PHw/HLty8YjvHXHsnTkk0HWJJMw SlackWebhook: - secure: xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hkn8u/b12lFivnxtTPuMWjAYkoPLlkJ4v39FLYPcxGYbAxRRMcJiHjrNyPtFfK6ddo= + secure: xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hkmagda0rH4ZxOTbJ1bcmC3D6uhvJKLtSHqY7TK/48Nw3EbvN9wNFEt97HWYc9FE+g= diff --git a/build/Build.Announce.cs b/build/Build.Announce.cs index 998a77ed0..e987fc119 100644 --- a/build/Build.Announce.cs +++ b/build/Build.Announce.cs @@ -9,6 +9,7 @@ using Nuke.Common; using Nuke.Common.ChangeLog; using Nuke.Common.Git; +using Nuke.Common.Tools.Git; using Nuke.Common.Tools.GitHub; using Nuke.Common.Tools.Slack; using Nuke.Common.Utilities; @@ -41,6 +42,16 @@ partial class Build .Requires(() => GitterAuthToken) .Executes(async () => { + var committers = GitTasks.Git($"log {MajorMinorPatchVersion}^..{MajorMinorPatchVersion} --pretty=tformat:%an", logOutput: false); + var commitsText = $"{committers.Count} {(committers.Count == 1 ? "commit" : "commits")}"; + var comparisonUrl = GitRepository.GetGitHubCompareTagsUrl($"{MajorMinorPatchVersion}^", MajorMinorPatchVersion); + var notableCommitters = committers + .Select(x => x.Text) + .GroupBy(x => x) + .OrderByDescending(x => x.Count()) + .Select(x => x.Key) + .Where(x => x != "Matthias Koch").ToList(); + var client = new TwitterClient( new TwitterCredentials( TwitterCredentials.ConsumerKey, @@ -67,10 +78,30 @@ partial class Build }); await SendSlackMessageAsync(_ => _ - .SetText(new StringBuilder() - .AppendLine($" :mega::shipit: *NUKE {MajorMinorPatchVersion} IS OUT!!!*") - .AppendLine() - .AppendLine(ChangelogSectionNotes.Select(x => x.Replace("- ", "• ")).JoinNewLine()).ToString()), + .AddAttachment(_ => _ + .SetFallback($"NUKE {MajorMinorPatchVersion} RELEASED!") + .SetAuthorName($"NUKE {MajorMinorPatchVersion} RELEASED!") + .SetAuthorLink($"https://nuget.org/packages/Nuke.Common/{MajorMinorPatchVersion}") + .SetColor("#00ACC1") + .SetThumbUrl( + MajorMinorPatchVersion.EndsWith(".0.0") + ? "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/320/apple/285/rocket_1f680.png" + : MajorMinorPatchVersion.EndsWith(".0") + ? "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/320/apple/285/wrapped-gift_1f381.png" + : "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/320/apple/285/package_1f4e6.png") + .SetText(new StringBuilder() + .Append($"This release includes *<{comparisonUrl}|{commitsText}>*") + .AppendLine(notableCommitters.Count > 0 + ? $" with notable contributions from {notableCommitters.JoinCommaAnd()}. A round of applause for them! :clap:" + : ". No contributions this time. :sweat_smile:") + .AppendLine() + .AppendLine("Remember that you can call `nuke :update` to update your builds! :bulb:") + .AppendLine() + .AppendLine("*Release Notes*") + .AppendLine("```") + .AppendLine(ChangelogSectionNotes.Select(x => x.Replace("- ", "• ").Replace("`", string.Empty)).JoinNewLine()) + .AppendLine("```").ToString()) + .SetFooter("Powered by ** and **.")), SlackWebhook); SendGitterMessage(new StringBuilder() diff --git a/build/Build.CI.AppVeyor.cs b/build/Build.CI.AppVeyor.cs index 5d2f05f59..6342ae274 100644 --- a/build/Build.CI.AppVeyor.cs +++ b/build/Build.CI.AppVeyor.cs @@ -7,7 +7,7 @@ [AppVeyor( suffix: null, - AppVeyorImage.VisualStudio2019, + AppVeyorImage.VisualStudio2022, BranchesOnly = new[] { MasterBranch, $"/{ReleaseBranchPrefix}\\/*/" }, SkipTags = true, InvokedTargets = new[] { nameof(IPack.Pack), nameof(ITest.Test), nameof(ISignPackages.SignPackages), nameof(IPublish.Publish) }, @@ -39,7 +39,7 @@ [AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.AccessToken), "nnv1h5nkNm4MS50soQHiYXVUf0UR+gx54imrggateey6oA+rdCdna0TaUCH1vsDwHEitHDPRdx39xjJMBzwRxA==")] [AppVeyorSecret(IHazTwitterCredentials.Twitter + nameof(IHazTwitterCredentials.AccessTokenSecret), "OGFEkW5fHl0YJzKnTTWJ3oHhQfjMs9RWGJMjeQ2HMIG+yUwy0NQGVUY4qOCRgrXW")] [AppVeyorSecret(nameof(GitterAuthToken), "Fy//YC4mL9IipkXG3OENTpC9g2qOtU32/5WU6PHw/HLty8YjvHXHsnTkk0HWJJMw")] -[AppVeyorSecret(nameof(SlackWebhook), "xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hkn8u/b12lFivnxtTPuMWjAYkoPLlkJ4v39FLYPcxGYbAxRRMcJiHjrNyPtFfK6ddo=")] +[AppVeyorSecret(nameof(SlackWebhook), "xENxLITTR28hBLEY51YWMeHhxkhg1h1tLY1zGre1/hkmagda0rH4ZxOTbJ1bcmC3D6uhvJKLtSHqY7TK/48Nw3EbvN9wNFEt97HWYc9FE+g=")] partial class Build { } diff --git a/build/Build.ReleaseImage.cs b/build/Build.ReleaseImage.cs index 408c432bd..7b2e64e65 100644 --- a/build/Build.ReleaseImage.cs +++ b/build/Build.ReleaseImage.cs @@ -8,6 +8,7 @@ using System.Linq; using Nuke.Common; using Nuke.Common.IO; +using Nuke.Common.Tooling; using Nuke.Common.Utilities.Collections; using Serilog; using SixLabors.Fonts; @@ -20,11 +21,14 @@ partial class Build { + [LatestGitHubRelease("JetBrains/JetBrainsMono", TrimPrefix = true)] + readonly string JetBrainsMonoVersion; + string[] FontDownloadUrls => new[] { "https://github.com/googlefonts/roboto/releases/latest/download/roboto-unhinted.zip", - "https://github.com/JetBrains/JetBrainsMono/releases/download/v1.0.6/JetBrainsMono-1.0.6.zip" + $"https://github.com/JetBrains/JetBrainsMono/releases/download/v{JetBrainsMonoVersion}/JetBrainsMono-{JetBrainsMonoVersion}.zip" }; AbsolutePath FontDirectory => TemporaryDirectory / "fonts"; @@ -53,7 +57,8 @@ partial class Build var logo = Image.Load(WatermarkImageFile); logo.Mutate(x => x.Resize((int) (logo.Width * logoScaling), (int) (logo.Height * logoScaling))); - var robotoFont = FontCollection.Families.Single(x => x.Name == "Roboto Black"); + var thinFont = FontCollection.Families.Single(x => x.Name == "JetBrains Mono Thin"); + var boldFont = FontCollection.Families.Single(x => x.Name == "JetBrains Mono ExtraBold"); var graphicsOptions = new DrawingOptions { @@ -69,21 +74,21 @@ partial class Build var image = new Image(width: width, height: height); image.Mutate(x => x .BackgroundColor(Color.FromRgb(r: 25, g: 25, b: 25)) - .DrawImage( - logo, - location: new Point(image.Width / 2 - logo.Width / 2, image.Height / 2 - logo.Height / 2), - opacity: 0.05f) + // .DrawImage( + // logo, + // location: new Point(image.Width / 2 - logo.Width / 2, image.Height / 2 - logo.Height / 2), + // opacity: 0.05f) .DrawText( text: "New Release".ToUpperInvariant(), - font: robotoFont.CreateFont(70), + font: thinFont.CreateFont(100), color: Color.WhiteSmoke, - location: new PointF(image.Width / 2f, image.Height / 2f - 100), + location: new PointF(image.Width / 2f, image.Height / 2f - 120), options: graphicsOptions) .DrawText( text: MajorMinorPatchVersion, - font: robotoFont.CreateFont(180), + font: boldFont.CreateFont(230), color: Color.WhiteSmoke, - location: new PointF(image.Width / 2f, image.Height / 2f), + location: new PointF(image.Width / 2f, image.Height / 2f + 60), options: graphicsOptions)); using var fileStream = new FileStream(ReleaseImageFile, FileMode.Create); diff --git a/source/Nuke.Common.Tests/PathConstructionTest.cs b/source/Nuke.Common.Tests/PathConstructionTest.cs index e89580cf2..5f66a0da8 100644 --- a/source/Nuke.Common.Tests/PathConstructionTest.cs +++ b/source/Nuke.Common.Tests/PathConstructionTest.cs @@ -38,7 +38,10 @@ public void TestEquality(string path1, string path2, bool expected) [InlineData("C:\\A\\B\\C", "C:\\A\\B", "..")] [InlineData("C:\\A\\B\\", "C:\\A\\B\\C", "C")] [InlineData("C:\\A\\B\\C", "C:\\A\\B\\D\\E", "..\\D\\E")] + [InlineData("C:\\A\\B\\C\\B", "C:\\A\\B\\D\\B", "..\\..\\D\\B")] [InlineData("/bin/etc", "/bin/tmp", "../tmp")] + [InlineData("/bin/etc/bin", "/bin/tmp/bin", "../../tmp/bin")] + [InlineData("/same1/diff1/same2", "/diff1/diff2/same2", "../../../diff1/diff2/same2")] public void TestGetRelativePath(string basePath, string destinationPath, string expected) { GetRelativePath(basePath, destinationPath).Should().Be(expected); diff --git a/source/Nuke.Common/Execution/Theming/SystemConsoleHostTheme.cs b/source/Nuke.Common/Execution/Theming/SystemConsoleHostTheme.cs index f27ab3bc7..3bb59a61f 100644 --- a/source/Nuke.Common/Execution/Theming/SystemConsoleHostTheme.cs +++ b/source/Nuke.Common/Execution/Theming/SystemConsoleHostTheme.cs @@ -115,7 +115,7 @@ private void Write(string text, SystemConsoleThemeStyle style) () => { Console.ForegroundColor = style.Foreground ?? previousForeground; - Console.ForegroundColor = style.Background ?? previousBackground; + Console.BackgroundColor = style.Background ?? previousBackground; }, () => { diff --git a/source/Nuke.Common/IO/PathConstruction.cs b/source/Nuke.Common/IO/PathConstruction.cs index a12444be7..79e436489 100644 --- a/source/Nuke.Common/IO/PathConstruction.cs +++ b/source/Nuke.Common/IO/PathConstruction.cs @@ -110,7 +110,7 @@ public static string GetRelativePath(string basePath, string destinationPath, bo var destinationParts = destinationPath.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries); var sameParts = baseParts.Zip(destinationParts, (a, b) => new { Base = a, Destination = b }) - .Count(x => x.Base.EqualsOrdinalIgnoreCase(x.Destination)); + .TakeWhile(x => x.Base.EqualsOrdinalIgnoreCase(x.Destination)).Count(); return Enumerable.Repeat("..", baseParts.Length - sameParts).ToList() .Concat(destinationParts.Skip(sameParts).ToList()).Join(separator); }