Bug 135539

Summary: sort-Xcode-project-file does not sort PBXFileReference and PBXBuildFile sections
Product: WebKit Reporter: Xiao Wang <wangxiao8611>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Xiao Wang 2014-08-02 02:24:00 PDT
PBXFileReference sample is like below:
```
/* Begin PBXFileReference section */
F43651BC1446351A00D06B63 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
F43651C81446351A00D06B63 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
```

PBXBuildFile sample is like below:
```
/* Begin PBXBuildFile section */
F43651BD1446351A00D06B63 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F43651BC1446351A00D06B63 /* Cocoa.framework */; };
F43651C91446351A00D06B63 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F43651C81446351A00D06B63 /* main.m */; };
/* End PBXBuildFile section */
```
These lines are the real content for `files` and `children` that are sorted in this script.
So these two sections also needs to be sorted.

The whole project is too big, I did not clone it and make the change. I just edited on Github to get a diff. So I do not have the patch file. but you could check link https://github.com/truebit/webkit/commit/7afa105d20fccdec68d8bd778b649409f17cbdc0#diff-d65acb20b3ed0e21ae223a4e0cadf7b1 to know what has been added/modified.
Comment 1 Xiao Wang 2014-08-02 21:39:32 PDT
I have just implemented pure Python  version with two new features: 
1. I mentioned in this bug: BuildFile and FileReference sort support
2. do not create new file everytime if no changes made.

See my code here, function `sort_pbxproj`:
https://github.com/truebit/xUnique/blob/eb2b7b9b1662e00d12d00b652d032d4da3014eb5/xUnique.py#L161
Comment 2 Xiao Wang 2014-08-02 21:40:40 PDT
(In reply to comment #1)
> I have just implemented pure Python  version with two new features: 
> 1. I mentioned in this bug: BuildFile and FileReference sort support
> 2. do not create new file everytime if no changes made.
> 
> See my code here, function `sort_pbxproj`:
> https://github.com/truebit/xUnique/blob/eb2b7b9b1662e00d12d00b652d032d4da3014eb5/xUnique.py#L161

fixed feature2 bugs: https://github.com/truebit/xUnique/blob/master/xUnique.py#L161