From fb0d7d1ff26103d5da0147d6e6fed54487022120 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 18:19:25 +0300 Subject: [PATCH 1/7] Fix humanized string concatenation --- source/Nuke.Common/Utilities/String.Join.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Nuke.Common/Utilities/String.Join.cs b/source/Nuke.Common/Utilities/String.Join.cs index 4539de4df..2e43d91d7 100644 --- a/source/Nuke.Common/Utilities/String.Join.cs +++ b/source/Nuke.Common/Utilities/String.Join.cs @@ -40,7 +40,7 @@ public static string JoinCommaOr(this IEnumerable values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 - ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + ", or " + valuesList.Last() + ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + $"{(valuesList.Length > 2 ? "," : string.Empty)} or " + valuesList.Last() : valuesList.JoinComma(); } @@ -49,7 +49,7 @@ public static string JoinCommaAnd(this IEnumerable values) { var valuesList = values.ToArray(); return valuesList.Length >= 2 - ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + ", and " + valuesList.Last() + ? valuesList.Reverse().Skip(1).Reverse().JoinComma() + $"{(valuesList.Length > 2 ? "," : string.Empty)} and " + valuesList.Last() : valuesList.JoinComma(); } From 2b67d7f15a361dbfe370240e6d4bd9752d898bc7 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 18:34:15 +0300 Subject: [PATCH 2/7] Fix telemetry logging --- source/Nuke.Common/Execution/Telemetry.Events.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/Nuke.Common/Execution/Telemetry.Events.cs b/source/Nuke.Common/Execution/Telemetry.Events.cs index 6ffb60638..717821b5d 100644 --- a/source/Nuke.Common/Execution/Telemetry.Events.cs +++ b/source/Nuke.Common/Execution/Telemetry.Events.cs @@ -69,16 +69,17 @@ public static void AddPackage() .AddDictionary(GetRepositoryProperties(EnvironmentInfo.WorkingDirectory))); } - private static void TrackEvent( - string eventName, - IDictionary properties) + private static void TrackEvent(string eventName, IDictionary properties) { + if (s_client == null) + return; + Logger.Trace($"Sending '{eventName}' telemetry event..."); var longestPropertyName = properties.Keys.Max(x => x.Length); properties.OrderBy(x => x.Key).ForEach(x => Logger.Trace($" {x.Key.PadRight(longestPropertyName)} = {x.Value ?? ""}")); - s_client?.TrackEvent(eventName, properties); - s_client?.Flush(); + s_client.TrackEvent(eventName, properties); + s_client.Flush(); } } } From a99c61aedceeef101bbcaf595a42e193d48345fd Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 19:03:49 +0300 Subject: [PATCH 3/7] Fix TryGetRootDirectoryFrom stop condition --- source/Nuke.Common/Constants.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Nuke.Common/Constants.cs b/source/Nuke.Common/Constants.cs index 45b206958..77cdc9d61 100644 --- a/source/Nuke.Common/Constants.cs +++ b/source/Nuke.Common/Constants.cs @@ -57,7 +57,7 @@ internal static AbsolutePath TryGetRootDirectoryFrom(string startDirectory, bool predicate: x => x.GetDirectories(NukeDirectoryName).Any() || includeLegacy && x.GetFiles(NukeFileName).Any()); - return rootDirectory != GlobalNukeDirectory ? rootDirectory : null; + return rootDirectory != GlobalNukeDirectory.Parent ? rootDirectory : null; } internal static bool IsLegacy(AbsolutePath rootDirectory) From 0708c896a45c2dc4fb526f4c7067928445351e0e Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 19:04:01 +0300 Subject: [PATCH 4/7] Fix default log level for global tool --- source/Nuke.Common/Logger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Nuke.Common/Logger.cs b/source/Nuke.Common/Logger.cs index 0d3374508..0cf002d00 100644 --- a/source/Nuke.Common/Logger.cs +++ b/source/Nuke.Common/Logger.cs @@ -49,7 +49,7 @@ public static void WriteTest() internal static OutputSink OutputSink = OutputSink.Default; - public static LogLevel LogLevel; + public static LogLevel LogLevel = LogLevel.Normal; public static IDisposable Block(string text) { From edbba3020dd9f9606eb8cb0309e6222a49fb3057 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 19:04:21 +0300 Subject: [PATCH 5/7] Fix access to BuildProjectFile in telemetry --- source/Nuke.Common/Execution/Telemetry.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Nuke.Common/Execution/Telemetry.cs b/source/Nuke.Common/Execution/Telemetry.cs index e02a397e5..84b8a7c84 100644 --- a/source/Nuke.Common/Execution/Telemetry.cs +++ b/source/Nuke.Common/Execution/Telemetry.cs @@ -52,7 +52,7 @@ static Telemetry() string GetCookieFile(string name, int version) => Constants.GlobalNukeDirectory / "telemetry-awareness" / $"v{version}" / name; - if (NukeBuild.BuildProjectFile == null) + if (SuppressErrors(() => NukeBuild.BuildProjectFile, logWarning: false) == null) { var cookieName = Assembly.GetEntryAssembly().NotNull().GetName().Name; var cookieFile = GetCookieFile(cookieName, CurrentVersion); From 1762766d093b497ed96e561b98294bbfdbf7e1ef Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 19:10:50 +0300 Subject: [PATCH 6/7] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffe00818f..5b5a24b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [vNext] +- Fixed telemetry +- Fixed humanized string concatenation ## [5.2.0] / 2021-06-18 - Added telemetry data collection From 36cb16860996b34468a1841f3c90729745bc2498 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Fri, 18 Jun 2021 19:12:36 +0300 Subject: [PATCH 7/7] Finalize CHANGELOG.md for 5.2.1 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5a24b31..07484eb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [vNext] + +## [5.2.1] / 2021-06-18 - Fixed telemetry - Fixed humanized string concatenation @@ -808,7 +810,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.git/compare/5.2.0...HEAD +[vNext]: https://github.com/nuke-build/nuke.git/compare/5.2.1...HEAD +[5.2.1]: https://github.com/nuke-build/nuke.git/compare/5.2.0...5.2.1 [5.2.0]: https://github.com/nuke-build/nuke.git/compare/5.1.4...5.2.0 [5.1.4]: https://github.com/nuke-build/nuke.git/compare/5.1.3...5.1.4 [5.1.3]: https://github.com/nuke-build/nuke.git/compare/5.1.2...5.1.3