Skip to content

Commit

Permalink
Merge branch 'release/5.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Jan 9, 2025
2 parents 0c91456 + 647a538 commit 1336825
Show file tree
Hide file tree
Showing 16 changed files with 292 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

<ItemGroup>
<PackageReference Include="Cake.Frosting" Version="5.0.0" />
<PackageReference Include="Cake.Issues.Testing" Version="5.1.1" />
<PackageReference Include="Cake.Issues.Testing" Version="5.2.0" />
<PackageReference Include="Cake.Testing" Version="5.0.0" />
<PackageReference Include="Cake.Testing.Xunit" Version="5.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ For recipe compatible with Cake Script Runners see Cake.Issues.Recipe.</Descript
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/cake-contrib/Cake.Issues.Recipe.git</RepositoryUrl>
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.Issues.Recipe/releases/tag/5.1.1</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/cake-contrib/Cake.Issues.Recipe/releases/tag/5.2.0</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -42,20 +42,20 @@ For recipe compatible with Cake Script Runners see Cake.Issues.Recipe.</Descript
<PackageReference Include="Cake.Frosting.AzureDevOps" Version="5.0.0" />
<PackageReference Include="Cake.Frosting" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Frosting.Git" Version="5.0.1" />
<PackageReference Include="Cake.Issues" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.EsLint" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.InspectCode" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Markdownlint" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Sarif" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AppVeyor" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AzureDevOps" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.GitHubActions" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Reporting" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Sarif" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Generic" Version="5.1.1" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Console" Version="5.1.1" />
<PackageReference Include="Cake.Issues" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.EsLint" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.InspectCode" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Markdownlint" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Sarif" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AppVeyor" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AzureDevOps" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.GitHubActions" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Reporting" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Sarif" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Generic" Version="5.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Reporting.Console" Version="5.2.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ public interface IIssuesParameters
/// Gets the parameters for pull request system integration.
/// </summary>
IIssuesParametersPullRequestSystem PullRequestSystem { get; }

/// <summary>
/// Gets the parameters for build breaking.
/// </summary>
IIssuesParametersBuildBreaking BuildBreaking { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace Cake.Frosting.Issues.Recipe;

/// <summary>
/// Parameters for build breaking.
/// </summary>
public interface IIssuesParametersBuildBreaking
{
/// <summary>
/// Gets or sets a value indicating whether build should fail if any issues are found.
/// Default value is <c>false</c>.
/// </summary>
bool ShouldFailBuildOnIssues { get; set; }

/// <summary>
/// Gets or sets the minimum priority of issues considered to fail the build.
/// If set to <see cref="IssuePriority.Undefined"/>, all issues are considered.
/// Default value is <see cref="IssuePriority.Undefined"/>.
/// </summary>
IssuePriority MinimumPriority { get; set; }

/// <summary>
/// Gets the list of issue provider types to consider.
/// If empty, all providers are considered.
/// Default value is empty.
/// </summary>
IList<string> IssueProvidersToConsider { get; }

/// <summary>
/// Gets the list of issue provider types to ignore.
/// Default value is empty.
/// </summary>
IList<string> IssueProvidersToIgnore { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Cake.Frosting.Issues.Recipe;
/// <summary>
/// Parameters of the build.
/// </summary>
public class IssuesParameters : IssuesParameters<IssuesParametersInputFiles, IssuesParametersReporting, IssuesParametersBuildServer, IssuesParametersPullRequestSystem>
public class IssuesParameters : IssuesParameters<IssuesParametersInputFiles, IssuesParametersReporting, IssuesParametersBuildServer, IssuesParametersPullRequestSystem, IssuesParametersBuildBreaking>
{
/// <inheritdoc />
protected override IssuesParametersBuildServer CreateBuildServerParameters() => new();
Expand All @@ -16,4 +16,7 @@ public class IssuesParameters : IssuesParameters<IssuesParametersInputFiles, Iss

/// <inheritdoc />
protected override IssuesParametersReporting CreateReportingParameters() => new();

/// <inheritdoc />
protected override IssuesParametersBuildBreaking CreateBuildBreakingParameters() => new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Cake.Frosting.Issues.Recipe;

/// <summary>
/// Parameters for passing input files.
/// </summary>
public class IssuesParametersBuildBreaking: IIssuesParametersBuildBreaking
{
/// <inheritdoc />
public bool ShouldFailBuildOnIssues { get; set; }

/// <inheritdoc />
public IssuePriority MinimumPriority { get; set; } = IssuePriority.Undefined;

/// <inheritdoc />
public IList<string> IssueProvidersToConsider { get; } = [];

/// <inheritdoc />
public IList<string> IssueProvidersToIgnore { get; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public void AddMsBuildXmlFileLoggerLogFilePath(FilePath logfilePath, IReadIssues
{
logfilePath.NotNull();

if (this.MsBuildXmlFileLoggerLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the MsBuildXmlFileLogger log file format.",
nameof(logfilePath));
}

this.MsBuildXmlFileLoggerLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -76,6 +83,13 @@ public void AddMsBuildBinaryLogFilePath(FilePath logfilePath, IReadIssuesSetting
{
logfilePath.NotNull();

if (this.MsBuildBinaryLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the MsBuildBinary log file format.",
nameof(logfilePath));
}

this.MsBuildBinaryLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -92,6 +106,13 @@ public void AddInspectCodeLogFilePath(FilePath logfilePath, IReadIssuesSettings
{
logfilePath.NotNull();

if (this.InspectCodeLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for InspectCode issue provider.",
nameof(logfilePath));
}

this.InspectCodeLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -108,6 +129,13 @@ public void AddMarkdownlintCliLogFilePath(FilePath logfilePath, IReadIssuesSetti
{
logfilePath.NotNull();

if (this.MarkdownlintCliLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the MarkdownlintCli log file format.",
nameof(logfilePath));
}

this.MarkdownlintCliLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -124,6 +152,13 @@ public void AddMarkdownlintCliJsonLogFilePath(FilePath logfilePath, IReadIssuesS
{
logfilePath.NotNull();

if (this.MarkdownlintCliJsonLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the MarkdownlintCliJson log file format.",
nameof(logfilePath));
}

this.MarkdownlintCliJsonLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -140,6 +175,13 @@ public void AddMarkdownlintV1LogFilePath(FilePath logfilePath, IReadIssuesSettin
{
logfilePath.NotNull();

if (this.MarkdownlintV1LogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the MarkdownlintV1 log file format.",
nameof(logfilePath));
}

this.MarkdownlintV1LogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -156,6 +198,13 @@ public void AddEsLintJsonLogFilePath(FilePath logfilePath, IReadIssuesSettings s
{
logfilePath.NotNull();

if (this.EsLintJsonLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the EsLintJson log file format.",
nameof(logfilePath));
}

this.EsLintJsonLogFilePaths.Add(logfilePath, settings);
}

Expand All @@ -172,6 +221,13 @@ public void AddSarifLogFilePath(FilePath logfilePath, IReadIssuesSettings settin
{
logfilePath.NotNull();

if (this.SarifLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the SARIF issue provider.",
nameof(logfilePath));
}

this.SarifLogFilePaths.Add(logfilePath, settings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ namespace Cake.Frosting.Issues.Recipe;
/// <typeparam name="TReporting">Type of reporting parameters.</typeparam>
/// <typeparam name="TBuildServer">Type of parameters for build server integration.</typeparam>
/// <typeparam name="TPullRequestSystem">Type of parameters for pull request system integration</typeparam>
public abstract class IssuesParameters<TInputFiles, TReporting, TBuildServer, TPullRequestSystem> : IIssuesParameters
/// <typeparam name="TBuildBreaking">Type of parameters for build breaking.</typeparam>
public abstract class IssuesParameters<TInputFiles, TReporting, TBuildServer, TPullRequestSystem, TBuildBreaking> : IIssuesParameters
where TInputFiles : IIssuesParametersInputFiles
where TReporting : IIssuesParametersReporting
where TBuildServer : IIssuesParametersBuildServer
where TPullRequestSystem : IIssuesParametersPullRequestSystem
where TBuildBreaking : IIssuesParametersBuildBreaking
{
private readonly Lazy<TInputFiles> inputFiles;
private readonly Lazy<TReporting> reporting;
private readonly Lazy<TBuildServer> buildServer;
private readonly Lazy<TPullRequestSystem> pullRequestSystem;
private readonly Lazy<TBuildBreaking> buildBreaking;

/// <inheritdoc />
public DirectoryPath OutputDirectory { get; set; } = "BuildArtifacts";
Expand All @@ -38,6 +41,9 @@ public abstract class IssuesParameters<TInputFiles, TReporting, TBuildServer, TP
/// <inheritdoc />
public TPullRequestSystem PullRequestSystem => this.pullRequestSystem.Value;

/// <inheritdoc />
public TBuildBreaking BuildBreaking => this.buildBreaking.Value;

IIssuesParametersInputFiles IIssuesParameters.InputFiles => this.InputFiles;

IIssuesParametersReporting IIssuesParameters.Reporting => this.Reporting;
Expand All @@ -46,6 +52,8 @@ public abstract class IssuesParameters<TInputFiles, TReporting, TBuildServer, TP

IIssuesParametersPullRequestSystem IIssuesParameters.PullRequestSystem => this.PullRequestSystem;

IIssuesParametersBuildBreaking IIssuesParameters.BuildBreaking => this.BuildBreaking;

/// <summary>
/// Creates a new instance of the <see cref="IssuesParameters"/> class.
/// </summary>
Expand All @@ -55,6 +63,7 @@ protected IssuesParameters()
this.reporting = new Lazy<TReporting>(this.CreateReportingParameters);
this.buildServer = new Lazy<TBuildServer>(this.CreateBuildServerParameters);
this.pullRequestSystem = new Lazy<TPullRequestSystem>(this.CreatePullRequestSystemParameters);
this.buildBreaking = new Lazy<TBuildBreaking>(this.CreateBuildBreakingParameters);
}

/// <summary>
Expand All @@ -80,4 +89,10 @@ protected IssuesParameters()
/// </summary>
/// <returns>Parameters object pull request system integration.</returns>
protected abstract TPullRequestSystem CreatePullRequestSystemParameters();

/// <summary>
/// Factory method to instantiate <see cref="buildBreaking"/>.
/// </summary>
/// <returns>Parameters object for build breaking settings.</returns>
protected abstract TBuildBreaking CreateBuildBreakingParameters();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
namespace Cake.Frosting.Issues.Recipe;

/// <summary>
/// Main task for issue management integration.
/// </summary>
Expand All @@ -10,6 +9,23 @@
[IsDependentOn(typeof(ReportIssuesToPullRequestTask))]
[IsDependentOn(typeof(SetPullRequestIssuesStateTask))]
[IsDependentOn(typeof(ReportIssuesToConsoleTask))]
public sealed class IssuesTask : FrostingTask
public sealed class IssuesTask : FrostingTask<IIssuesContext>
{
/// <inheritdoc/>
public override void Run(IIssuesContext context)
{
context.NotNull();

if (context.Parameters.BuildBreaking.ShouldFailBuildOnIssues)
{
context.BreakBuildOnIssues(
context.State.Issues,
new BuildBreakingSettings
{
MinimumPriority = context.Parameters.BuildBreaking.MinimumPriority,
IssueProvidersToConsider = context.Parameters.BuildBreaking.IssueProvidersToConsider,
IssueProvidersToIgnore = context.Parameters.BuildBreaking.IssueProvidersToIgnore
});
}
}
}
28 changes: 14 additions & 14 deletions Cake.Issues.Recipe/Content/addins.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
///////////////////////////////////////////////////////////////////////////////

#addin nuget:?package=Cake.Git&version=5.0.1
#addin nuget:?package=Cake.Issues&version=5.1.1
#addin nuget:?package=Cake.Issues.MsBuild&version=5.1.1
#addin nuget:?package=Cake.Issues.InspectCode&version=5.1.1
#addin nuget:?package=Cake.Issues.Markdownlint&version=5.1.1
#addin nuget:?package=Cake.Issues.EsLint&version=5.1.1
#addin nuget:?package=Cake.Issues.Sarif&version=5.1.1
#addin nuget:?package=Cake.Issues.Reporting&version=5.1.1
#addin nuget:?package=Cake.Issues.Reporting.Generic&version=5.1.1
#addin nuget:?package=Cake.Issues.Reporting.Sarif&version=5.1.1
#addin nuget:?package=Cake.Issues.Reporting.Console&version=5.1.1
#addin nuget:?package=Cake.Issues.PullRequests&version=5.1.1
#addin nuget:?package=Cake.Issues.PullRequests.AppVeyor&version=5.1.1
#addin nuget:?package=Cake.Issues.PullRequests.AzureDevOps&version=5.1.1
#addin nuget:?package=Cake.Issues.PullRequests.GitHubActions&version=5.1.1
#addin nuget:?package=Cake.Issues&version=5.2.0
#addin nuget:?package=Cake.Issues.MsBuild&version=5.2.0
#addin nuget:?package=Cake.Issues.InspectCode&version=5.2.0
#addin nuget:?package=Cake.Issues.Markdownlint&version=5.2.0
#addin nuget:?package=Cake.Issues.EsLint&version=5.2.0
#addin nuget:?package=Cake.Issues.Sarif&version=5.2.0
#addin nuget:?package=Cake.Issues.Reporting&version=5.2.0
#addin nuget:?package=Cake.Issues.Reporting.Generic&version=5.2.0
#addin nuget:?package=Cake.Issues.Reporting.Sarif&version=5.2.0
#addin nuget:?package=Cake.Issues.Reporting.Console&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests.AppVeyor&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests.AzureDevOps&version=5.2.0
#addin nuget:?package=Cake.Issues.PullRequests.GitHubActions&version=5.2.0
#addin nuget:?package=Cake.AzureDevOps&version=5.0.0
Loading

0 comments on commit 1336825

Please sign in to comment.