Repository navigation
Make binding generation deterministic across platforms - #4612
Conversation
📦 Try the packages from this PRWarning 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 -- 4612PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4612"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4612/packages --name skiasharp-pr-4612More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4612 |
📊 SkiaSharp benchmarks — PR #4612⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 47 slower · 🟢 1 faster
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
Sort discovered headers and emitted declarations by normalized ordinal keys, and emit canonical LF output so binding generation no longer depends on host filesystem or culture ordering. Regenerate the canonical binding order and compare independently generated artifacts across Linux, macOS, and Windows. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f532599a-b19b-4923-a723-e91f86ecff4e
Run dependency sync and binding generation directly so automatic CI only watches true generator inputs. Add the committed generated files because their XML documentation is preserved during generation, and replace broad config and Cake-related patterns with the exact maintained input set. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f532599a-b19b-4923-a723-e91f86ecff4e
ea63695 to
ad43bd0
Compare
After all three hosts agree byte-for-byte, compare the canonical generated Skia outputs with the committed bindings. Fail with per-file diffs when regeneration was omitted or generated code was edited manually; keep HarfBuzz freshness out of scope because its bindings are versioned separately from Skia DEPS. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f532599a-b19b-4923-a723-e91f86ecff4e
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
📦 Artifact size reportPackages from this PR (build Total Packages
+39 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.4 MB (🟢 −128.0 KB) |
runtimes/win-x64/native/libGLESv2.pdb |
66.6 MB → 66.5 MB (🟢 −128.0 KB) |
runtimes/win-x86/native/libGLESv2.pdb |
67.3 MB → 67.2 MB (🟢 −80.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
[bindings] Make generation deterministic across platforms (#4612) Context: #4612 SkiaSharpGenerator relied on filesystem enumeration and culture-sensitive string ordering, causing identical inputs to produce different function and type ordering across Windows, macOS, and Linux. Use normalized relative paths, ordinal comparisons, and canonical UTF-8/LF output. The resulting SkiaApi migration only reorders its existing 23,630 lines. Add CI that independently generates bindings on all three platforms, compares their outputs byte-for-byte, then verifies the canonical result matches the four committed Skia bindings. This detects cross-host nondeterminism, omitted regeneration, and manual generated-file edits. HarfBuzz freshness remains out of scope because its bindings are versioned separately. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
Description
Binding generation currently inherits filesystem enumeration order before parsing and uses default culture-sensitive string ordering when emitting declarations. Identical inputs can therefore produce large ordering-only diffs across Windows, macOS, and Linux.
This change makes ordering intrinsic to
SkiaSharpGenerator: discovered files use normalized ordinal paths, emitted declarations use explicit ordinal keys, and generated files use canonical UTF-8/LF output. The first regeneration establishes that canonical order.A narrowly triggered workflow generates independently on all three desktop OSes and first compares peer artifacts byte-for-byte without using the checked-in order as its source of truth. Once the hosts agree, it requires that canonical result to match the four committed Skia bindings, catching omitted regeneration and manual generated-code edits.
Related issues
None.
Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None — generator and CI behavior only; there are no public API or runtime behavior changes. The one-time
SkiaApi.generated.csmigration is ordering-only: all 23,630 lines are unchanged.Testing
dotnet build utils/SkiaSharpGenerator/SkiaSharpGenerator.csproj --no-restoreSkiaApi.generated.cshas the same 23,630-line multiset asmainmainordering is rejectedFocused generator unit tests are intentionally deferred to a follow-up.
Checklist
Changesabove lists all public API and behavioral changes (None)