Skip to content

Commit 5929514

Browse files
committed
Merge branch 'release/4.0.0'
2 parents 1514512 + 7e22cba commit 5929514

File tree

125 files changed

+656
-660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+656
-660
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"cake.tool": {
6-
"version": "3.1.0",
6+
"version": "3.2.0",
77
"commands": [
88
"dotnet-cake"
99
]

.editorconfig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ indent_size = 4
2020

2121
[*.js]
2222
indent_style = tab
23-
indent_size = 2
23+
indent_size = 2
24+
25+
# Verify settings
26+
[*.{received,verified}.{txt,xml,json,cake}]
27+
charset = "utf-8-bom"
28+
end_of_line = lf
29+
indent_size = unset
30+
indent_style = unset
31+
insert_final_newline = false
32+
tab_width = unset
33+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919
# Merging from the command prompt will add diff markers to the files if there
2020
# are conflicts (Merging from VS is not affected by the settings below, in VS
21-
# the diff markers are never inserted). Diff markers may cause the following
21+
# the diff markers are never inserted). Diff markers may cause the following
2222
# file extensions to fail to load in VS. An alternative would be to treat
2323
# these files as binary and thus will always conflict and require user
2424
# intervention with every merge. To do so, just uncomment the entries below
@@ -47,9 +47,9 @@
4747

4848
###############################################################################
4949
# diff behavior for common document formats
50-
#
50+
#
5151
# Convert binary document formats to text before diffing them. This feature
52-
# is only available from the command line. Turn it on by uncommenting the
52+
# is only available from the command line. Turn it on by uncommenting the
5353
# entries below.
5454
###############################################################################
5555
#*.doc diff=astextplain
@@ -61,4 +61,13 @@
6161
#*.pdf diff=astextplain
6262
#*.PDF diff=astextplain
6363
#*.rtf diff=astextplain
64-
#*.RTF diff=astextplain
64+
#*.RTF diff=astextplain
65+
66+
###############################################################################
67+
# Verify files
68+
###############################################################################
69+
70+
*.verified.txt text eol=lf working-tree-encoding=UTF-8
71+
*.verified.xml text eol=lf working-tree-encoding=UTF-8
72+
*.verified.json text eol=lf working-tree-encoding=UTF-8
73+
*.verified.cake text eol=lf working-tree-encoding=UTF-8

.github/workflows/build.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ jobs:
2020
with:
2121
fetch-depth: 0
2222

23-
- name: Install .NET SDK 6.0.x
23+
- name: Install .NET SDK 6.0.x - 8.0.x
2424
uses: actions/setup-dotnet@v3
2525
with:
26-
dotnet-version: '6.0.x'
26+
dotnet-version: |
27+
6.0.x
28+
7.0.x
29+
8.0.x
2730
2831
- name: Install .NET Core SDK (global.json)
2932
uses: actions/setup-dotnet@v3
@@ -46,4 +49,5 @@ jobs:
4649
arguments: |
4750
CAKE_NETCOREAPP_6_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_6_0_VERSION_OS }}
4851
CAKE_NETCOREAPP_7_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_7_0_VERSION_OS }}
49-
52+
CAKE_NETCOREAPP_8_0_VERSION_OS: ${{ steps.build-cake.outputs.CAKE_NETCOREAPP_8_0_VERSION_OS }}
53+
ValidateGitHubActionsProvider: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,7 @@ Thumbs.db
9494
.DS_Store
9595

9696
# Generated Assembly info
97-
AssemblyInfo.Generated.cs
97+
AssemblyInfo.Generated.cs
98+
99+
# Verify
100+
*.received

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
next-version: 3.0.0
1+
next-version: 4.0.0
22
branches:
33
master:
44
regex: main

ReleaseNotes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
### New in 4.0.0 (Released 2023/11/18)
2+
3+
* 4266 Update LatestPotentialBreakingChange to 4.0.0.
4+
* 4132 Add File APIs for setting timestamps (creation time, last write time, last access time).
5+
* 4250 Update System.Collections.Immutable to 8.0.0.
6+
* 4260 Unzip alias should support overwrite files.
7+
* 4251 Update System.Reflection.Metadata 8.0.0.
8+
* 4249 Update Microsoft.Extensions.DependencyInjection to 8.0.0.
9+
* 4197 Execution of Cake script fails if an addin defines an alias that uses nullable reference types in its signature.
10+
* 4150 Cake script is contributing unactionable diagnostics in VS Code Problems pane.
11+
112
### New in 3.2.0 (Released 2023/11/10)
213

314
* 4225 Add DotNetRemovePackage alias for dotnet remove package command.

build.cake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Install .NET Core Global tools.
55
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.12.0"
6-
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitReleaseManager.Tool&version=0.13.0"
6+
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitReleaseManager.Tool&version=0.16.0"
77
#tool "dotnet:https://api.nuget.org/v3/index.json?package=sign&version=0.9.1-beta.23530.1&prerelease"
88

99
// Load other scripts.
@@ -108,7 +108,7 @@ Task("Run-Unit-Tests")
108108
() => GetFiles("./src/**/*.Tests.csproj"),
109109
(parameters, project, context) =>
110110
{
111-
foreach(var framework in new[] { "net6.0", "net7.0" })
111+
foreach(var framework in new[] { "net6.0", "net7.0", "net8.0" })
112112
{
113113
FilePath testResultsPath = MakeAbsolute(parameters.Paths.Directories.TestResults
114114
.CombineWithFilePath($"{project.GetFilenameWithoutExtension()}_{framework}_TestResults.xml"));
@@ -368,7 +368,8 @@ Task("Run-Integration-Tests")
368368
.DoesForEach<BuildParameters, FilePath>(
369369
parameters => new[] {
370370
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net6.0/**/Cake.dll").Single(),
371-
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single()
371+
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net7.0/**/Cake.dll").Single(),
372+
GetFiles($"{parameters.Paths.Directories.IntegrationTestsBinTool.FullPath}/**/net8.0/**/Cake.dll").Single()
372373
},
373374
(parameters, cakeAssembly, context) =>
374375
{

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"src"
44
],
55
"sdk": {
6-
"version": "7.0.403",
6+
"version": "8.0.100",
77
"rollForward": "latestFeature"
88
}
99
}

src/Cake.Common.Tests/Cake.Common.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
</ItemGroup>
1717
<!-- Global packages -->
1818
<ItemGroup>
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
20-
<PackageReference Include="xunit" Version="2.5.3" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
20+
<PackageReference Include="xunit" Version="2.6.1" />
2121
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>

src/Cake.Common/IO/ZipAliases.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,27 @@ public static void Zip(this ICakeContext context, DirectoryPath rootPath, FilePa
135135
/// </example>
136136
[CakeMethodAlias]
137137
public static void Unzip(this ICakeContext context, FilePath zipFile, DirectoryPath outputPath)
138+
=> context.Unzip(zipFile, outputPath, false);
139+
140+
/// <summary>
141+
/// Unzips the specified file.
142+
/// </summary>
143+
/// <param name="context">The context.</param>
144+
/// <param name="zipFile">Zip file to unzip.</param>
145+
/// <param name="outputPath">Output path to unzip into.</param>
146+
/// <param name="overwriteFiles">Flag for if files should be overwritten in output.</param>
147+
/// <example>
148+
/// <code>
149+
/// Unzip("Cake.zip", "./cake", true);
150+
/// </code>
151+
/// </example>
152+
[CakeMethodAlias]
153+
public static void Unzip(this ICakeContext context, FilePath zipFile, DirectoryPath outputPath, bool overwriteFiles)
138154
{
139-
if (context == null)
140-
{
141-
throw new ArgumentNullException(nameof(context));
142-
}
155+
ArgumentNullException.ThrowIfNull(context);
143156

144157
var zipper = new Zipper(context.FileSystem, context.Environment, context.Log);
145-
zipper.Unzip(zipFile, outputPath);
158+
zipper.Unzip(zipFile, outputPath, overwriteFiles);
146159
}
147160
}
148161
}

src/Cake.Common/IO/Zipper.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,25 @@ public void Zip(DirectoryPath rootPath, FilePath outputPath, IEnumerable<FilePat
204204
/// <param name="zipPath">Zip file path.</param>
205205
/// <param name="outputPath">Output directory path.</param>
206206
public void Unzip(FilePath zipPath, DirectoryPath outputPath)
207+
=> Unzip(zipPath, outputPath, false);
208+
209+
/// <summary>
210+
/// Unzips the specified file to the specified output path.
211+
/// </summary>
212+
/// <param name="zipPath">Zip file path.</param>
213+
/// <param name="outputPath">Output directory path.</param>
214+
/// <param name="overwriteFiles">Flag for if files should be overwritten in output.</param>
215+
public void Unzip(FilePath zipPath, DirectoryPath outputPath, bool overwriteFiles)
207216
{
208-
if (zipPath == null)
209-
{
210-
throw new ArgumentNullException(nameof(zipPath));
211-
}
212-
if (outputPath == null)
213-
{
214-
throw new ArgumentNullException(nameof(outputPath));
215-
}
217+
ArgumentNullException.ThrowIfNull(zipPath);
218+
ArgumentNullException.ThrowIfNull(outputPath);
216219

217220
// Make root path and output file path absolute.
218221
zipPath = zipPath.MakeAbsolute(_environment);
219222
outputPath = outputPath.MakeAbsolute(_environment);
220223

221-
_log.Verbose("Unzipping file {0} to {1}", zipPath.FullPath, outputPath.FullPath);
222-
ZipFile.ExtractToDirectory(zipPath.FullPath, outputPath.FullPath);
224+
_log.Verbose("Unzipping file {0} to {1} (overwrite files: {2})", zipPath.FullPath, outputPath.FullPath, overwriteFiles);
225+
ZipFile.ExtractToDirectory(zipPath.FullPath, outputPath.FullPath, overwriteFiles);
223226
}
224227

225228
private string GetRelativePath(DirectoryPath root, Path path)

src/Cake.Core.Tests/Cake.Core.Tests.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
</ItemGroup>
1515
<!-- Global packages -->
1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
18-
<PackageReference Include="xunit" Version="2.5.3" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
18+
<PackageReference Include="Spectre.Verify.Extensions" Version="22.3.0" />
19+
<PackageReference Include="Verify.Xunit" Version="22.5.0" />
20+
<PackageReference Include="xunit" Version="2.6.1" />
1921
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
2022
<PrivateAssets>all</PrivateAssets>
2123
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
@@ -24,7 +26,6 @@
2426
<PackageReference Include="Castle.Core" Version="5.1.1" />
2527
</ItemGroup>
2628
<ItemGroup>
27-
<EmbeddedResource Include="Unit\Scripting\CodeGen\Expected\Methods\*;Unit\Scripting\CodeGen\Expected\Properties\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
2829
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
2930
</ItemGroup>
3031
</Project>

src/Cake.Core.Tests/Data/MethodAliasGeneratorData.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,21 @@ public static dynamic NonGeneric_ExtensionMethodWithDynamicReturnValue(this ICak
246246
{
247247
throw new NotImplementedException();
248248
}
249+
250+
[CakeMethodAlias]
251+
#nullable enable
252+
public static void NonGeneric_ExtensionMethodWithNullableParameter(this ICakeContext context, string? parameter)
253+
#nullable disable
254+
{
255+
throw new NotImplementedException();
256+
}
257+
258+
[CakeMethodAlias]
259+
#nullable enable
260+
public static string? NonGeneric_ExtensionMethodWithNullableReturnValue(this ICakeContext context)
261+
#nullable disable
262+
{
263+
throw new NotImplementedException();
264+
}
249265
}
250266
}

src/Cake.Core.Tests/Data/PropertyAliasGeneratorData.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,13 @@ public static int Cached_Obsolete_ExplicitError_WithMessage(this ICakeContext co
123123
{
124124
throw new NotImplementedException();
125125
}
126+
127+
[CakePropertyAlias(Cache = true)]
128+
#nullable enable
129+
public static string? Cached_Nullable_Type(this ICakeContext context)
130+
#nullable disable
131+
{
132+
throw new NotImplementedException();
133+
}
126134
}
127135
}

src/Cake.Core.Tests/Exceptions/CustomeExitCodeTests.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[System.Diagnostics.DebuggerStepThrough]
2+
public void Generic_ExtensionMethod<TTest>()
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethod<TTest>(Context);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[System.Diagnostics.DebuggerStepThrough]
2+
public TTest Generic_ExtensionMethodWithGenericReturnValue<TTest>(TTest value)
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValue<TTest>(Context, value);

src/Cake.Core.Tests/Unit/Scripting/CodeGen/Expected/Methods/Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints renamed to src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints.verified.cake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
public TOut Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints<TIn, TOut>(TIn arg)
33
where TIn : class, new()
44
where TOut : System.Collections.ArrayList, System.IDisposable
5-
{
6-
return Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints<TIn, TOut>(Context, arg);
7-
}
5+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints<TIn, TOut>(Context, arg);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[System.Diagnostics.DebuggerStepThrough]
2+
public void Generic_ExtensionMethodWithParameter<TTest>(TTest value)
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithParameter<TTest>(Context, value);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[System.Diagnostics.DebuggerStepThrough]
2+
public dynamic NonGeneric_ExtensionMethodWithDynamicReturnValue()
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithDynamicReturnValue(Context);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[System.Diagnostics.DebuggerStepThrough]
22
public void NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(System.Collections.Generic.ICollection<Cake.Core.Tests.Data.MethodAliasGeneratorData.TestNestedEnum> items)
3-
{
4-
Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(Context, items);
5-
}
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(Context, items);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[System.Diagnostics.DebuggerStepThrough]
22
public void NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(System.Linq.Expressions.Expression<System.Func<System.String, System.String>>[] expression)
3-
{
4-
Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(Context, expression);
5-
}
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(Context, expression);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[System.Diagnostics.DebuggerStepThrough]
22
public void NonGeneric_ExtensionMethodWithGenericExpressionParameter(System.Linq.Expressions.Expression<System.Func<System.String, System.String>> expression)
3-
{
4-
Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParameter(Context, expression);
5-
}
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParameter(Context, expression);
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[System.Diagnostics.DebuggerStepThrough]
22
public void NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(params System.Linq.Expressions.Expression<System.Func<System.String, System.String>>[] expression)
3-
{
4-
Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(Context, expression);
5-
}
3+
=> Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(Context, expression);

0 commit comments

Comments
 (0)