(#155) Cake v6.0.0 catch-up + IEnumerable<string> overloads#172
Merged
Conversation
Per-major contract anchor moves: - Addin: Cake.Core / Cake.Common 5.0.0 -> 6.0.0; TFMs gain net10.0 (now net8.0;net9.0;net10.0). - Tests: Cake.Testing 5.0.0 -> 6.0.0. Tests TFM stays at net8.0 (lowest-of-addin's-range, per the workspace rotation table for Cake 6.x). - global.json SDK 9.0.100 -> 10.0.100, matching the new highest TFM. Demo/* pin bumps + demo/sdk introduction land in subsequent commits.
- demo/script/.config/dotnet-tools.json: cake.tool 5.1.0 -> 6.1.0 - demo/frosting/build/Build.csproj: Cake.Frosting 5.1.0 -> 6.1.0 Both pins are latest-of-major as of 2026-05-07 (per workspace memory feedback_demo_pins_use_latest_of_major). HintPath stays at net8.0 — that's the workspace anchor TFM for demo/* references, unchanged across Cake majors.
…dk CI step
Cake.Sdk debuted at 6.0.0 (no 1.x-5.x SDK), so the SDK demo joins
the workspace's standard demo trifecta exactly at this Cake 6
catch-up. Mirrors filehelpers.cake's task surface as a file-based
.NET program (.NET 10's cake.cs / dotnet run-file feature).
- #:sdk Cake.Sdk@6.1.1 (latest 6.x as of 2026-05-07).
- #:project ../../src/Cake.FileHelpers/Cake.FileHelpers.csproj —
builds the addin from source rather than referencing a
published nupkg (so this demo doubles as an integration test
against the addin's working tree, not just the latest published
package).
- No Nullable=enable / NoWarn=CS8603 needed — Cake.FileHelpers'
public API doesn't use nullable annotations, so the
source-generator nullability gap (memory
feedback_demo_folder_pattern) isn't triggered.
- AssertThat helper sits below RunTarget("Default") per CS8803
(top-level statements precede type declarations).
build.yml gains a Run demo/sdk step after Run demo/frosting,
gated on `if: success()` and run with `working-directory:
./demo/sdk` (cake.cs is invoked directly via `dotnet cake.cs` —
no wrapper script needed since the file IS the program).
…/ FileAppendLines
Closes the 10-year-old request to accept any IEnumerable<string>
without forcing callers through .ToArray() (e.g. piping process
output into FileWriteLines / FileAppendLines without a materialise
step):
FileWriteLines("test", process.GetStandardOutput());
Four new public overloads on FileHelperAliases:
- FileWriteLines(this ICakeContext, FilePath, IEnumerable<string>)
- FileWriteLines(this ICakeContext, FilePath, Encoding, IEnumerable<string>)
- FileAppendLines(this ICakeContext, FilePath, IEnumerable<string>)
- FileAppendLines(this ICakeContext, FilePath, Encoding, IEnumerable<string>)
Existing string[] overloads stay (binary-compat for downstream
addins that link against Cake.FileHelpers via PackageReference);
overload resolution picks the existing string[] form when a literal
`new[] { ... }` is passed, so no behavior change at any current
call site. The internal WriteLines helper widens to
IEnumerable<string> — string[] satisfies that contract, so all
existing call sites keep working unchanged.
Tests added covering each new overload via List<string> typed as
IEnumerable<string> (guarantees the new overload is dispatched
rather than the string[] one).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #155.
Closes #2.
Scope
Cake 6 catch-up (#155)
Cake.Core/Cake.Common5.0.0 → 6.0.0. TFMs gainnet10.0(nownet8.0;net9.0;net10.0).Cake.Testing5.0.0 → 6.0.0. Tests TFM stays atnet8.0(lowest-of-addin's-range, per the workspace rotation table for Cake 6.x).global.json: SDK9.0.100 → 10.0.100, matching the new highest TFM.demo/script/.config/dotnet-tools.json: cake.tool5.1.0 → 6.1.0(latest 6.x as of 2026-05-07).demo/frosting/build/Build.csproj:Cake.Frosting5.1.0 → 6.1.0. HintPath stays atnet8.0.demo/sdk/cake.cs(NEW):Cake.Sdk@6.1.1file-based program with#:project ../../src/Cake.FileHelpers/Cake.FileHelpers.csproj. Mirrors the alias surface exercised bydemo/scriptanddemo/frosting. NoNullable=enable/NoWarn=CS8603properties needed — Cake.FileHelpers' public API doesn't use nullable annotations, so the source-generator nullability gap (workspace memoryfeedback_demo_folder_pattern) isn't triggered.build.yml: newRun demo/sdkstep afterRun demo/frosting, usingworking-directory: ./demo/sdkanddotnet cake.cs.IEnumerable<string>overloads (#2)10-year-old request — fold in as a free modernisation since v9.0.0 is a Breaking-change release boundary anyway. Four new public overloads on
FileHelperAliases:FileWriteLines(this ICakeContext, FilePath, IEnumerable<string>)FileWriteLines(this ICakeContext, FilePath, Encoding, IEnumerable<string>)FileAppendLines(this ICakeContext, FilePath, IEnumerable<string>)FileAppendLines(this ICakeContext, FilePath, Encoding, IEnumerable<string>)Existing
string[]overloads stay (binary-compat for downstream addins linking viaPackageReference); overload resolution picks the existingstring[]form when a literalnew[] { ... }is passed, so no behaviour change at any current call site. The internalWriteLineshelper widens toIEnumerable<string>—string[]satisfies that contract, so all existing call sites keep working unchanged.Tests added covering each new overload via
List<string>typed asIEnumerable<string>(guarantees the new overload is dispatched rather than thestring[]one).Out of scope
ArgumentNullException.ThrowIfNullmodernisation — Cake.FileHelpers' source has no explicit null-checked code paths (the addin defers null handling to the underlyingSystem.IOcalls), so there's nothing to modernise.IDisposableAnalyzers/Microsoft.SourceLink.GitHubanalyzer pins — those track .NET / source-link versions, not Cake major, and Renovate drives them.Local verification
dotnet cake recipe.cake --target=Package— green (DotNetCore-Test+DotNetCore-Packboth pass).dotnet test --filter "FullyQualifiedName~AcceptsIEnumerable"— 4/4 pass for the new overload tests../demo/script/build.ps1— all 8 tasks succeeded under cake.tool 6.1.0../demo/frosting/build.ps1— all 8 tasks succeeded under Cake.Frosting 6.1.0.dotnet cake.cs(indemo/sdk/) — all 8 tasks succeeded under Cake.Sdk 6.1.1 + .NET 10 SDK 10.0.107.Release context
Breaking change) — theCake.Core5.0.0 → 6.0.0 bump.Feature) — theIEnumerable<string>overloads.Both are attached to milestone 9.0.0; this PR closes both via
Closes #155/Closes #2.