Repository navigation
feat(#461): manifest-v2 PR4 — shared platform-packager (apk/web) - #465
Conversation
…pe (#453 PR 4) Factor the apk/web packaging out of the enum-path template into a shared packager that a v2 manifest's `.platforms[p].package` recipe references. Lands BEFORE the Android/wasm backend conversions (PRs 5-7) so their `.package` delegation is ready and their golden cells are achievable (design §7). - src/codegen/packager.zig: `emitPackage(Package, w)` maps `.binary` (desktop, no-op), `.apk` (Android), `.web` (wasm) to the exact packaging text. The text is held as packager-owned @embedfile fixtures (templates/package_apk.txt / package_web.txt), byte-copies of the enum `.android_package` / `.wasm_footer` sections. - src/codegen/manifest_v2_splice.zig: `renderPackageV2` + `platformEntry` seam — the v2 codegen delegates packaging off the typed `PlatformEntry.package` recipe (no `switch (cfg.platform)`). - src/build_files.zig: wire the seam on the v2 desktop path (no-op for `.binary`, so the PR-3 desktop byte anchor is undisturbed). Enum-path choice: left `.android_package`/`.wasm_footer` sections in place (the lower-risk option) — the enum path still `writeSection`s them and the packager reproduces their output. When PR 12 deletes the enum sections, the fixtures remain the source of truth. Byte-identity tests assert `emitPackage(.apk)` == `.android_package` section and `emitPackage(.web)` == `.wasm_footer` section against the live template, plus a drift guard on the fixtures — the anchor that makes PR 5/7's golden cells match the enum baseline. `zig build test` and `zig build` both green; enum-path generation byte-unchanged (build_zig.txt untouched). 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! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a manifest-v2 packaging seam invoked from build_files.zig, delegating to new manifest_v2_splice functions (platformEntry, renderPackageV2) that call a new shared packager.zig module. packager.zig embeds byte-identical APK/Web templates and provides emitPackage. New package_apk.txt and package_web.txt templates define platform-specific build steps. root.zig forces test discovery of packager.zig. ChangesShared v2 packaging path
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR 4 of the manifest-v2 epic (#461, #453 item 3). The shared platform-packager, prereq for the sokol android/ios/wasm conversions (PR 5-7). Additive; enum path byte-unchanged.
Packager (
src/codegen/packager.zig)emitPackage(package: Package, w)switches on theBackendManifestV2.Packageunion:.binary→ no-op (desktop installs the exe directly).apk→ Android apk-stage +zip+apksigner.web→ emcc install/run wiringPackaging text lives in packager-owned
@embedFilefixtures —src/templates/package_apk.txt+package_web.txt— exact byte-copies of the enum-path.android_package/.wasm_footersections (extracted viagetSectionboundaries;.wasm_footerlegitimately carries the build-fn close + override helper defs, reproduced to matchwriteSection).v2 seam
manifest_v2_splice.ziggainsplatformEntry+renderPackageV2— packaging is driven off the typedPlatformEntry.package(noswitch (cfg.platform)).build_files.zigcalls it on the v2 desktop path before the footer; desktop.binaryis a no-op, so PR 3's desktop byte anchor is undisturbed. Absent platform →error.V2PlatformUnsupported.Enum path unchanged (lower-risk option)
Left
.android_package/.wasm_footersections inbuild_zig.txt(untouched — not in the diff); the enum path stillwriteSections them, the packager reproduces their output. PR 12 deletes the enum sections, leaving the fixtures as source of truth.Byte-identity tests (the point)
emitPackage(.apk)== live.android_package,emitPackage(.web)== live.wasm_footer(viagetSectionon embeddedbuild_zig.txt) + fixture drift guard +.binaryno-op + seam tests. Verified live (corrupting the apk fixture fails the test). This byte-identity is what makes PR 5/7's golden cells achievable.zig build test+zig buildexit 0. No backend converted to v2 android/wasm yet (PR 5-7).Ref #461, #453.
https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
Summary by CodeRabbit
New Features
Bug Fixes