-
-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit More Comments in Xcode Project Files #243
Conversation
2f117d3
to
140658f
Compare
140658f
to
da90319
Compare
Sources/xcproj/PBXTarget.swift
Outdated
@@ -88,7 +88,7 @@ public class PBXTarget: PBXObject { | |||
} | |||
|
|||
func plistValues(proj: PBXProj, isa: String, reference: String) -> (key: CommentedString, value: PlistValue) { | |||
var dictionary: [CommentedString: PlistValue] = [:] | |||
var dictionary = plistValues(proj: proj, reference: reference) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be super.plistValues
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can update that to make it more clear. This method has an isa:
named argument so this code isn't infinitely recursive. After reading your comment I was like, wait, how does this work? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment. Out of curiosity, how did you do the dump-header search that you mentioned?
I just searched around PBXTarget.h until I found something interesting. PBXContainerItem.h has the |
Older versions of Xcode (Xcode 3 and prior) supported user comments on build phases and targets. Add support for loading and writing comments from old project files so the project is left unchanged after a round trip. The class name PBXContainerItem was chosen to match the class name used by Xcode which introduces the comments property in to the hierarchy.
The the name property is not explicitly set, Xcode will use the path to populate the object’s comment. Update xcproj with this behavior to eliminate noise in diffs.
The mainGroup property’s comment is the group’s name or path, if either exists. Similarly, use the path for the productRefGroup if the name property isn’t set.
Xcode appends a generic PBXBuildRule comment to a target’s build rules, similar to the target dependencies. Update xcproj to do the same to eliminate diffs.
da90319
to
be5436b
Compare
Where is the comment property set within the Xcode UI? |
As far as I know, the UI for editing comments was eliminated in Xcode 4, but we still have a lot of comments throughout our 218 Xcode projects, so even though it's seemingly an obsolete feature, I'd like to eliminate diffs. |
Short description 📝
Update xcproj to support the
comment
property and to fix diff noise when creating plist entires forPBXVariantGroup
,PBXProject
, andPBXTarget
.Solution 📦
Add support for the
comment
property via a newPBXContainerItem
class, which follows Xcode's design based on a Google class-dump header search. Update comment generationPBXVariantGroup
,PBXProject
, andPBXTarget
to eliminate diff noise found when writing the 218 with xcproj.Implementation 👩💻👨💻
PBXContainerItem
to support thecomment
property, matching the behavior from a class-dump search, and make it the super class ofPBXBuildPhase
andPBXTarget
.PBXVariantGroup
, fall back topath
ifname
isnil
.PBXProject.mainGroup
andPBXProject.productRefGroup
, fall back topath
ifname
isnil
.PBXTarget.buildRules
emits theisa
as the comment, similar to thedependencies
property.This change is