Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
* release/0.6.0:
  (#43) Allow forcing usage of .NET Global Tools
  (#42) Allow usage of .NET Global Tool for GitVersion
  (#41) Update to GitReleaseManager 0.13.0
  (#40) Update to Cake.Git 1.1.0
  • Loading branch information
gep13 committed May 3, 2022
2 parents 134f62b + 85c872e commit e72b005
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Chocolatey.Cake.Recipe/Content/addins.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#addin nuget:?package=Cake.Eazfuscator.Net&version=0.1.0
#addin nuget:?package=Cake.Figlet&version=1.2.0
#addin nuget:?package=Cake.FileHelpers&version=3.2.0
#addin nuget:?package=Cake.Git&version=0.19.0
#addin nuget:?package=Cake.Git&version=1.1.0
#addin nuget:?package=Cake.Gulp&version=0.11.0
#addin nuget:?package=Cake.Incubator&version=5.1.0
#addin nuget:?package=Cake.Issues&version=0.7.1
Expand Down
2 changes: 1 addition & 1 deletion Chocolatey.Cake.Recipe/Content/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Setup<BuildData>(context =>
context.Log.Verbosity = Verbosity.Diagnostic;
}

RequireTool(ToolSettings.GitVersionTool, () => {
RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.GitVersionGlobalTool : ToolSettings.GitVersionTool, () => {
BuildParameters.SetBuildVersion(
BuildVersion.CalculatingSemanticVersion(
context: Context,
Expand Down
8 changes: 4 additions & 4 deletions Chocolatey.Cake.Recipe/Content/gitreleasemanager.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///////////////////////////////////////////////////////////////////////////////

BuildParameters.Tasks.CreateReleaseNotesTask = Task("Create-Release-Notes")
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
if (BuildParameters.CanUseGitReleaseManager)
{
var settings = new GitReleaseManagerCreateSettings
Expand Down Expand Up @@ -33,7 +33,7 @@ BuildParameters.Tasks.ExportReleaseNotesTask = Task("Export-Release-Notes")
.WithCriteria(() => !BuildParameters.IsPullRequest || BuildParameters.PrepareLocalRelease, "Is pull request, and is not preparing local release")
.WithCriteria(() => BuildParameters.BranchType == BranchType.Master || BuildParameters.BranchType == BranchType.Release || BuildParameters.BranchType == BranchType.HotFix || BuildParameters.PrepareLocalRelease, "Is not a releasable branch, and is not preparing local release")
.WithCriteria(() => BuildParameters.IsTagged || BuildParameters.PrepareLocalRelease, "Is not a tagged build, and is not preparing local release")
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
if (BuildParameters.CanUseGitReleaseManager)
{
if (BuildParameters.ShouldDownloadMilestoneReleaseNotes)
Expand Down Expand Up @@ -61,7 +61,7 @@ BuildParameters.Tasks.ExportReleaseNotesTask = Task("Export-Release-Notes")
BuildParameters.Tasks.PublishGitHubReleaseTask = Task("Publish-GitHub-Release")
.IsDependentOn("Package")
.WithCriteria(() => BuildParameters.ShouldPublishGitHub)
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
if (BuildParameters.CanUseGitReleaseManager)
{
// Concatenating FilePathCollections should make sure we get unique FilePaths
Expand All @@ -88,7 +88,7 @@ BuildParameters.Tasks.PublishGitHubReleaseTask = Task("Publish-GitHub-Release")
});

BuildParameters.Tasks.CreateDefaultLabelsTask = Task("Create-Default-Labels")
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.GitReleaseManagerGlobalTool : ToolSettings.GitReleaseManagerTool, () => {
if (BuildParameters.CanUseGitReleaseManager)
{
GitReleaseManagerLabel(BuildParameters.GitHub.Token, BuildParameters.RepositoryOwner, BuildParameters.RepositoryName);
Expand Down
8 changes: 7 additions & 1 deletion Chocolatey.Cake.Recipe/Content/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public static class BuildParameters
public static TransifexMode TransifexPullMode { get; private set; }
public static int TransifexPullPercentage { get; private set; }

public static bool PreferDotNetGlobalToolUsage { get; private set; }

static BuildParameters()
{
Tasks = new BuildTasks();
Expand Down Expand Up @@ -199,6 +201,7 @@ public static class BuildParameters
context.Information("TransifexEnabled: {0}", TransifexEnabled);
context.Information("CanPullTranslations: {0}", CanPullTranslations);
context.Information("CanPushTranslations: {0}", CanPushTranslations);
context.Information("PreferDotNetGlobalToolUsage: {0}", PreferDotNetGlobalToolUsage);

if (TransifexEnabled)
{
Expand Down Expand Up @@ -279,7 +282,8 @@ public static class BuildParameters
FilePath fullReleaseNotesFilePath = null,
bool? transifexEnabled = null,
TransifexMode transifexPullMode = TransifexMode.OnlyTranslated,
int transifexPullPercentage = 60
int transifexPullPercentage = 60,
bool preferDotNetGlobalToolUsage = false
)
{
if (context == null)
Expand Down Expand Up @@ -356,6 +360,8 @@ public static class BuildParameters
ObfuscateAssembly = obfuscateAssembly;
ProductCustomAttributes = productCustomAttributes;

PreferDotNetGlobalToolUsage = preferDotNetGlobalToolUsage;

if (nuGetSources == null)
{
if (context.FileExists(NugetConfig))
Expand Down
2 changes: 1 addition & 1 deletion Chocolatey.Cake.Recipe/Content/testing.cake
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private void ReportCoverageMetric(
BuildParameters.Tasks.GenerateLocalCoverageReportTask = Task("Generate-LocalCoverageReport")
.WithCriteria(() => BuildParameters.Configuration != "ReleaseOfficial", "Skipping since build configuration is ReleaseOfficial")
.WithCriteria(() => BuildParameters.IsLocalBuild, "Skipping due to not running a local build")
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild ? ToolSettings.ReportGeneratorGlobalTool : ToolSettings.ReportGeneratorTool, () => {
.Does(() => RequireTool(BuildParameters.IsDotNetCoreBuild || BuildParameters.PreferDotNetGlobalToolUsage ? ToolSettings.ReportGeneratorGlobalTool : ToolSettings.ReportGeneratorTool, () => {
var coverageFiles = GetFiles(BuildParameters.Paths.Directories.TestCoverage + "/coverlet/*.xml");
if (FileExists(BuildParameters.Paths.Files.TestCoverageOutputFilePath))
{
Expand Down
7 changes: 5 additions & 2 deletions Chocolatey.Cake.Recipe/Content/toolsettings.cake
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ public static class ToolSettings

public static string ReportGeneratorGlobalTool { get; private set; }
public static string GitReleaseManagerGlobalTool { get; private set; }
public static string GitVersionGlobalTool { get; private set; }

public static void SetToolPreprocessorDirectives(
// This is specifically pinned to 5.0.1 as later versions break compatibility with Unix.
string gitVersionTool = "#tool nuget:?package=GitVersion.CommandLine&version=5.0.1",
string gitReleaseManagerTool = "#tool nuget:?package=GitReleaseManager&version=0.11.0",
string gitReleaseManagerTool = "#tool nuget:?package=GitReleaseManager&version=0.13.0",
string msbuildExtensionPackTool = "#tool nuget:?package=MSBuild.Extension.Pack&version=1.9.0",
string nunitTool = "#tool nuget:?package=NUnit.ConsoleRunner&version=3.10.0",
string openCoverTool = "#tool nuget:?package=OpenCover&version=4.7.922",
Expand All @@ -45,7 +46,8 @@ public static class ToolSettings
string xunitTool = "#tool nuget:?package=xunit.runner.console&version=2.4.1",
string ilMergeTool = "#tool nuget:?package=ilmerge&version=3.0.41",
string reportGeneratorGlobalTool = "#tool dotnet:?package=dotnet-reportgenerator-globaltool&version=4.8.5",
string gitReleaseManagerGlobalTool = "#tool dotnet:?package=GitReleaseManager.Tool&version=0.11.0"
string gitReleaseManagerGlobalTool = "#tool dotnet:?package=GitReleaseManager.Tool&version=0.13.0",
string gitVersionGlobalTool = "#tool dotnet:?package=GitVersion.Tool&version=5.10.1"
)
{
GitVersionTool = gitVersionTool;
Expand All @@ -62,6 +64,7 @@ public static class ToolSettings
ILMergeTool = ilMergeTool;
ReportGeneratorGlobalTool = reportGeneratorGlobalTool;
GitReleaseManagerGlobalTool = gitReleaseManagerGlobalTool;
GitVersionGlobalTool = gitVersionGlobalTool;
}

public static void SetToolSettings(
Expand Down

0 comments on commit e72b005

Please sign in to comment.