Support binary XCFramework dependencies in SPM build system#75
Merged
Conversation
SPM copies pre-built .framework bundles (from binaryTarget/XCFramework deps like lottie-spm) directly into binPath rather than producing .build/ directories with loose .o files. The Tier 2 bridge compilation was missing these entirely — no -F search path, no -framework flags, and no -rpath for dlopen. Add collectFrameworks() to scan binPath for .framework bundles and emit -F, -framework, and -rpath flags so both compilation and runtime loading succeed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove unused `import Lottie` from Item.swift (ToDoView.swift already
exercises the framework dependency)
- Verify the actual framework name ("Lottie") follows the -framework
flag, not just that the flag exists
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
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
.frameworkbundles (frombinaryTarget/ XCFramework deps likelottie-spm) directly intobinPathrather than producing.build/directories with loose.ofiles-Fsearch path, no-frameworkflags, and no-rpathfordlopencollectFrameworks()to scanbinPathfor.frameworkbundles and emit the correct compiler/linker flagsCloses #69 (partial — the original fix handled source-compiled deps but missed binary targets)
What changed
SPMBuildSystem.swift: NewcollectFrameworks(binPath:)method scans for.frameworkbundles. Flags added:-F <binPath>,-framework <Name>,-Xlinker -rpath -Xlinker <binPath>examples/spm: Addedlottie-spm(binary XCFramework) as a dependency withimport LottieandLottieViewusage in the previewPreviewSessionBuildContextTests: Added assertions for-F,-framework, and-rpathflagsTest plan
swift test --filter PreviewSessionBuildContext— all 5 tests pass (includes Tier 2 compile with Lottie XCFramework)swift run previewsmcp snapshot examples/spm/Sources/ToDo/ToDoView.swift— renders correctly with Lottie binary dep-lToDoExtras,-lLocalDep)🤖 Generated with Claude Code