Skip to content

Properly handle missing fields#49

Open
tcamin wants to merge 1 commit into
truebit:masterfrom
Subito-it:cocoapods-1.6
Open

Properly handle missing fields#49
tcamin wants to merge 1 commit into
truebit:masterfrom
Subito-it:cocoapods-1.6

Conversation

@tcamin

@tcamin tcamin commented Feb 12, 2019

Copy link
Copy Markdown

CocoaPods 1.6 is writing a new PBXAggregateTarget section which contains node without productName key. As a result running xUnique against the Pods.xcodeproj resulted in the following error:

  File "build/bdist.macosx-10.12-intel/egg/xUnique.py", line 140, in __set_to_result
KeyError: u'productName'

The fix modifies the __set_to_result method making it (naively) resilient to the missing key.

This became an issue with CocoaPods 1.6 generated Pods.xcodeproj
@truebit

truebit commented Feb 13, 2019

Copy link
Copy Markdown
Owner

Thanks for the PR.
I saw the productName related code added in #10 .
Could you please test if this breaks fix in #10

@truebit

truebit commented Feb 13, 2019

Copy link
Copy Markdown
Owner

it seems the sample file in #10 all contains productName, could you please try to construct a valid project file with multiple PBXAggregateTarget items that contains the possibility of absense of "name" and/or "productName" to see if it works?

@tcamin

tcamin commented Feb 13, 2019

Copy link
Copy Markdown
Author

The missing productName key is only in the aggregateTargets that were added to the Pods.xcodeproj/project.pbxproj by CocoaPods 1.6.

Our project's pbxproj contains targets with productName and name and everything seems to work even after the fix. I'm don't know how to test the absence of name if not by manually removing it from the file and running xunique again which still works

@truebit

truebit commented Feb 15, 2019

Copy link
Copy Markdown
Owner

You changed base method of __set_to_result, this is used in all types of PBX items. And productName and name for PBXAggregateTarget is to make the generated item unique.
As project files varies huge, we could only change specific spot to not break down others.

I prefer only change the logic around line 338.
Such like trying to get productName, if return None, change it to isa type

@truebit

truebit commented May 18, 2021

Copy link
Copy Markdown
Owner

See comment in #54 (comment)

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