You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate Apple native builds from Xcode projects to GN
Replace the hand-maintained Xcode projects for libSkiaSharp and
libHarfBuzzSharp with the existing GN `skiasharp_build` targets, matching
how Linux, Windows, WASM and Android already build.
- Delete all 6 *.xcodeproj bundles (ios/tvos/macos × both libs) and
scripts/infra/native/apple/xcode.cake.
- Rewrite native/{ios,tvos,macos}/build.cake to drive GN/ninja only.
- Add scripts/infra/native/apple/apple.cake (CombineFrameworks, StripSign,
RunLipo, RunZip) for the post-GN lipo/strip/codesign/zip steps.
- macOS ships a plain fat .dylib (@rpath/lib<N>.dylib); iOS/tvOS/MacCatalyst
frameworks are emitted directly by GN with link-time framework-relative
install_name and provenance-complete Info.plist; Cake only lipos per-arch
frameworks together and strips/codesigns last.
- Bump externals/skia to pull in the GN-emits-framework support.
- Document the new flow in update-skia known-gotchas (#23).
Verified against the released 3.119.0 baseline on all four Apple platforms
(symbol counts 887 sk_/gr_ + 560 hb_, fat archs, framework-relative
install_name, valid codesign, Info.plist key parity). iOS simulator and
Mac Catalyst test suites pass 5548/0.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .agents/skills/update-skia/references/known-gotchas.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,47 @@ The C API shims (`src/c/gr_context.cpp` etc.) compile as part of `:core`, but ba
61
61
62
62
Upstream may move previously-core modules into separate optional targets. If the C API exposes functions from that module, add it as an explicit dependency of the `SkiaSharp` target in `BUILD.gn` rather than merging sources into core.
63
63
64
+
### 23. Apple Builds Are Pure GN — GN Emits the `.framework`
65
+
66
+
Every platform — Windows, Linux, WASM, Android, macOS, iOS, tvOS, and MacCatalyst — builds
67
+
`libSkiaSharp`/`libHarfBuzzSharp` from the `skiasharp_build("SkiaSharp")` /
68
+
`skiasharp_build("HarfBuzzSharp")` GN targets in `externals/skia/BUILD.gn`. There are **no Xcode
69
+
project files** — the Apple `native/{ios,tvos,macos}/build.cake` tasks drive `gn`/`ninja` directly,
70
+
exactly like the other platforms.
71
+
72
+
On iOS/tvOS/MacCatalyst the GN build itself emits a complete single-arch `lib<Name>.framework` in
73
+
its out dir — bundle layout, framework-relative install_name (set via link-time ldflags), arm64e
74
+
thinning, and the provenance Info.plist (CFBundle* + DT*/BuildMachineOSBuild keys App Store /
75
+
notarization validation expects) all come from GN. The framework path is keyed entirely off the
76
+
**OS** — there are no separate `skiasharp_apple_framework*` GN args: the `skiasharp_build` template
77
+
in `gn/BUILDCONFIG.gn` emits a framework whenever `is_ios` is true (iOS/tvOS/MacCatalyst), uses the
78
+
macOS-style versioned `Versions/A` layout when `is_maccatalyst`, and the install_name ldflags in
79
+
`BUILD.gn` are gated the same way. The single GN `action` runs
80
+
`gn/skiasharp/assemble_apple_framework.py` (self-contained Python — it shells out only to first-party
81
+
Apple tools `lipo`/`xcrun`/`xcodebuild`/`sw_vers` and writes the plist with `plistlib`). The cake
82
+
`CombineFrameworks` helper (`scripts/infra/native/apple/apple.cake`) then only lipos the per-arch
83
+
frameworks together and code-signs last. macOS ships a plain fat `.dylib` (install_name
84
+
`@rpath/libSkiaSharp.dylib`, set by GN's solink rule) and does not call `CombineFrameworks`.
85
+
86
+
What to do when updating Skia:
87
+
88
+
-**Adding/removing a C API source file** (`src/c/*.cpp`): update the list in `gn/core.gni` — these
89
+
shims compile into `:core` (see gotcha #21), which `skiasharp_build` reaches via `:skia`, so the
90
+
same list feeds desktop, mobile, and Apple builds. `src/xamarin/*.cpp` sources live directly on the
91
+
`skiasharp_build("SkiaSharp")` target in `BUILD.gn`.
92
+
-**Adding/removing a HarfBuzz source file**: update the `skiasharp_build("HarfBuzzSharp")` target.
93
+
Keep its defines (`HAVE_OT`, `HAVE_CONFIG_OVERRIDE_H`, `HB_NO_FALLBACK_SHAPE`) and the `HB_EXTERN`
94
+
visibility export (which publishes the `hb_*` symbols) intact.
95
+
-**Changing a feature define or warning flag** (e.g. `SK_*`): set it on the GN target/config and it
96
+
applies everywhere, Apple included.
97
+
- After any native change, rebuild from source per platform (`dotnet cake --target=externals-<plat>`);
98
+
`externals-download` is forbidden for native work.
99
+
100
+
A full Xcode install is still required on macOS build agents (not just the Command Line
101
+
Tools): GN drives the Apple SDK + clang toolchain, and the framework-assembly action shells
102
+
out to `xcodebuild -version` and `xcrun --show-sdk-version` for the provenance `Info.plist`,
103
+
which need a full, license-accepted Xcode. The build itself is otherwise pure `gn`/`ninja`.
0 commit comments