fix: handle spm packages internal to cli - #6098
Conversation
Swap third party trapeze dependency with cli internal handling.
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughSPM package models now distinguish remote and local packages. A new injected service directly edits ChangesSPM pbxproj integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SPMService
participant SPMPbxprojService
participant XcodeProject
SPMService->>SPMPbxprojService: addPackages(projectRoot, assignments)
SPMPbxprojService->>XcodeProject: parse project.pbxproj
SPMPbxprojService->>XcodeProject: update package references and build phases
SPMPbxprojService-->>SPMService: return applied status
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 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.
Inline comments:
In `@lib/services/ios/spm-pbxproj-service.ts`:
- Around line 193-232: The product dependency and build file entries in the
package-library loop must be keyed by both owning package and product name, not
the bare library comment. Update the identifiers passed to addOrUpdateEntry for
XCSwiftPackageProductDependency and PBXBuildFile, including corresponding
comments or lookup keys, so different packages exposing the same lib name
receive distinct UUIDs without overwriting package fields; apply the same
correction to the analogous logic around the later referenced block.
- Around line 39-81: Update addPackageToTarget and addPackages so success
reflects actual project mutations: have addPackageToTarget return a boolean,
return false before any packageReferences or packageProductDependencies
initialization when the target lacks a Frameworks build phase, and return true
only after linking succeeds. In addPackages, set added from the helper’s result
so the project is written and true is returned only when at least one package
was applied.
- Around line 168-176: The requirement value assigned in the
XCRemoteSwiftPackageReference branch is pre-escaped incorrectly. Update the
packageReferenceSectionContent construction around classifyVersion() so
requirement is written through the native pbxWriter.writeObject() path, or
transformed using the writer’s expected escaping format, while preserving the
plain classified version semantics and avoiding JSON.stringify().
In `@test/services/ios/spm-pbxproj-service.ts`:
- Around line 239-271: Update the package application helper used by addPackages
to return whether it actually applied the package, including false when the
existing target lacks a Frameworks build phase. In addPackages, assign added
only from that helper’s successful result so skipped packages do not mark the
batch as added or trigger pbxproj writes; preserve successful behavior for
targets with a valid Frameworks phase.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a342267-1952-40cc-97ea-26ecb6911484
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
lib/bootstrap.tslib/definitions/ios.d.tslib/services/ios-watch-app-service.tslib/services/ios/spm-pbxproj-service.tslib/services/ios/spm-service.tspackage.jsontest/services/ios/spm-pbxproj-service.ts
💤 Files with no reviewable changes (1)
- package.json
The lockfile in this branch was produced by a full `npm install`, which refreshed ~95 unrelated transitive versions (@babel/*, @sigstore/*, conventional-changelog-*, and @emnapi/* jumping to 2.0.0-alpha.3) and reshuffled hoisting, making the dependency change unreviewable. Regenerated from main's lockfile with `npm install --package-lock-only`, so the diff now contains only the removal of @nstudio/trapezedev-project with its orphaned transitives and the effect of the new @ts-morph/common@0.26.1 minimatch override.
Swap third party trapeze dependency with cli internal handling.
Summary by CodeRabbit