XcodeEditor icon indicating copy to clipboard operation
XcodeEditor copied to clipboard

XcodeEditor does not handle Emoji in build phase names well

Open edwardmp opened this issue 9 years ago • 14 comments

Hi,

Thanks so much for developing this. It was exactly what I needed.

I noticed one issue, though. CocoaPods now uses a emoji in various build phase names it adds automatically. These ordinarily are just strings with a UTF8-Code in them. You could just remove those Emoji (see https://gist.github.com/cihancimen/4146056 on how to detect them). Right now it just turns these Emoji in some gibberish.

Furthermore, I needed some functionality that is not present in the current CocoaPods release. Any idea when the next release will be?

For example:

schermafbeelding 2016-05-16 om 22 34 54

Best regards, Edward

edwardmp avatar May 16 '16 16:05 edwardmp

@jasperblues Decided to investigate this. It appears the problem does not originate in your code. As I understand it, XCodeEditor will write XML output to the pbxproj file. Xcode then converts it to another format (PLIST?). When I close Xcode and the conversion does not take place, all is file. XcodeEditor correctly outputs the Emoji.

However, when Xcode is open and the conversion happens, the emoji are corrupted. I think this is a bug in Xcode, I'll try to file a bug report at Apple.

Correct XML output by XcodeEditor: schermafbeelding 2016-06-22 om 19 26 15

Corrupted conversion by Xcode: schermafbeelding 2016-06-22 om 19 46 22

Possibly related to http://openradar.appspot.com/18512876 and http://openradar.appspot.com/13827044

edwardmp avatar Jun 22 '16 18:06 edwardmp

I filed a radar, copy listed here. I could reproduce the bug by converting the pbxproj file to XML using plutil. So this issue has nothing to do with XcodeEditor itself, although it is still important to resolve.

Before Apple fixes this, I suggest stripping emoji from build script names?

edwardmp avatar Jun 22 '16 18:06 edwardmp

@edwardmp Thanks for the information. I noticed some other projects (eg CocoaPods) recently stopped using emoji in the project files, so that makes sense.

jasperblues avatar Jun 22 '16 23:06 jasperblues

@jasperblues Yes indeed, found a few issues in the CocoaPods repo that might be related. Let's see how (or if) Apple responds. Seems they are replacing the emoji with [CP] https://github.com/CocoaPods/CocoaPods/pull/5382

The major issue here by the way is not necessarily the emoji no longer working: I noticed my pbxproj grew to 200 mb and Xcode freezing because somehow the affected build phases would get added multiple times. For the latter I'm not sure whether this is because of a deeper issue in Xcode or in XcodeEditor.

Anyway, if I create a pull request for (at least temporarily) stripping emoji would you consider merging it in?

edwardmp avatar Jun 22 '16 23:06 edwardmp

Yes, that sounds like an excellent temporary solution.

Speaking of bugs. There's a few bug fixes on another branch that I did for a client using this project. I had to strip out generics as they were on an earlier platform. . . need to merge those back some time.

jasperblues avatar Jun 22 '16 23:06 jasperblues

OK great, I'll see what I can make of it the coming days. Aside for this, your library has been working well for me, so thanks for creating it 👍

edwardmp avatar Jun 22 '16 23:06 edwardmp

:) You're welcome buddy. Thanks for using and, if you feel like it, contributing too.

jasperblues avatar Jun 22 '16 23:06 jasperblues

@jasperblues I created a pull request. I found this neat NSString category which does the job well. But since you currently don't have any dependencies, I just copied these 2 files to Utils.

I also added tests for it. However, as mentioned in the pull request the changes are not written to the project file yet. Using the debugger I see that all emojis are stripped from XCBuildShellScript & XCBuildShellScriptDefinition. Maybe you need to mark them as dirty somewhere so that the changes will be written to file.

edwardmp avatar Jun 23 '16 18:06 edwardmp

@jasperblues you merged in my stuff but did you see my question to you as the implementation was not complete yet.

edwardmp avatar Jul 13 '16 20:07 edwardmp

Got a response from Apple today:

There are no plans to address this based on the following:

We do not officially support the XML file format or workflows involving it.

Thus, it is important that we remove all emoji in all build scripts, but I'm still waiting for your input how to achieve this @jasperblues

edwardmp avatar Jul 20 '16 08:07 edwardmp

@edwardmp sorry for the delay in reply! Would you be able to check in a broken test? (It doesn't have to have asserts that fail if that is hard - just eyeball the plist file). I could then make it pass for you.

jasperblues avatar Jul 20 '16 08:07 jasperblues

@jasperblues Hi Jasper sorry didn't have time until now to respond.

The issue is that the updated build scripts (without emoji) are somehow not applied/saved properly. When the project is saved I see the old build script names as if nothing has changed. This may be in some part of the code that determines which stuff should get overwritten? Any clue? If not I can try to make a test case but this will take me some more time

edwardmp avatar Sep 04 '16 23:09 edwardmp

Hi @jasperblues Did you see my previous message? I'd like to know since a project I develop is delayed solely by the emoji issue. Hope to hear from you soon. Thanks.

edwardmp avatar Sep 21 '16 18:09 edwardmp

@edwardmp I'm snowed in with work at the moment, so won't be able to look at it for a while.

jasperblues avatar Sep 25 '16 04:09 jasperblues