Skip to content

Migrate generator from JSON API to @bacons/xcode Object API#2

Merged
EvanBacon merged 3 commits into
mainfrom
@evanbacon/use-object-api
Apr 11, 2026
Merged

Migrate generator from JSON API to @bacons/xcode Object API#2
EvanBacon merged 3 commits into
mainfrom
@evanbacon/use-object-api

Conversation

@EvanBacon

Copy link
Copy Markdown
Owner

Summary

  • Replace manual UUID generation, file type maps, and raw JSON object construction with @bacons/xcode Object API (PBXGroup.create, PBXNativeTarget.create, XCBuildConfiguration.create, etc.)
  • Use target.getSourcesBuildPhase() / getFrameworksBuildPhase() / getResourcesBuildPhase() instead of raw createModel() calls — build phases get defaults automatically
  • File type inference (lastKnownFileType) and source tree defaults handled by PBXFileReference.setupDefaults(), eliminating the hand-maintained FILE_TYPES map and isSourceFile/isResourceFile extension lists
  • Add scripts/compare-output.ts to validate generated projects across all 6 platforms

Test plan

  • bunx tsc --noEmit passes clean
  • bun scripts/compare-output.ts — all 6 platforms (ios, macos, tvos, watchos, visionos, multiplatform) pass structural checks
  • xcodebuild succeeds for iOS and macOS generated projects
  • Verify generated projects open correctly in Xcode

🤖 Generated with Claude Code

EvanBacon and others added 3 commits April 11, 2026 16:32
Add a compare-output script and ignore its output, and refactor the Xcode project generator to use @bacons/xcode's Object API.

- Add scripts/compare-output.ts to generate projects for multiple platforms, validate pbxproj structure, and save .pbxproj outputs under .compare-output/ for manual inspection; add .compare-output to .gitignore.
- Rewrite src/generator.ts to build an XcodeProject via @bacons/xcode classes (XcodeProject, PBXGroup, PBXFileReference, PBXNativeTarget, PBXSourcesBuildPhase, PBXFrameworksBuildPhase, PBXResourcesBuildPhase, XCBuildConfiguration, XCConfigurationList) instead of manual UUID/object map construction.
- Simplify file-type handling with helper predicates (isSourceFileType, isResourceFileType) and consolidate build/target/project settings into shared settings objects.

These changes remove ad-hoc UUID generation and manual object assembly, leveraging the library's Object API for more robust pbxproj generation and easier validation.
Replace raw createModel() calls for build phases with
target.getSourcesBuildPhase() / getFrameworksBuildPhase() /
getResourcesBuildPhase(). Use createGroup/createFile on groups
instead of manually wiring children. Inline config list creation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@EvanBacon EvanBacon merged commit 938061d into main Apr 11, 2026
2 checks passed
@EvanBacon EvanBacon deleted the @evanbacon/use-object-api branch April 11, 2026 23:56
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