Skip to content

Commit

Permalink
feat!: Upgrade to Cake 2.0
Browse files Browse the repository at this point in the history
Upgrade to verison 2.0 of Cake and bump version to 2.0 to reflect that change.
Because of breakign changes in Cake, version 2 of the shared build tasks must only be used with Cake.Frosting 2.0
  • Loading branch information
ap0llo committed Dec 27, 2021
1 parent 75ed38e commit 4fff0bf
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 36 deletions.
4 changes: 2 additions & 2 deletions build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.BuildSystems.Module" Version="3.0.3" />
<PackageReference Include="Cake.BuildSystems.Module" Version="4.0.0" />
<PackageReference Include="Cake.DotNetLocalTools.Module" Version="1.0.2" />
<PackageReference Include="Cake.Frosting" Version="1.3.0" />
<PackageReference Include="Cake.Frosting" Version="2.0.0" />
<PackageReference Include="Cake.GitVersioning" Version="3.5.50-alpha" />
<PackageReference Include="Cake.GitHubReleases" Version="1.0.10" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
Expand Down
4 changes: 2 additions & 2 deletions src/SharedBuild/Grynwald.SharedBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.BuildSystems.Module" Version="3.0.3" />
<PackageReference Include="Cake.Frosting" Version="1.3.0" />
<PackageReference Include="Cake.BuildSystems.Module" Version="4.0.0" />
<PackageReference Include="Cake.Frosting" Version="2.0.0" />
<PackageReference Include="Cake.GitHubReleases" Version="1.0.10" />
<PackageReference Include="Cake.GitVersioning" Version="3.5.50-alpha" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
Expand Down
14 changes: 7 additions & 7 deletions src/SharedBuild/Tasks/BuildTask.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Build;
using Cake.Common.Tools.DotNetCore.MSBuild;
using Cake.Common.Tools.DotNetCore.Restore;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Build;
using Cake.Common.Tools.DotNet.MSBuild;
using Cake.Common.Tools.DotNet.Restore;
using Cake.Core.Diagnostics;
using Cake.Frosting;

Expand All @@ -16,7 +16,7 @@ public override void Run(IBuildContext context)
// Restore NuGet Packages
//
context.Log.Information("Restoring NuGet Packages");
context.DotNetCoreRestore(context.SolutionPath.FullPath, new DotNetCoreRestoreSettings()
context.DotNetRestore(context.SolutionPath.FullPath, new DotNetRestoreSettings()
{
MSBuildSettings = context.BuildSettings.GetDefaultMSBuildSettings()
});
Expand All @@ -25,7 +25,7 @@ public override void Run(IBuildContext context)
// Build
//
context.Log.Information($"Building {context.SolutionPath}");
var buildSettings = new DotNetCoreBuildSettings()
var buildSettings = new DotNetBuildSettings()
{
Configuration = context.BuildSettings.Configuration,
NoRestore = true,
Expand All @@ -39,7 +39,7 @@ public override void Run(IBuildContext context)
buildSettings.MSBuildSettings.WithProperty("Deterministic", "true");
}

context.DotNetCoreBuild(context.SolutionPath.FullPath, buildSettings);
context.DotNetBuild(context.SolutionPath.FullPath, buildSettings);
}
}
}
10 changes: 5 additions & 5 deletions src/SharedBuild/Tasks/PackTask.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cake.Common.IO;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.MSBuild;
using Cake.Common.Tools.DotNetCore.Pack;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.MSBuild;
using Cake.Common.Tools.DotNet.Pack;
using Cake.Core.Diagnostics;
using Cake.Frosting;

Expand All @@ -22,7 +22,7 @@ public override void Run(IBuildContext context)
// Pack NuGet packages
//
context.Log.Information("Packing NuGet Packages");
var packSettings = new DotNetCorePackSettings()
var packSettings = new DotNetPackSettings()
{
Configuration = context.BuildSettings.Configuration,
OutputDirectory = context.Output.PackagesDirectory,
Expand All @@ -38,7 +38,7 @@ public override void Run(IBuildContext context)
packSettings.MSBuildSettings.WithProperty("Deterministic", "true");
}

context.DotNetCorePack(context.SolutionPath.FullPath, packSettings);
context.DotNetPack(context.SolutionPath.FullPath, packSettings);

//
// Publish Artifacts
Expand Down
22 changes: 11 additions & 11 deletions src/SharedBuild/Tasks/PushTask.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Linq;
using Cake.Common;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.NuGet.Push;
using Cake.Common.Tools.DotNetCore.NuGet.Source;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.NuGet.Push;
using Cake.Common.Tools.DotNet.NuGet.Source;
using Cake.Core.Diagnostics;
using Cake.Frosting;

Expand Down Expand Up @@ -53,9 +53,9 @@ private void PushToAzureArtifacts(IBuildContext context, IPushTarget pushTarget)
throw new InvalidOperationException("Could not resolve SYSTEM_ACCESSTOKEN.");
}

context.DotNetCoreNuGetAddSource(
context.DotNetNuGetAddSource(
"AzureArtifacts",
new DotNetCoreNuGetSourceSettings()
new DotNetNuGetSourceSettings()
{
Source = pushTarget.FeedUrl,
UserName = "AzureArtifacts",
Expand All @@ -66,13 +66,13 @@ private void PushToAzureArtifacts(IBuildContext context, IPushTarget pushTarget)
foreach (var package in context.Output.PackageFiles)
{
context.Log.Information($"Pushing package '{package}'");
var pushSettings = new DotNetCoreNuGetPushSettings()
var pushSettings = new DotNetNuGetPushSettings()
{
Source = "AzureArtifacts",
ApiKey = "AzureArtifacts"
};

context.DotNetCoreNuGetPush(package.FullPath, pushSettings);
context.DotNetNuGetPush(package.FullPath, pushSettings);
}
}

Expand All @@ -88,13 +88,13 @@ private void PushToNuGetOrg(IBuildContext context, IPushTarget pushTarget)
foreach (var package in context.Output.PackageFiles)
{
context.Log.Information($"Pushing package '{package}'");
var pushSettings = new DotNetCoreNuGetPushSettings()
var pushSettings = new DotNetNuGetPushSettings()
{
Source = pushTarget.FeedUrl,
ApiKey = apiKey
};

context.DotNetCoreNuGetPush(package.FullPath, pushSettings);
context.DotNetNuGetPush(package.FullPath, pushSettings);
}
}

Expand All @@ -110,13 +110,13 @@ private void PushToMyGet(IBuildContext context, IPushTarget pushTarget)
foreach (var package in context.Output.PackageFiles)
{
context.Log.Information($"Pushing package '{package}'");
var pushSettings = new DotNetCoreNuGetPushSettings()
var pushSettings = new DotNetNuGetPushSettings()
{
Source = pushTarget.FeedUrl,
ApiKey = apiKey
};

context.DotNetCoreNuGetPush(package.FullPath, pushSettings);
context.DotNetNuGetPush(package.FullPath, pushSettings);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/SharedBuild/Tasks/TestTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Cake.Common.Build.AzurePipelines.Data;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Test;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Test;
using Cake.Common.Tools.ReportGenerator;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
Expand Down Expand Up @@ -47,7 +47,7 @@ private void RunTests(IBuildContext context)
//
// Run tests
//
var testSettings = new DotNetCoreTestSettings()
var testSettings = new DotNetTestSettings()
{
Configuration = context.BuildSettings.Configuration,
NoBuild = true,
Expand All @@ -62,7 +62,7 @@ private void RunTests(IBuildContext context)
testSettings.Collectors = new[] { "XPlat Code Coverage" };
}

context.DotNetCoreTest(context.SolutionPath.FullPath, testSettings);
context.DotNetTest(context.SolutionPath.FullPath, testSettings);

//
// Publish Test Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ public class DefaultAzurePipelinesContext : IAzurePipelinesContext
public virtual IAzurePipelinesArtifactNames ArtifactNames { get; }

/// <inheritdoc />
public virtual bool IsActive => IsRunningOnAzurePipelines || IsRunningOnAzurePipelinesHosted;
public virtual bool IsActive => IsRunningOnAzurePipelines;

/// <inheritdoc />
public virtual bool IsRunningOnAzurePipelines => m_AzurePipelinesProvider.IsRunningOnAzurePipelines;

/// <inheritdoc />
public virtual bool IsRunningOnAzurePipelinesHosted => m_AzurePipelinesProvider.IsRunningOnAzurePipelinesHosted;

/// <inheritdoc />
public virtual AzurePipelinesEnvironmentInfo Environment => m_AzurePipelinesProvider.Environment;

Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.1-pre",
"version": "2.0-pre",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/release/v\\d+\\.\\d+"
Expand Down

0 comments on commit 4fff0bf

Please sign in to comment.