Add build system integration (SPM) with tiered compilation#3
Merged
Conversation
Extensible BuildSystem protocol with SPM implementation. Supports two tiers: - Tier 1 (bridge-only): import target module, no hot-reload - Tier 2 (source compilation): compile all target files with ThunkGenerator transforms on the preview file, enabling literal hot-reload New files: - BuildContext, BuildSystem protocol, SPMBuildSystem (auto-detects Package.swift) - BridgeGenerator: generateBridgeOnlySource (Tier 1), generateOverlaySource (Tier 2) - BuildSystemTests (8 tests) - examples/spm/ — ToDo list app for integration testing (macOS + iOS) CLI changes: - --platform ios-simulator and --device flags on run/snapshot commands - Auto-detect build system for all commands (CLI + MCP) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
obj-p
commented
Mar 19, 2026
- FileWatcher: support multiple file paths (polls all, fires on any change) - HostApp.watchFile: accept additionalPaths + buildContext for project mode - MCP/CLI: pass all target source paths to file watcher - BridgeGenerator: use @testable import for internal type access (Tier 1) - Add docs/build-system-integration.md: architecture, interfaces, Xcode trace findings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
421c5c6 to
e369463
Compare
…, SDK caching - Implement --project/projectPath: BuildSystemDetector.detect(for:projectRoot:) uses explicit root when provided, skipping auto-detection - CLIPlatform enum replaces raw String for --platform (ArgumentParser validation) - RunCommand.runIOS: add FileWatcher for hot-reload (was missing vs MCP path) - SPMBuildSystem: resolve iOS SDK path once, pass to both build and showBinPath - Add multi-path FileWatcher test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Mar 19, 2026
obj-p
added a commit
that referenced
this pull request
Apr 10, 2026
…vention The example's Package.resolved has never been committed across the repo's history (checked via git log --all -- examples/spm/Package.resolved) — not since the original SPM example in #3, nor through #75 which just added a new remote dependency on lottie-spm. Meanwhile the root /Package.resolved IS tracked, and CI hashes only the root one (.github/workflows/ci.yml). The rationale is that examples/spm is a testbed for PreviewsMCP's SPM build system. Leaving its Package.resolved unpinned means every fresh checkout / CI run exercises a fresh dependency resolution, so upstream breakage in deps like lottie-spm surfaces promptly instead of being masked by pinned versions. Previously this convention was implicit — the file was just left untracked, polluting every `git status`. Make it explicit with a scoped gitignore entry (the specific path, not a blanket `Package.resolved` that would also affect the tracked root file) and a comment documenting the rationale. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
obj-p
added a commit
that referenced
this pull request
Apr 23, 2026
ROOT CAUSE #3 of the IOSMCPTests.fullIOSWorkflow 20-minute hang: When simctl io screenshot on PR #141 CI got stuck waiting for a display subsystem that never attached, it ignored the SIGTERM from our 180s `AsyncProcessTimeout` entirely — the kernel syscall it was in wasn't interruptible via the term signal. The child's pipe-write fds stayed open, the background readDataToEndOfFile threads blocked on an EOF that never arrived, and our subsequent pipeGroup.wait() hung indefinitely — right past the test's 20-min .timeLimit. Fix: - After SIGTERM, schedule a SIGKILL on a 2s delay (unignorable; the kernel reaps the process and closes its fds). - Bound pipeGroup.wait() at 10s so a totally-stuck fd can never strand the continuation. Whatever bytes we drained pre-kill are still attached to the thrown AsyncProcessTimeout error for diagnostics. All existing AsyncProcessTests still pass (verified locally). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BuildSystemprotocol with SPM implementation (auto-detectsPackage.swift)--platform ios-simulatorand--deviceflags onrun/snapshotCLI commandspreview_start)examples/spm/— ToDo list app for integration testing (macOS + iOS, cross-file type dependency)Test plan
swift test --filter PreviewsCoreTests)🤖 Generated with Claude Code