Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Cake 1.2.0 #4800

Merged
merged 2 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Cake.BuildSystems.Module" Version="3.0.1" />
<PackageReference Include="Cake.FileHelpers" Version="4.0.0" />
<PackageReference Include="Cake.Frosting" Version="1.1.0" />
<PackageReference Include="Cake.Git" Version="1.0.1" />
<PackageReference Include="Cake.Issues" Version="0.9.1" />
<PackageReference Include="Cake.Issues.MsBuild" Version="0.9.1" />
<PackageReference Include="Cake.Issues.Recipe" Version="0.4.4" />
<PackageReference Include="Cake.BuildSystems.Module" Version="3.0.3" />
<PackageReference Include="Cake.FileHelpers" Version="4.0.1" />
<PackageReference Include="Cake.Frosting" Version="1.2.0" />
<PackageReference Include="Cake.Frosting.Issues.Recipe" Version="1.2.0" />
<PackageReference Include="Cake.Git" Version="1.1.0" />
<PackageReference Include="Cake.Issues" Version="1.0.0" />
<PackageReference Include="Cake.Issues.MsBuild" Version="1.0.0" />
<PackageReference Include="Cake.Json" Version="6.0.1" />
<PackageReference Include="Cake.XdtTransform" Version="1.0.0" />
<PackageReference Include="Dnn.CakeUtils" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Dnn.CakeUtils" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
6 changes: 3 additions & 3 deletions Build/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ namespace DotNetNuke.Build
using Cake.Common.IO.Paths;
using Cake.Common.Tools.GitVersion;
using Cake.Core;
using Cake.Frosting;
using Cake.Frosting.Issues.Recipe;
using Cake.Json;

/// <inheritdoc/>
public class Context : FrostingContext
public class Context : IssuesContext
{
/// <summary>Initializes a new instance of the <see cref="Context"/> class.</summary>
/// <param name="context">The base context.</param>
public Context(ICakeContext context)
: base(context)
: base(context, RepositoryInfoProviderType.CakeGit)
{
try
{
Expand Down
19 changes: 14 additions & 5 deletions Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
namespace DotNetNuke.Build
{
using System;
using System.Reflection;

using Cake.AzurePipelines.Module;
using Cake.Frosting;
using Cake.Frosting.Issues.Recipe;

/// <summary>Runs the build process.</summary>
public class Program
{
/// <summary>The version of the Microsoft.TestPlatform NuGet package.</summary>
internal const string MicrosoftTestPlatformVersion = "16.11.0";

/// <summary>The version of the NUnit3TestAdapter NuGet package.</summary>
internal const string NUnit3TestAdapterVersion = "4.0.0";

/// <summary>Runs the build process.</summary>
/// <param name="args">The arguments from the command line.</param>
/// <returns>A status code.</returns>
Expand All @@ -21,11 +29,12 @@ public static int Main(string[] args)
.UseLifetime<Lifetime>()
.UseWorkingDirectory("..")
.UseModule<AzurePipelinesModule>()
.InstallTool(new Uri("nuget:?package=GitVersion.CommandLine&version=5.0.1"))
.InstallTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=16.8.0"))
.InstallTool(new Uri("nuget:?package=NUnit3TestAdapter&version=4.0.0"))
.InstallTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.8.0"))
.InstallTool(new Uri("nuget:?package=Cake.Issues.MsBuild&version=0.9.1"))
.InstallTool(new Uri("dotnet:?package=GitVersion.Tool&version=5.7.0"))
.InstallTool(new Uri("nuget:?package=Microsoft.TestPlatform&version=" + MicrosoftTestPlatformVersion))
.InstallTool(new Uri("nuget:?package=NUnit3TestAdapter&version=" + NUnit3TestAdapterVersion))
.InstallTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.10.0"))
.InstallTool(new Uri("nuget:?package=Cake.Issues.MsBuild&version=1.0.0"))
.AddAssembly(Assembly.GetAssembly(typeof(IssuesTask)))
.Run(args);
}
}
Expand Down
39 changes: 4 additions & 35 deletions Build/Tasks/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,17 @@
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Build.Tasks
{
using System;
using System.Linq;

using Cake.Common.Build;
using Cake.Common.Build.AzurePipelines.Data;
using Cake.Common.Tools.MSBuild;
using Cake.Core.IO;
using Cake.Frosting;
using Cake.Issues;
using Cake.Issues.MsBuild;
using Cake.Frosting.Issues.Recipe;

using DotNetNuke.Build;

/// <summary>A cake task to compile the platform.</summary>
[Dependency(typeof(CleanWebsite))]
[Dependency(typeof(RestoreNuGetPackages))]
[IsDependeeOf(typeof(ReadIssuesTask))]
public sealed class Build : FrostingTask<Context>
{
/// <inheritdoc/>
Expand All @@ -41,7 +36,8 @@ public override void Run(Context context)
}
finally
{
ReportBuildIssues(context, cleanLog, buildLog);
context.Parameters.InputFiles.AddMsBuildBinaryLogFile(cleanLog);
context.Parameters.InputFiles.AddMsBuildBinaryLogFile(buildLog);
}
}

Expand All @@ -52,32 +48,5 @@ private static MSBuildSettings CreateMsBuildSettings(Context context, FilePath b
.WithLogger(context.Tools.Resolve("Cake.Issues.MsBuild*/**/StructuredLogger.dll").FullPath, "BinaryLogger", binLogPath.FullPath)
.SetNoConsoleLogger(context.IsRunningInCI);
}

private static void ReportBuildIssues(Context context, params FilePath[] logFilePaths)
{
if (!context.IsRunningInCI)
{
return;
}

// TODO: when Cake.Issues.Recipe is updated to support Frosting, we can switch to their more robust issue processing and reporting features
var issueProviders = logFilePaths.Select(logFilePath => context.MsBuildIssuesFromFilePath(logFilePath, context.MsBuildBinaryLogFileFormat()));
foreach (var issue in context.ReadIssues(issueProviders, context.Environment.WorkingDirectory))
{
var messageData = new AzurePipelinesMessageData
{
SourcePath = issue.AffectedFileRelativePath?.FullPath,
LineNumber = issue.Line,
};
if (issue.Priority == (int)IssuePriority.Error)
{
context.AzurePipelines().Commands.WriteError(issue.MessageText, messageData);
}
else
{
context.AzurePipelines().Commands.WriteWarning(issue.MessageText, messageData);
}
}
}
}
}
5 changes: 2 additions & 3 deletions Build/Tasks/BuildAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Build.Tasks
{
using System;
using System.Linq;

using Cake.Frosting;
using Cake.Frosting.Issues.Recipe;

/// <summary>A cake task to compile the platform and create all of the packages.</summary>
/// <remarks>This is the task run during CI.</remarks>
Expand All @@ -20,6 +18,7 @@ namespace DotNetNuke.Build.Tasks
[Dependency(typeof(CreateSymbols))]
[Dependency(typeof(CreateNugetPackages))]
[Dependency(typeof(GeneratePackagesChecksums))]
[IsDependentOn(typeof(IssuesTask))]
public sealed class BuildAll : FrostingTask<Context>
{
/// <inheritdoc/>
Expand Down
4 changes: 2 additions & 2 deletions Build/Tasks/CreateNugetPackages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public override void Run(Context context)
OutputDirectory = @"./Artifacts/",
IncludeReferencedProjects = true,
Symbols = true,
SymbolPackageFormat = "snupkg",
Properties = new Dictionary<string, string> { { "Configuration", "Release" } },
ArgumentCustomization = args => args.Append("-SymbolPackageFormat snupkg"),
};

nuspecFiles -= noSymbolsNuspecFiles;
Expand All @@ -47,7 +47,7 @@ public override void Run(Context context)
}

nuGetPackSettings.Symbols = false;
nuGetPackSettings.ArgumentCustomization = null;
nuGetPackSettings.SymbolPackageFormat = null;
foreach (var spec in noSymbolsNuspecFiles)
{
context.Information("Starting to pack: {0}", spec);
Expand Down
4 changes: 2 additions & 2 deletions Build/Tasks/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void Run(Context context)
testAssemblies -= context.GetFiles(@"**\DotNetNuke.Tests.Integration.dll");
testAssemblies -= context.GetFiles(@"**\DotNetNuke.Tests.Urls.dll");

var vsTestPath = context.GetFiles("tools/Microsoft.TestPlatform.16.8.0/tools/**/vstest.console.exe")
var vsTestPath = context.GetFiles($"tools/Microsoft.TestPlatform.{Program.MicrosoftTestPlatformVersion}/tools/**/vstest.console.exe")
.First();
context.VSTest(
testAssemblies,
Expand All @@ -36,7 +36,7 @@ public override void Run(Context context)
Logger = "trx",
Parallel = true,
EnableCodeCoverage = true,
TestAdapterPath = @"tools\NUnit3TestAdapter.4.0.0\build",
TestAdapterPath = $@"tools\NUnit3TestAdapter.{Program.NUnit3TestAdapterVersion}\build",
});
}
}
Expand Down
3 changes: 1 addition & 2 deletions build.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/usr/bin/env bash
CAKE_VERSION=0.38.5
DOTNET_VERSION=5.0.102
DOTNET_VERSION=5.0.400
7 changes: 0 additions & 7 deletions gitversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,3 @@ branches:
prevent-increment-of-merged-branch-version: false
is-release-branch: false
source-branches: []
catch-all:
regex: (.*?)
tag: 'unstable'
increment: Patch
prevent-increment-of-merged-branch-version: false
is-release-branch: false
source-branches: []