Skip to content
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

It doesn't sort PBXGroup section some times #17

Open
edhub opened this issue Feb 12, 2015 · 30 comments
Open

It doesn't sort PBXGroup section some times #17

edhub opened this issue Feb 12, 2015 · 30 comments

Comments

@edhub
Copy link

edhub commented Feb 12, 2015

When I use it for our project, I noticed that, it doesn't sort PBXGroup until I change something in the project file (for example, add a empty group). Otherwise, it works great so far. It happens when we first apply it for our project. I'm not sure whether it'll happen in the future.

@truebit
Copy link
Owner

truebit commented Feb 12, 2015

could you please provide the diff project.pbxproj before and after adding the empty group?


Sent from my mobile phone

On Thu, Feb 12, 2015 at 11:16 AM, edhub [email protected] wrote:

When I use it for our project, I noticed that, it doesn't sort PBXGroup until I change something in the project file (for example, add a empty group). Otherwise, it works great so far. It happens when we first apply it for our project. I'm not sure whether it'll happen in the future.

Reply to this email directly or view it on GitHub:
#17

@edhub
Copy link
Author

edhub commented Feb 13, 2015

it's a business project so I couldn't do that. But once i got some time (not sure when), I can look into it.

@edhub
Copy link
Author

edhub commented Feb 13, 2015

but I did manage to find a exercise project file with PBXGroup section not sorted correctly. It doesn't support file uploading, so I just copy & paste the PBXGroup part. If you need the whole project file, please let me know how can I send it to you.

check this line: FE01095F654E29E4669FD59051BF4A79

/* Begin PBXGroup section /
1C8BAAD40D3B5F927C6DC0A762A820BF /
Supporting Files / = {
isa = PBXGroup;
children = (
7AB7B18155E2D756C57AD67E3DE5D5A7 /
Info.plist /,
EBF0396F918D5ED54FC59C803080400E /
main.m /,
);
name = "Supporting Files";
sourceTree = "";
};
304EE41ED71EA2205AC642471F07B575 /
vcproject / = {
isa = PBXGroup;
children = (
1C8BAAD40D3B5F927C6DC0A762A820BF /
Supporting Files /,
FE01095F654E29E4669FD59051BF4A79 /
login /,
B96C9F610970F8CF3E0BCCB41EFA9178 /
nav xibs /,
55F65BF1DF0D0D51AD7F9D4F02567D55 /
AppDelegate.h /,
DC5DAD08E08AA82D3CCD97C6C5817593 /
AppDelegate.m /,
638BBD9F9483E77C61604E4447BD5B5A /
Images.xcassets /,
4545E029013F47D478AD3E2350C7E995 /
LaunchScreen.xib /,
04C3104D63060826C7FD07A082CC4887 /
Main.storyboard /,
1C0373E446C58D7B88A4E529C2539D8E /
ViewController.h /,
7A4E408247BB90D5897E87505A7DFFCD /
ViewController.m /,
);
path = vcproject;
sourceTree = "";
};
38585E645596D3E1FB84EEC2D5B221CA /
vcprojectTests / = {
isa = PBXGroup;
children = (
88592D313A25A82215458E7B82554F6C /
Supporting Files /,
10D2C4D9F826BFED19FB0F9D5F8F9CE3 /
vcprojectTests.m /,
);
path = vcprojectTests;
sourceTree = "";
};
FE01095F654E29E4669FD59051BF4A79 /
login / = {
isa = PBXGroup;
children = (
E237CB6A3187D7D3F653F196A0A7273F /
LoginState.h /,
4155547A3FA1C427FF74C73319C03E99 /
LoginState.m /,
E2200F9387C7D7E3ACE29F6D9203E909 /
LoginViewController.h /,
02CD46DD35B87A9EB159E11E70461E4B /
LoginViewController.m /,
D0C3E787681A0F13852B7116EB629323 /
LoginViewController.xib /,
);
path = login;
sourceTree = "";
};
88592D313A25A82215458E7B82554F6C /
Supporting Files / = {
isa = PBXGroup;
children = (
B469DD62CF1BF879F989E91E75D50B69 /
Info.plist /,
);
name = "Supporting Files";
sourceTree = "";
};
B96C9F610970F8CF3E0BCCB41EFA9178 /
nav xibs / = {
isa = PBXGroup;
children = (
FA256945FD94BCE957FBB8E0A30B289F /
Tier1ViewController.h /,
2C3BDEA6335D293232CA22C7A945419A /
Tier1ViewController.m /,
18906F410DE23C9449BA7597CADEDBA9 /
Tier1ViewController.xib /,
5DD643C87B7B22E2F2864AB2780E265F /
Tier2ViewController.h /,
A5AC728535B19B3281D3BBA6684670D2 /
Tier2ViewController.m /,
21BB40856DE6B55A58E1BBBB34C69944 /
Tier2ViewController.xib /,
DE933B89FE2D233DF042643A507567F3 /
Tier3ViewController.h /,
8FBA5805AB7DD519CC775079CB7066C3 /
Tier3ViewController.m /,
081B1E64EB95AC7FDD3EC5EB9114CB16 /
Tier3ViewController.xib /,
);
path = "nav xibs";
sourceTree = "";
};
D640E569C0F0419DD5B042F6FE2C45CE /
Products / = {
isa = PBXGroup;
children = (
F1CBBCD2C102E1D4A6C3DC4DF69C68FC /
vcproject.app /,
04F573292FD3F4F4296248E759FE90EC /
vcprojectTests.xctest /,
);
name = Products;
sourceTree = "";
};
E5EF063CFBDB072E436C9F57DCD4EA35 = {
isa = PBXGroup;
children = (
D640E569C0F0419DD5B042F6FE2C45CE /
Products /,
304EE41ED71EA2205AC642471F07B575 /
vcproject /,
38585E645596D3E1FB84EEC2D5B221CA /
vcprojectTests /,
CC39A572ED7657CE5B27C217660E91A0 /
MainTabs.storyboard /,
);
sourceTree = "";
};
/
End PBXGroup section */

@truebit
Copy link
Owner

truebit commented Feb 14, 2015

Hi, Could you send the problematic original project file via replying github notification email? Thanks

@edhub
Copy link
Author

edhub commented Feb 15, 2015

here it is.

On Sat, Feb 14, 2015 at 11:26 AM, Sean Wang [email protected]
wrote:

Hi, Could you send the problematic original project file via replying
github notification email? Thanks


Reply to this email directly or view it on GitHub
#17 (comment).

@edhub
Copy link
Author

edhub commented Feb 15, 2015

i've replied the email with the file as attachment, but I didn't see it in the web page.

@truebit
Copy link
Owner

truebit commented Feb 15, 2015

It should not display on web page. But I also did not see it in email. Did you " reply all"?


Sent from my mobile phone

On Sun, Feb 15, 2015 at 10:32 AM, edhub [email protected] wrote:

i've replied the email with the file as attachment, but I didn't see it in the web page.

Reply to this email directly or view it on GitHub:
#17 (comment)

@edhub
Copy link
Author

edhub commented Feb 16, 2015

this time i reply all. Hope it's ok now.

On Sun, Feb 15, 2015 at 10:34 AM, Sean Wang [email protected]
wrote:

It should not display on web page. But I also did not see it in email. Did
you " reply all"?


Sent from my mobile phone

On Sun, Feb 15, 2015 at 10:32 AM, edhub [email protected] wrote:

i've replied the email with the file as attachment, but I didn't see it

in the web page.

Reply to this email directly or view it on GitHub:
#17 (comment)


Reply to this email directly or view it on GitHub
#17 (comment).

@truebit
Copy link
Owner

truebit commented Feb 19, 2015

Still not got it... Could you put the project file content on somewhere public? Thanks a lot.

@edhub
Copy link
Author

edhub commented Feb 25, 2015

I've uploaded the project to git hub :)
https://github.com/edhub/vcproject

@truebit
Copy link
Owner

truebit commented Feb 25, 2015

@edhub Thanks a lot:)
But I found the project file has already been uniquified and sorted?
Could you push the problematic one?

@edhub
Copy link
Author

edhub commented Feb 26, 2015

please checkout haha branch. and it's not sorted well at this line:

B96C9F610970F8CF3E0BCCB41EFA9178 /* nav xibs */ = {

/* Begin PBXGroup section / 1C8BAAD40D3B5F927C6DC0A762A820BF / Supporting
Files / = { isa = PBXGroup; children = ( 7AB7B18155E2D756C57AD67E3DE5D5A7
/
Info.plist /, EBF0396F918D5ED54FC59C803080400E / main.m /, ); name =
"Supporting Files"; sourceTree = ""; };
304EE41ED71EA2205AC642471F07B575 /
vcproject / = { isa = PBXGroup;
children = ( 1C8BAAD40D3B5F927C6DC0A762A820BF /
Supporting Files /,
B96C9F610970F8CF3E0BCCB41EFA9178 /
nav xibs /,
55F65BF1DF0D0D51AD7F9D4F02567D55 /
AppDelegate.h /,
DC5DAD08E08AA82D3CCD97C6C5817593 /
AppDelegate.m /,
638BBD9F9483E77C61604E4447BD5B5A /
Images.xcassets /,
4545E029013F47D478AD3E2350C7E995 /
LaunchScreen.xib /,
04C3104D63060826C7FD07A082CC4887 /
Main.storyboard /,
1C0373E446C58D7B88A4E529C2539D8E /
ViewController.h /,
7A4E408247BB90D5897E87505A7DFFCD /
ViewController.m /, ); path =
vcproject; sourceTree = ""; }; 38585E645596D3E1FB84EEC2D5B221CA /

vcprojectTests / = { isa = PBXGroup; children = (
88592D313A25A82215458E7B82554F6C /
Supporting Files /,
10D2C4D9F826BFED19FB0F9D5F8F9CE3 /
vcprojectTests.m /, ); path =
vcprojectTests; sourceTree = ""; }; B96C9F610970F8CF3E0BCCB41EFA9178
/
nav xibs / = { isa = PBXGroup; children = (
FA256945FD94BCE957FBB8E0A30B289F /
Tier1ViewController.h /,
2C3BDEA6335D293232CA22C7A945419A /
Tier1ViewController.m /,
18906F410DE23C9449BA7597CADEDBA9 /
Tier1ViewController.xib /,
5DD643C87B7B22E2F2864AB2780E265F /
Tier2ViewController.h /,
A5AC728535B19B3281D3BBA6684670D2 /
Tier2ViewController.m /,
21BB40856DE6B55A58E1BBBB34C69944 /
Tier2ViewController.xib /,
DE933B89FE2D233DF042643A507567F3 /
Tier3ViewController.h /,
8FBA5805AB7DD519CC775079CB7066C3 /
Tier3ViewController.m /,
081B1E64EB95AC7FDD3EC5EB9114CB16 /
Tier3ViewController.xib /, ); path =
"nav xibs"; sourceTree = ""; }; 88592D313A25A82215458E7B82554F6C /

Supporting Files / = { isa = PBXGroup; children = (
B469DD62CF1BF879F989E91E75D50B69 /
Info.plist /, ); name = "Supporting
Files"; sourceTree = ""; }; D640E569C0F0419DD5B042F6FE2C45CE /

Products / = { isa = PBXGroup; children = (
F1CBBCD2C102E1D4A6C3DC4DF69C68FC /
vcproject.app /,
04F573292FD3F4F4296248E759FE90EC /
vcprojectTests.xctest /, ); name =
Products; sourceTree = ""; }; E5EF063CFBDB072E436C9F57DCD4EA35 = {
isa = PBXGroup; children = ( D640E569C0F0419DD5B042F6FE2C45CE /
Products
/, 304EE41ED71EA2205AC642471F07B575 / vcproject /,
38585E645596D3E1FB84EEC2D5B221CA /
vcprojectTests /,
CC39A572ED7657CE5B27C217660E91A0 /
MainTabs.storyboard /, ); sourceTree =
""; };/
End PBXGroup section */

On Wed, Feb 25, 2015 at 11:47 PM, Sean Wang [email protected]
wrote:

@edhub https://github.com/edhub Thanks a lot:)
But I found the project file has already been uniquified and sorted?
Could you push the problematic one?


Reply to this email directly or view it on GitHub
#17 (comment).

@truebit
Copy link
Owner

truebit commented Feb 26, 2015

I still not understand, there's only a haha branch in the project file, and I used that one.
concerning "it's not sorted well", could you explain more?

Do you mean that it is not sorted by lower letters? That's the default action of str.sort in Python. I did not change it. And I also added a rule that placing folders ( without . in name) before any files.
If that's not you mean, I will reopen this issue.

BTW, to save both our time, you should just say what's the issue. just saying "not sort well" and pasting the long content is too confused...

@truebit truebit closed this as completed Feb 26, 2015
@edhub
Copy link
Author

edhub commented Feb 27, 2015

sorry, i replied it in email, and the result is a mess. Here, take a look at current orders in PBXGroup:
1C8BAAD40D3B5F927C6DC0A762A820BF /* Supporting Files /
304EE41ED71EA2205AC642471F07B575 /
vcproject /
38585E645596D3E1FB84EEC2D5B221CA /
vcprojectTests
-> B96C9F610970F8CF3E0BCCB41EFA9178 /* nav xibs /
88592D313A25A82215458E7B82554F6C /
Supporting /
D640E569C0F0419DD5B042F6FE2C45CE /
Products */
E5EF063CFBDB072E436C9F57DCD4EA35 = {

shouldn't it be:
1C8BAAD40D3B5F927C6DC0A762A820BF /* Supporting Files /
304EE41ED71EA2205AC642471F07B575 /
vcproject /
38585E645596D3E1FB84EEC2D5B221CA /
vcprojectTests
88592D313A25A82215458E7B82554F6C /* Supporting /
->B96C9F610970F8CF3E0BCCB41EFA9178 /
nav xibs /
D640E569C0F0419DD5B042F6FE2C45CE /
Products */
E5EF063CFBDB072E436C9F57DCD4EA35 = {

@truebit
Copy link
Owner

truebit commented Feb 28, 2015

Still cannot understand what you say. The vcproject PBXGroup is already in that order, see line 93

@edhub
Copy link
Author

edhub commented Feb 28, 2015

please check line 114
https://github.com/edhub/vcproject/blob/haha/vcproject.xcodeproj/project.pbxproj#L114.
If you still don't think it's a problem, please just close the issue. thanks

On Sat, Feb 28, 2015 at 12:27 PM, Sean Wang [email protected]
wrote:

Still cannot understand what you say. The vcproject PBXGroup is already
in that order, see line 93
https://github.com/edhub/vcproject/blob/haha/vcproject.xcodeproj/project.pbxproj#L93


Reply to this email directly or view it on GitHub
#17 (comment).

@truebit
Copy link
Owner

truebit commented Mar 2, 2015

You mean the whole PBXGroup section order in project file? I did not sort that, I just sort the parts which it will affect what it looks in xcode, e.g. children and files

@edhub
Copy link
Author

edhub commented Mar 2, 2015 via email

@truebit
Copy link
Owner

truebit commented Mar 2, 2015

There is very huge work to do if dealing with all types of pbx sections and sub-sections in project file unless someone got a new thought. Currently I have no plans for that.

About the order problem you concerned, in my experience, only if the content of the section is different, it will get conflicts in Git; if the order is different but the content is the same, it should not get conflicts; and that's why I made this tool:)

@edhub
Copy link
Author

edhub commented Mar 2, 2015

since Xcode can do the sort trick, maybe you can trigger the feature from
xcode when you got plans for it.

On Mon, Mar 2, 2015 at 5:00 PM, Sean Wang [email protected] wrote:

There is very huge work to do if dealing with all types of pbx sections
and sub-sections in project file unless someone got a new thought.
Sorry, currently I have no plans for that.


Reply to this email directly or view it on GitHub
#17 (comment).

@truebit
Copy link
Owner

truebit commented Mar 2, 2015

xUnique is just a simple pure python script, trigger from Xcode is not elegant and will be very complex imho.

@ou2s
Copy link

ou2s commented Jan 21, 2016

Hello, just wanted to confirm that the fact that PBXGroup sections are not ordered makes xUnique unable to resolve my merge conflicts.

Anyway, thanks for the work!

@truebit
Copy link
Owner

truebit commented Jan 22, 2016

Sorry the inconvenience. Maybe you could run in Xcode before committing the project file? According to the discussion above, this would trigger Xcode sorting PBXGroup.

@ou2s
Copy link

ou2s commented Jan 22, 2016

XCode did not sort the PBXGroup section... However I managed to find a script that does the job:
https://github.com/neciu/SOCK

xUnique + SOCK = perfectly sorted my pbxproj :)

@truebit
Copy link
Owner

truebit commented Jan 22, 2016

So you mean sorting the items under pbxgroup instead of pbxgroup themselves? If so, I could add that :)


Sent from my mobile phone

On Sat, Jan 23, 2016 at 2:07 AM, Ouss Ghalbz [email protected]
wrote:

XCode did not sort the PBXGroup section... However I managed to find a script that does the job:
https://github.com/neciu/SOCK

xUnique + SOCK = perfectly sorted my pbxproj :)

Reply to this email directly or view it on GitHub:
#17 (comment)

@ou2s
Copy link

ou2s commented Jan 22, 2016

Yes, I meant items them by UUID. And it was not only in pbxgroup section, but in nearly every section.

I had to add more sections into the SOCK script, because it only supported the "critical" ones according to the developer.

It would be a great feature to add to xUnique, because it helps to reduce the number of conflicts.

@truebit
Copy link
Owner

truebit commented Jan 22, 2016

Could you make a list of these sections? I will look into it.


Sent from my mobile phone

On Sat, Jan 23, 2016 at 2:24 AM, Ouss Ghalbz [email protected]
wrote:

Yes, I meant sorting them by UUID. And it was not only in pbxgroup, but in nearly every section.
I had to add more sections into the SOCK script, because it only supported the "critical" one from the develop POV.

It would be a great feature to add to xUnique, because it helps to reduce the number of conflicts.

Reply to this email directly or view it on GitHub:
#17 (comment)

@ou2s
Copy link

ou2s commented Jan 22, 2016

It is every section except PBXBuildFile and PBXFileReference.

PBXBuildFile
PBXFrameworksBuildPhase
PBXGroup
PBXResourcesBuildPhase
PBXSourcesBuildPhase
PBXContainerItemProxy
PBXCopyFilesBuildPhase
PBXShellScriptBuildPhase
PBXNativeTarget
PBXProject
PBXShellScriptBuildPhase
PBXTargetDependency
PBXVariantGroup
XCBuildConfiguration
XCConfigurationList
XCVersionGroup

IMHO, the best sorting method for a .pbxproj file is:

  • PBXBuildFile and PBXFileReference objects sorted by name in comments
  • other sections objects sorted by UUID
  • objects in files sorted by name in comments

@truebit
Copy link
Owner

truebit commented Feb 3, 2016

PBXBuildFile and PBXFileReference can be sorted by its names, Actually that's what I did in the beginning, Now you could switch it on by adding -p in command line. I turned it off because Xcode would sort them by UUID, that would cause lots of changes when you commit almost EVERYTIME. It is too annoying.

@truebit
Copy link
Owner

truebit commented Feb 3, 2016

open this enhancement issue to make me not being lazy..

@truebit truebit reopened this Feb 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants