Repository navigation
feat(#461): manifest-v2 PR6 — sokol ios - #467
Conversation
…on) (#453) Convert sokol iOS to the manifest-v2 build graph, reusing the resolve_target/post_wire hook pattern PR 5 landed for android. Hook (backends/sokol/backend.hook.zig): - resolve_target ios: xcrun SDK-path discovery + device/simulator target selection, returning BOTH the ResolvedTarget AND the SDK path (plugin b.dependency calls consume it, so it must resolve BEFORE any dependency). - post_wire ios: consumes the SDK path (configureSdkPaths/addExeSdkPaths residual b); frameworks + link_libc are declarative, not here. - Pure, unit-tested decision helpers: iosSdkName, selectIosTarget (device aarch64-ios / Intel-sim x86_64 / Apple-Silicon-sim aarch64+apple_a14), requireIosSdk (null = hard error, no silent skip). Codegen (manifest_v2_splice.zig + build_files.zig): - renderIosHeaderV2 / renderIosDepsDeclsV2 / renderIosBackendDepV2 / renderIosLinkV2 wired behind the v2 opt-in gate; generic unifyCoreDiamond walk replaces the unrolled ios_deps overrides; .frameworks.ios emitted as a linkFramework loop; packaging is the .binary no-op. Golden cell: test/goldens/sokol_ios_v2.build.zig + hook-boundary assertions (imports backend_build_hook, calls both phases, no inline xcrun/frameworks). Intended enum-vs-v2 diffs: residual moved into the imported hook; unrolled core-diamond became the generic loop; SDK-path config runs in post_wire (after graph construction) rather than inline in backend-dep — same graph. Desktop byte anchor + android golden + v1/enum paths unchanged (v2 activates only via the opt-in manifest). zig build test + zig build both exit 0. Claude-Session: https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
📝 WalkthroughWalkthroughThis PR adds iOS support to the sokol backend build hook and manifest-v2 codegen pipeline. It implements iOS SDK/target resolution via xcrun, threads SDK paths through post_wire for include/framework/library wiring, extends v2 codegen dispatch for iOS sections, and adds a golden test build script with validation tests. ChangesiOS Backend Hook and Codegen Support
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant BuildZig as build.zig / generateBuildZig
participant Splice as manifest_v2_splice
participant Hook as backend.hook.zig
participant Xcrun as xcrun (system)
BuildZig->>Splice: renderIosHeaderV2 / renderLinkSectionV2
Splice->>Hook: resolve_target(.ios)
Hook->>Xcrun: query iOS SDK path
Xcrun-->>Hook: sdk_path or null
Hook-->>Splice: ResolvedTargetInfo(target, ios_sdk_path)
Splice->>Hook: post_wire(ios_sdk_path, android_target_sdk=null)
Hook->>Hook: requireIosSdk (enforce non-null)
Hook-->>Splice: include/framework/library paths added
Splice-->>BuildZig: generated iOS build.zig sections
Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/build_zig_tests.zig (1)
297-323: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd iOS coverage for the promoted-script
targetalias path.The iOS generator guard now includes
opts.promoted_scripts.len > 0, but the regression tests only lock the Android alias case. Add an iOS v2 promoted-script assertion soconst target = ios_target;stays covered.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/build_zig_tests.zig` around lines 297 - 323, Add iOS regression coverage for the promoted-script target alias in the v2 generator tests. Extend the existing genIosV2-based assertion set to verify that when promoted scripts are present, the generated output still contains the iOS alias path with const target = ios_target;, alongside the existing backend_build_hook checks in test "v2 sokol-ios imports the backend hook and calls BOTH phases (§4)".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/build_zig_tests.zig`:
- Around line 297-323: Add iOS regression coverage for the promoted-script
target alias in the v2 generator tests. Extend the existing genIosV2-based
assertion set to verify that when promoted scripts are present, the generated
output still contains the iOS alias path with const target = ios_target;,
alongside the existing backend_build_hook checks in test "v2 sokol-ios imports
the backend hook and calls BOTH phases (§4)".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9da29d02-dfe9-48d1-a5ca-1b29fbb0e4da
📒 Files selected for processing (6)
backends/sokol/backend.hook.zigbuild.zigsrc/build_files.zigsrc/codegen/manifest_v2_splice.zigtest/build_zig_tests.zigtest/goldens/sokol_ios_v2.build.zig
PR 6 of the manifest-v2 epic (#461, #453 item 3). Converts sokol ios to v2, reusing the
resolve_target/post_wirehook pattern from PR 5. Golden cell.Hook (
backends/sokol/backend.hook.zig)resolve_targetios — reads-Ddevice, runsgetIosSdkPath(xcrun--show-sdk-path), selects the target, returns both theResolvedTargetandios_sdk_path(SDK path must resolve beforeb.dependency— plugin deps consume it, §4).post_wireios — consumesctx.ios_sdk_path:configureSdkPathsonsokol_clib+addExeSdkPathson the exe. Frameworks +link_libcare declarative.iosSdkName(device→iphoneos / else→iphonesimulator),selectIosTarget(device aarch64-ios; Intel-sim x86_64; Apple-Silicon-sim aarch64+a14),requireIosSdk(null → hard error).Manifest
The ios
PlatformEntrywas fully authored in PR 3 (.target=.resolved,.loop_style=.callback,.package=.binary, frameworks Foundation/UIKit/Metal/MetalKit/AudioToolbox/AVFoundation/QuartzCore/GameController) — verified faithful to the enum path, no change needed.Golden + hook-check
test/goldens/sokol_ios_v2.build.zig+ asserts: importsbackend_build_hook,resolve_target(...ios...)capturingsdk_path,post_wire{ .ios_sdk_path = sdk_path, .android_target_sdk = null }, genericunifyCoreDiamondloop, declarative frameworks/link_libc, and inlinegetIosSdkPath/linkIosFrameworks/configureSdkPathsgone from the generated output.Intended enum-vs-v2 diffs
Residual (xcrun/target/SDK-path) → the hook; unrolled ios_deps overrides +
unifyGfxSubpackageCore→ genericunifyCoreDiamondloop; SDK-path config runs inpost_wire(order differs, graph identical — the calls are order-independent).Desktop byte anchor + android golden + v1/enum all still hold (v2 activates only via the opt-in). 834/838 pass, 0 failed.
zig build test+zig buildexit 0.Ref #461, #453.
https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
Summary by CodeRabbit
New Features
Tests