Skip to content

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

Draft
Badlazzor wants to merge 1 commit into
xcodeproject-v2from
fix/parsetarget-optional-deps-v2
Draft

fix(target): treat dependencies and buildPhases as optional keys#335
Badlazzor wants to merge 1 commit into
xcodeproject-v2from
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

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.
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