Skip to content

Migrate build system from Cake Tool to Cake.Sdk file-based apps (.NET 10)#3664

Draft
mattleibow wants to merge 5 commits intomainfrom
dev/cake-sdk-migration
Draft

Migrate build system from Cake Tool to Cake.Sdk file-based apps (.NET 10)#3664
mattleibow wants to merge 5 commits intomainfrom
dev/cake-sdk-migration

Conversation

@mattleibow
Copy link
Copy Markdown
Contributor

Summary

Migrates SkiaSharp's entire build system from Cake Tool 4.0.0 (.cake scripting with dotnet cake) to Cake.Sdk 6.1.1 (.NET 10 file-based apps with dotnet run --file build.cs).

Build infrastructure modernization — no functional changes to what the build produces.

What changed

  • 26 new .cs build files created alongside existing .cake files
  • #addin#:package, #toolInstallTool(), #loadIncludeAdditionalFiles
  • Shared helpers use partial class Program + Main_* entry points
  • global.json — pinned Cake.Sdk 6.1.1 via msbuild-sdks
  • nuget.config — added nuget.org source for Cake.Sdk resolution
  • dotnet-tools.json — removed cake.tool
  • build.ps1/shdotnet run --file build.cs replaces dotnet cake
  • NuGet.Packaging bumped 6.9.1 → 6.14.0 (required by Cake.NuGet 6.x)

Notes

  • Old .cake files preserved for safe rollback — delete after validation
  • Cake API surface identical — no logic changes
  • Research: 4 AI agents, 200+ tool calls verifying compatibility

mattleibow and others added 4 commits April 10, 2026 20:31
Convert 4 delegator native builds (maccatalyst, nanoserver, linuxnodeps,
linux-clang-cross) and 2 xharness standalone builds (xharness-apple,
xharness-android) from Cake Tool (.cake) to Cake.Sdk (.cs).

Each file gets #:sdk Cake.Sdk, #:property PublishAot=false, and
IncludeAdditionalFiles for shared.cs. All #load directives removed.
RunCake() paths updated from .cake to .cs references.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Migrate native platform build scripts to standalone Cake.Sdk entry points:
- native/android/build.cs
- native/ios/build.cs
- native/macos/build.cs
- native/tvos/build.cs
- native/linux/build.cs
- native/windows/build.cs
- native/wasm/build.cs
- native/tizen/build.cs
- native/winui/build.cs
- native/winui-angle/build.cs

Each file uses #:sdk Cake.Sdk directive with IncludeAdditionalFiles for
shared helpers, #:package for required addins, and PublishAot=false.
Original .cake files are preserved alongside the new .cs files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
….cs)

Convert the main build file and all 9 shared helper files from .cake
(Cake Tool) format to .cs (Cake.Sdk) format:

- build.cs: Main entry point with top-level statements, #:sdk and
  #:package directives, InstallTool() calls replacing #tool directives
- scripts/cake/shared.cs: Shared variables and helpers wrapped in
  partial class Program with internal static members
- scripts/cake/native-shared.cs: Native build helpers with Task
  registration in Main_NativeShared()
- scripts/cake/msbuild.cs: MSBuild/DotNet build helpers
- scripts/cake/UtilsManaged.cs: Test runners and managed utilities
- scripts/cake/externals.cs: External dependency tasks in
  Main_Externals(), build.cs references changed to .cs
- scripts/cake/samples.cs: Sample build tasks in Main_Samples()
- scripts/cake/UpdateDocs.cs: Documentation generation tasks in
  Main_UpdateDocs()
- scripts/cake/xcode.cs: Xcode build helpers (removed #addin)
- scripts/cake/ndk.cs: Android NDK helpers

Key structural changes:
- Only build.cs has top-level statements
- All other files use public static partial class Program
- Task registrations wrapped in private static void Main_*() methods
- Top-level variables become internal static fields
- RunCake() updated to use 'dotnet run --file' instead of DotNetTool
- NuGet.Packaging version bumped from 6.9.1 to 6.14.0
- Old .cake files preserved (cleanup is a separate phase)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- global.json: Pin Cake.Sdk 6.1.1 via msbuild-sdks
- nuget.config: Add nuget.org source for Cake.Sdk resolution
- dotnet-tools.json: Remove cake.tool (replaced by Cake.Sdk)
- build.ps1/sh: Use dotnet run --file build.cs instead of dotnet cake
- PlatformTestBase.cs: Look for build.cs in addition to build.cake

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 3664

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 3664"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-3664/packages --name skiasharp-pr-3664
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-3664

…ld.cs'

Update CI bootstrapper YAML, GitHub Actions workflows, Docker scripts,
documentation, skills, devcontainer, and CONTRIBUTING.md to use the new
Cake.Sdk invocation instead of the removed cake.tool.

34 files updated across:
- scripts/azure-templates-jobs-bootstrapper.yml (the main CI failure)
- .github/workflows/samples.yml
- scripts/Docker/_clang-cross-common.sh
- scripts/Docker/wasm/build-local.sh and .ps1
- .devcontainer/devcontainer.json
- CONTRIBUTING.md
- .github/copilot-instructions.md
- documentation/dev/*.md (7 files)
- .github/skills/*/SKILL.md and references (14 files)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant