Skip to content

Commit

Permalink
Update Cake.MinVer add-in to target Cake v2.0.0 (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoproiete authored Dec 1, 2021
1 parent d61d4d7 commit 4f3b381
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 50 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
job:
- os: ubuntu-18.04
build: ./build.sh
push: true
- os: ubuntu-20.04
build: ./build.sh
push: true
- os: windows-2019
build: ./build.cmd
- os: windows-2022
Expand All @@ -50,6 +50,10 @@ jobs:
uses: actions/[email protected]
with:
dotnet-version: "5.0.401"
- name: Setup net6.0
uses: actions/[email protected]
with:
dotnet-version: "6.0.100"
- name: Run dotnet --info
run: dotnet --info
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "5.0.100",
"version": "6.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 3 additions & 3 deletions src/Cake.MinVer/Cake.MinVer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<RootNamespace>Cake.MinVer</RootNamespace>

<AssemblyName>Cake.MinVer</AssemblyName>
Expand Down Expand Up @@ -40,8 +40,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Core" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/Cake.MinVer/MinVerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
#endregion

using System;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNet;
using Cake.Core.IO;

namespace Cake.MinVer
{
/// <summary>
/// Contains settings used by <see cref="MinVerTool" />.
/// </summary>
public class MinVerSettings : DotNetCoreSettings, ICloneable
public class MinVerSettings : DotNetSettings, ICloneable
{
/// <summary>
/// Set the version part to be automatically incremented.
Expand Down Expand Up @@ -95,7 +95,7 @@ public class MinVerSettings : DotNetCoreSettings, ICloneable
/// </summary>
public new MinVerVerbosity? Verbosity { get; set; }

internal DotNetCoreVerbosity? ToolVerbosity
internal DotNetVerbosity? ToolVerbosity
{
get => base.Verbosity;
set => base.Verbosity = value;
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.MinVer/MinVerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;
using System.Globalization;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNet;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
Expand All @@ -28,7 +28,7 @@ namespace Cake.MinVer
/// <summary>
/// MinVer dotnet tool.
/// </summary>
public class MinVerTool : DotNetCoreTool<MinVerSettings>
public class MinVerTool : DotNetTool<MinVerSettings>
{
private readonly IMinVerLocalTool _localTool;
private readonly IMinVerGlobalTool _globalTool;
Expand Down
16 changes: 8 additions & 8 deletions src/Cake.MinVer/MinVerToolBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNet;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.MinVer
{
internal abstract class MinVerToolBase : DotNetCoreTool<MinVerSettings>, IMinVerTool
internal abstract class MinVerToolBase : DotNetTool<MinVerSettings>, IMinVerTool
{
protected MinVerToolBase(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner,
IToolLocator tools, ICakeLog log)
Expand Down Expand Up @@ -250,15 +250,15 @@ private static void AppendVerbosity(ProcessArgumentBuilder args, MinVerSettings
}
}

private static MinVerVerbosity ToolToMinVerVerbosityConverter(DotNetCoreVerbosity toolVerbosity)
private static MinVerVerbosity ToolToMinVerVerbosityConverter(DotNetVerbosity toolVerbosity)
{
return toolVerbosity switch
{
DotNetCoreVerbosity.Quiet => MinVerVerbosity.Error,
DotNetCoreVerbosity.Minimal => MinVerVerbosity.Warn,
DotNetCoreVerbosity.Normal => MinVerVerbosity.Info,
DotNetCoreVerbosity.Detailed => MinVerVerbosity.Debug,
DotNetCoreVerbosity.Diagnostic => MinVerVerbosity.Trace,
DotNetVerbosity.Quiet => MinVerVerbosity.Error,
DotNetVerbosity.Minimal => MinVerVerbosity.Warn,
DotNetVerbosity.Normal => MinVerVerbosity.Info,
DotNetVerbosity.Detailed => MinVerVerbosity.Debug,
DotNetVerbosity.Diagnostic => MinVerVerbosity.Trace,
_ => MinVerVerbosity.Info
};
}
Expand Down
8 changes: 4 additions & 4 deletions test/Cake.MinVer.Tests/Cake.MinVer.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" />
<PackageReference Include="Cake.Common" Version="1.0.0" />
<PackageReference Include="Cake.Testing" Version="1.0.0" />
<PackageReference Include="Cake.Core" Version="2.0.0" />
<PackageReference Include="Cake.Common" Version="2.0.0" />
<PackageReference Include="Cake.Testing" Version="2.0.0" />

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.9.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,15 @@
BuildMetadata: 123,
DefaultPreReleasePhase: preview,
MinimumMajorMinor: 1.2,
Repo: {
FullPath: /repo/custom,
Separator: "/",
Segments: [
/repo,
custom
]
},
Repo: /repo/custom,
TagPrefix: v,
PreferGlobalTool: true,
NoFallback: true,
Verbosity: Trace,
DiagnosticOutput: true,
ToolPath: {
HasExtension: true,
FullPath: /tools/custom/minver.exe,
Separator: "/",
Segments: [
/tools,
custom,
minver.exe
]
},
ToolPath: /tools/custom/minver.exe,
ToolTimeout: 00:05:00,
WorkingDirectory: {
FullPath: /working/folder,
Separator: "/",
Segments: [
/working,
folder
]
},
WorkingDirectory: /working/folder,
NoWorkingDirectory: true,
ArgumentCustomization: {
Type: Func<ProcessArgumentBuilder, ProcessArgumentBuilder>,
Expand Down
4 changes: 2 additions & 2 deletions test/Cake.MinVer.Tests/MinVerSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System;
using System.Collections.Generic;
using Xunit;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNet;
using Cake.Core.IO;
using VerifyXunit;
using System.Threading.Tasks;
Expand All @@ -41,7 +41,7 @@ public Task Should_Shallow_Clone_All_Properties()
PreferGlobalTool = true,
NoFallback = true,
Verbosity = MinVerVerbosity.Trace,
ToolVerbosity = DotNetCoreVerbosity.Detailed,
ToolVerbosity = DotNetVerbosity.Detailed,

DiagnosticOutput = true,
ToolPath = FilePath.FromString("/tools/custom/minver.exe"),
Expand Down

0 comments on commit 4f3b381

Please sign in to comment.