From 23257ef1d8fbd0cf48c443f8433c5a599b36683f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Gr=C3=BCnwald?= Date: Fri, 16 Feb 2024 23:19:51 +0100 Subject: [PATCH] Fix namespace for types in Cake.GitLabCI.Module When the GitLab CI module was introduced initially, the types were placed in the 'Cake.AzurePipelines.Module' namespace by accident. To fix this and make the namespaces consistent with the package and assembly structure, move all types to the 'Cake.GitLabCI.Module' namespace. While this is a breaking change, the impact is mitigated in two ways: - Builds using the Cake scripting runner automatically discover modules by looking for the 'CakeModule' attribute. The change should thus be transparent to these projects - For Cake.Frosting based builds, a second "GitLabCIModule" type is kept in the Cake.AzurePipelines.Module namespace so the module should be source-compatible with earlier versions The GitLabCIModule in Cake.AzurePipelines.Module was marked as obsolete to discourage usage. --- src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs | 2 +- src/Cake.GitLabCI.Module/GitLabCILog.cs | 2 +- .../GitLabCIModule.Obsolete.cs | 20 +++++++++++++++++++ src/Cake.GitLabCI.Module/GitLabCIModule.cs | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs diff --git a/src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs b/src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs index db030c7d..14e975e9 100644 --- a/src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs +++ b/src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs @@ -1,4 +1,4 @@ -namespace Cake.AzurePipelines.Module +namespace Cake.GitLabCI.Module { internal static class AnsiEscapeCodes { diff --git a/src/Cake.GitLabCI.Module/GitLabCILog.cs b/src/Cake.GitLabCI.Module/GitLabCILog.cs index ab8769ab..bf69f299 100644 --- a/src/Cake.GitLabCI.Module/GitLabCILog.cs +++ b/src/Cake.GitLabCI.Module/GitLabCILog.cs @@ -6,7 +6,7 @@ using JetBrains.Annotations; -namespace Cake.AzurePipelines.Module +namespace Cake.GitLabCI.Module { /// /// implementation for GitLab CI. diff --git a/src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs b/src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs new file mode 100644 index 00000000..2c8425c3 --- /dev/null +++ b/src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs @@ -0,0 +1,20 @@ +using System; + +using Cake.Core.Composition; + +namespace Cake.AzurePipelines.Module +{ + /// + /// Legacy implementation for GitLab CI. + /// + /// + /// When was introduced initially, it was placed in the Cake.AzurePipelines.Module namespace by accident. + /// + /// The namespace has since been adjusted, but this class is still provided in the Cake.AzurePipelines.Module namespace for backwards compatibility in Cake.Frosting projects. + /// When possible, use instead. + /// + /// + [Obsolete($"Use {nameof(GitLabCIModule)} from namespace Cake.GitLabCI.Module instead")] + public class GitLabCIModule : GitLabCI.Module.GitLabCIModule + { } +} diff --git a/src/Cake.GitLabCI.Module/GitLabCIModule.cs b/src/Cake.GitLabCI.Module/GitLabCIModule.cs index b3de95e3..6f78824c 100644 --- a/src/Cake.GitLabCI.Module/GitLabCIModule.cs +++ b/src/Cake.GitLabCI.Module/GitLabCIModule.cs @@ -4,9 +4,9 @@ using Cake.Core.Composition; using Cake.Core.Diagnostics; -[assembly: CakeModule(typeof(Cake.AzurePipelines.Module.GitLabCIModule))] +[assembly: CakeModule(typeof(Cake.GitLabCI.Module.GitLabCIModule))] -namespace Cake.AzurePipelines.Module +namespace Cake.GitLabCI.Module { /// /// implementation for GitLab CI.