Skip to content

fix(target): treat dependencies and buildPhases as optional keys#331

Open
ataetgi wants to merge 1 commit into
bitrise-io:v1from
ataetgi:fix/optional-dependencies-key
Open

fix(target): treat dependencies and buildPhases as optional keys#331
ataetgi wants to merge 1 commit into
bitrise-io:v1from
ataetgi:fix/optional-dependencies-key

Conversation

@ataetgi
Copy link
Copy Markdown

@ataetgi ataetgi commented May 22, 2026

Summary

Xcode 16.2+ omits the dependencies key from project.pbxproj when a target has no dependencies (instead of writing dependencies = ();). This causes parseTarget() to fail with a KeyNotFoundError.

Changes

Apply the same IsKeyNotFoundError guard already used for productType and productReference to:

  • dependencies — fixes the immediate breakage
  • buildPhases — forward-compatibility (Xcode may optimize this away too)

Testing

  • Existing tests pass (go test ./xcodeproject/xcodeproj/...)
  • Verified locally against a real Xcode 16.2 project with 6 affected targets

Fixes #330

Copilot AI review requested due to automatic review settings May 22, 2026 10:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates Xcode target parsing to tolerate missing dependencies and buildPhases keys in serialized target objects instead of failing fast.

Changes:

  • Treat dependencies as optional: ignore “key not found” errors while still failing on other errors.
  • Treat buildPhases as optional: ignore “key not found” errors while still failing on other errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread xcodeproject/xcodeproj/target.go
Comment thread xcodeproject/xcodeproj/target.go
Xcode 16.2+ omits the 'dependencies' key from project.pbxproj when a
target has no dependencies (instead of writing 'dependencies = ();').
This causes parseTarget() to fail with a KeyNotFoundError.

Apply the same IsKeyNotFoundError guard already used for 'productType'
and 'productReference'. Also guard 'buildPhases' for forward compat.

Fixes bitrise-io#330
@ataetgi ataetgi force-pushed the fix/optional-dependencies-key branch from 467f27b to 8ad112c Compare May 22, 2026 10:10
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.

2 participants