Skip to content

feat(#461): manifest-v2 PR6 — sokol ios - #467

Merged
apotema merged 1 commit into
mainfrom
feat/453-manifest-v2-pr6-sokol-ios
Jul 1, 2026
Merged

apotema merged 1 commit into
mainfrom
feat/453-manifest-v2-pr6-sokol-ios

Conversation

@apotema

@apotema apotema commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

PR 6 of the manifest-v2 epic (#461, #453 item 3). Converts sokol ios to v2, reusing the resolve_target/post_wire hook pattern from PR 5. Golden cell.

Hook (backends/sokol/backend.hook.zig)

  • resolve_target ios — reads -Ddevice, runs getIosSdkPath (xcrun --show-sdk-path), selects the target, returns both the ResolvedTarget and ios_sdk_path (SDK path must resolve before b.dependency — plugin deps consume it, §4).
  • post_wire ios — consumes ctx.ios_sdk_path: configureSdkPaths on sokol_clib + addExeSdkPaths on the exe. Frameworks + link_libc are declarative.
  • Pure helpers unit-tested: 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 PlatformEntry was 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: imports backend_build_hook, resolve_target(...ios...) capturing sdk_path, post_wire{ .ios_sdk_path = sdk_path, .android_target_sdk = null }, generic unifyCoreDiamond loop, declarative frameworks/link_libc, and inline getIosSdkPath/linkIosFrameworks/configureSdkPaths gone from the generated output.

Intended enum-vs-v2 diffs

Residual (xcrun/target/SDK-path) → the hook; unrolled ios_deps overrides + unifyGfxSubpackageCore → generic unifyCoreDiamond loop; SDK-path config runs in post_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 build exit 0.

Ref #461, #453.

https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw

Summary by CodeRabbit

  • New Features

    • Added iOS support to the Sokol backend build flow, including target and SDK resolution, framework linking, and iOS-specific include/library paths.
    • Enabled manifest-v2 iOS code generation so generated build files now handle iOS the same way as other supported platforms.
  • Tests

    • Added new iOS golden coverage to verify generated build output, SDK wiring, and required iOS framework links.

…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
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

iOS Backend Hook and Codegen Support

Layer / File(s) Summary
iOS hook resolve_target and post_wire implementation
backends/sokol/backend.hook.zig, build.zig
Adds iosSdkName, IosTargetSpec, selectIosTarget, and requireIosSdk helpers; resolve_target now discovers the iOS SDK path via xcrun and returns it in ResolvedTargetInfo; post_wire implements the .ios branch adding include/framework/library search paths; adds IosSdkPathRequired error variant, unit tests, and updated docs.
v2 codegen splice for iOS sections
src/codegen/manifest_v2_splice.zig
Extends renderBackendDepSectionV2 and renderLinkSectionV2 dispatch for .ios; adds renderIosHeaderV2 and renderIosDepsDeclsV2, and an iOS link generator that resolves target/SDK and calls post_wire.
build_files.zig iOS v2 conditional wiring
src/build_files.zig
Makes iOS header, deps, link section, packaging, and footer emission conditional on v2_manifest presence, routing to the new splice functions.
iOS golden build script and validation tests
test/goldens/sokol_ios_v2.build.zig, test/build_zig_tests.zig
Adds a standalone iOS golden build script with target/SDK resolution, dependency wiring, core+gfx diamond unification helpers, and framework linking; adds MANIFEST_V2_IOS_GOLDEN tests validating byte-equality, syntax, and content.

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
Loading

Possibly related issues

Possibly related PRs

Poem

🐰 I hopped through Xcode's SDK maze,
Found xcrun's path in a build-file haze,
Frameworks linked, diamonds unified with care,
Golden tests confirm the build is square,
iOS builds now hop along with grace! 🍎

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the manifest-v2 sokol iOS conversion and matches the main change in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/453-manifest-v2-pr6-sokol-ios

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/build_zig_tests.zig (1)

297-323: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add iOS coverage for the promoted-script target alias 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 so const 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

📥 Commits

Reviewing files that changed from the base of the PR and between de6004b and aeee2c3.

📒 Files selected for processing (6)
  • backends/sokol/backend.hook.zig
  • build.zig
  • src/build_files.zig
  • src/codegen/manifest_v2_splice.zig
  • test/build_zig_tests.zig
  • test/goldens/sokol_ios_v2.build.zig

@apotema
apotema merged commit 4a0a003 into main Jul 1, 2026
4 checks passed
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.

1 participant