feat: improve ux on first time swift package runtime setup#6064
Conversation
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughiOS type declarations add SPM resolution methods and xcodebuild progress callbacks. ChangesiOS SPM progress and preflight resolution
Sequence Diagram(s)sequenceDiagram
participant IOSProjectService
participant SPMService
participant XcodebuildCommandService
participant xcodebuild
participant ITerminalSpinnerService
IOSProjectService->>SPMService: ensureSPMDependenciesResolved(platformData, projectData)
SPMService->>SPMService: hasSPMReferences() / arePackagesResolved()
SPMService->>SPMService: resolveSPMDependencies(..., { showProgress: true })
SPMService->>XcodebuildCommandService: executeCommand(..., onProgress)
XcodebuildCommandService->>xcodebuild: spawn with piped stdio
xcodebuild-->>XcodebuildCommandService: BUILD_OUTPUT_EVENT_NAME chunks
XcodebuildCommandService-->>SPMService: onProgress(chunk)
SPMService->>ITerminalSpinnerService: update activity / succeed / fail
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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: 1
🧹 Nitpick comments (1)
lib/services/ios/xcodebuild-command-service.ts (1)
16-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the
IXcodebuildCommandOptionsinterface instead of an inline duplicate.The inline options shape here re-declares the public
IXcodebuildCommandOptionscontract (lib/definitions/ios.d.ts). Keeping two copies invites silent drift if the interface evolves. Consider typing the parameter asIXcodebuildCommandOptions.♻️ Proposed change
public async executeCommand( args: string[], - options: { - cwd: string; - stdio?: string; - message?: string; - spawnOptions?: any; - // When provided, xcodebuild's output is piped (rather than inherited) - // and forwarded here line-by-line so the caller can render its own - // progress UI (e.g. a spinner for SPM resolution/download activity). - onProgress?: (chunk: { data: string; pipe: string }) => void; - }, + options: IXcodebuildCommandOptions, ): Promise<ISpawnResult> {🤖 Prompt for 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. In `@lib/services/ios/xcodebuild-command-service.ts` around lines 16 - 28, The executeCommand method in XcodebuildCommandService is using an inline options object that duplicates the public IXcodebuildCommandOptions contract. Update the method signature to reference IXcodebuildCommandOptions directly so the implementation stays aligned with the shared type and avoids future drift; use the existing executeCommand symbol in XcodebuildCommandService and the IXcodebuildCommandOptions interface from the ios definitions.
🤖 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-service.ts`:
- Around line 116-122: The failure in applySPMPackages is being swallowed by the
surrounding try/catch, so the red spinner error from resolveSPMDependencies is
not visible above trace level and the prepare flow continues as if successful.
Update the catch block in applySPMPackages to surface the failure with at least
this.$logger.warn (instead of only this.$logger.trace), preserving the error
details from resolveSPMDependencies so the user sees that Swift Package
resolution failed. Keep the change localized to applySPMPackages and the
resolveSPMDependencies call path.
---
Nitpick comments:
In `@lib/services/ios/xcodebuild-command-service.ts`:
- Around line 16-28: The executeCommand method in XcodebuildCommandService is
using an inline options object that duplicates the public
IXcodebuildCommandOptions contract. Update the method signature to reference
IXcodebuildCommandOptions directly so the implementation stays aligned with the
shared type and avoids future drift; use the existing executeCommand symbol in
XcodebuildCommandService and the IXcodebuildCommandOptions interface from the
ios definitions.
🪄 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
Run ID: 3559c352-439f-4dca-a6b2-5119d1edd462
📒 Files selected for processing (5)
lib/definitions/ios.d.tslib/services/ios-project-service.tslib/services/ios/spm-service.tslib/services/ios/xcodebuild-command-service.tstest/ios-project-service.ts
[skip ci]
Improves the Swift Package Manager (SPM) dependency resolution process for iOS projects, ensuring that potentially slow package downloads happen under a clear progress spinner instead of appearing to stall the build.
Summary by CodeRabbit
New Features
Bug Fixes