Skip to content

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

Draft
Badlazzor wants to merge 1 commit into
fix/bitrise-ci-workflow-renamefrom
fix/parsetarget-optional-deps-v2
Draft

fix(target): treat dependencies and buildPhases as optional keys#335
Badlazzor wants to merge 1 commit into
fix/bitrise-ci-workflow-renamefrom
fix/parsetarget-optional-deps-v2

Conversation

@Badlazzor

Copy link
Copy Markdown
Contributor

Summary

Ports the v1 fix landed in #331 (released as v1.3.4) onto the xcodeproject-v2 branch, plus a unit test covering the omitted-keys case.

Xcode 16.2+ omits the dependencies key entirely from project.pbxproj when a target has no dependencies (instead of writing dependencies = ();). The same forward-compat guard is applied to buildPhases.

Changes

  • xcodeproject/xcodeproj/target.go — same IsKeyNotFoundError guard already used for productType / productReference extended to dependencies and buildPhases. Mirror of fix(target): treat dependencies and buildPhases as optional keys #331.
  • xcodeproject/xcodeproj/target_test.go — new rawNativeTargetOmittedKeys fixture + test case under TestParseTarget. Asserts parseTarget returns no error and empty Dependencies / buildPhaseIDs when both keys are absent.

Testing

$ go test ./xcodeproject/xcodeproj/...
ok  	github.com/bitrise-io/go-xcode/v2/xcodeproject/xcodeproj	16.299s

All existing tests pass. New subtest exercises the omitted-keys path.

Context

@Badlazzor

Copy link
Copy Markdown
Contributor Author

Heads up: CI here is red because xcodeproject-v2 still uses the workflow name ci while the unified app invokes check. Opened #337 to rename it (matches master). Once #337 merges this should turn green and I'll mark ready for review.

Xcode 16.2+ omits the 'dependencies' key from project.pbxproj when a
target has no dependencies (instead of writing 'dependencies = ();').
parseTarget() must therefore treat the key as optional. The same
forward-compat guard is applied to 'buildPhases'.

Ports the v1 fix landed in #331 (v1.3.4) onto the
xcodeproject-v2 branch, and adds a unit test covering the omitted-keys
case so regressions on either key are caught.

Related: STEP-2426.
@Badlazzor Badlazzor force-pushed the fix/parsetarget-optional-deps-v2 branch from 7eebfa2 to a77dd2a Compare July 7, 2026 12:05
@Badlazzor Badlazzor changed the base branch from xcodeproject-v2 to fix/bitrise-ci-workflow-rename July 7, 2026 12:05
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