Skip to content

Commit

Permalink
Fix namespace for types in Cake.GitLabCI.Module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ap0llo committed Feb 16, 2024
1 parent 7cf2488 commit 3f68217
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Cake.GitLabCI.Module/AnsiEscapeCodes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cake.AzurePipelines.Module
namespace Cake.GitLabCI.Module
{
internal static class AnsiEscapeCodes
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.GitLabCI.Module/GitLabCILog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

using JetBrains.Annotations;

namespace Cake.AzurePipelines.Module
namespace Cake.GitLabCI.Module
{
/// <summary>
/// <see cref="ICakeLog"/> implementation for GitLab CI.
Expand Down
20 changes: 20 additions & 0 deletions src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

using Cake.Core.Composition;

namespace Cake.AzurePipelines.Module
{
/// <summary>
/// Legacy <see cref="ICakeModule"/> implementation for GitLab CI.
/// </summary>
/// <remarks>
/// When <see cref="GitLabCIModule"/> was introduced initially, it was placed in the <c>Cake.AzurePipelines.Module</c> namespace by accident.
/// <para>
/// The namespace has since been adjusted, but this class is still provided in the <c>Cake.AzurePipelines.Module</c> namespace for backwards compatibility in Cake.Frosting projects.
/// When possible, use <see cref="GitLabCI.Module.GitLabCIModule"/> instead.
/// </para>
/// </remarks>
[Obsolete($"Use {nameof(GitLabCIModule)} from namespace Cake.GitLabCI.Module instead")]
public class GitLabCIModule : GitLabCI.Module.GitLabCIModule
{ }

Check warning on line 19 in src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Check warning on line 19 in src/Cake.GitLabCI.Module/GitLabCIModule.Obsolete.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

}
4 changes: 2 additions & 2 deletions src/Cake.GitLabCI.Module/GitLabCIModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// <see cref="ICakeModule"/> implementation for GitLab CI.
Expand Down

0 comments on commit 3f68217

Please sign in to comment.