Skip to content

(#155) Cake v6.0.0 catch-up + IEnumerable<string> overloads#172

Merged
gep13 merged 4 commits into
cake-contrib:developfrom
gep13:feature/cake-6
May 7, 2026
Merged

(#155) Cake v6.0.0 catch-up + IEnumerable<string> overloads#172
gep13 merged 4 commits into
cake-contrib:developfrom
gep13:feature/cake-6

Conversation

@gep13

@gep13 gep13 commented May 7, 2026

Copy link
Copy Markdown
Member

Closes #155.
Closes #2.

Scope

Cake 6 catch-up (#155)

  • 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/script/.config/dotnet-tools.json: cake.tool 5.1.0 → 6.1.0 (latest 6.x as of 2026-05-07).
  • demo/frosting/build/Build.csproj: Cake.Frosting 5.1.0 → 6.1.0. HintPath stays at net8.0.
  • demo/sdk/cake.cs (NEW): Cake.Sdk@6.1.1 file-based program with #:project ../../src/Cake.FileHelpers/Cake.FileHelpers.csproj. Mirrors the alias surface exercised by demo/script and demo/frosting. No Nullable=enable / NoWarn=CS8603 properties needed — Cake.FileHelpers' public API doesn't use nullable annotations, so the source-generator nullability gap (workspace memory feedback_demo_folder_pattern) isn't triggered.
  • build.yml: new Run demo/sdk step after Run demo/frosting, using working-directory: ./demo/sdk and dotnet 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 via PackageReference); overload resolution picks the existing string[] form when a literal new[] { ... } is passed, so no behaviour 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).

Out of scope

  • No ArgumentNullException.ThrowIfNull modernisation — Cake.FileHelpers' source has no explicit null-checked code paths (the addin defers null handling to the underlying System.IO calls), so there's nothing to modernise.
  • Long-stale feature requests Add overloads to allow specify multiple replacements #5 / Add "Remove ReadOnly-Attribute" method #6 / FileFilterExclude / FileFilterInclude #24 — each needs an API-shape decision before implementation. Tracked as a single triage follow-up in the workspace TODO.
  • Renovate PRs and the addin-side IDisposableAnalyzers / Microsoft.SourceLink.GitHub analyzer 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-Pack both 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 (in demo/sdk/) — all 8 tasks succeeded under Cake.Sdk 6.1.1 + .NET 10 SDK 10.0.107.

Release context

Both are attached to milestone 9.0.0; this PR closes both via Closes #155 / Closes #2.

gep13 added 4 commits May 7, 2026 19:17
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).

@gep13 gep13 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit 0725f52 into cake-contrib:develop May 7, 2026
4 checks passed
@gep13 gep13 deleted the feature/cake-6 branch May 7, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Cake.FileHelpers add-in to target Cake v6.0.0 FileHelpers.xxxLines Method (String, IEnumerable<String>)

1 participant