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

Update writeObjectsSections to match current Xcode format #46

Merged
merged 4 commits into from
Mar 10, 2019

Conversation

fbartho
Copy link
Contributor

@fbartho fbartho commented Mar 8, 2019

We've been noticing some thrash where a blank line gets deleted or re-added when adding new NativeModules to our react-native project.

Under the hood, several of our tools are using this npm package. After some experiments, I was able to figure out that current Xcode versions will automatically insert an extra blank line after the objects = { section of the Xcode project.

Looking at the source-code of this tool, I found that 7 years ago this was an intentional feature:

if (!first) {
this.writeFlush("\n")
} else {
first = false;
}

With the current release version of Xcode, and indeed several previous versions of Xcode 10 and possibly later versions of Xcode 9, when Xcode writes out the project.pbxproj file, it will insert this blank line.

This PR brings cordova-node-xcode into line with that style.
Tested on Xcode Version 10.1 (10B61)

Aside: 15 of the 19 project fixtures had the old-style, while 4 of the fixtures had the new style, so either we have some unused fixtures, or some fixtures aren't using the pbxWriter for what they're testing?

@fbartho fbartho force-pushed the fb/fix-object-newline-insertion branch from 9f1f7e5 to 2b90c37 Compare March 8, 2019 23:49
RELEASENOTES.md Outdated Show resolved Hide resolved
@brodycj
Copy link

brodycj commented Mar 10, 2019

We've been noticing some thrash where a blank line gets deleted or re-added when adding new NativeModules to our react-native project.

Any pointers how I could reproduce this behavior on Cordova or React Native?

P.S. My Xcode shows the following version: Version 10.1 (10B61)

@fbartho
Copy link
Contributor Author

fbartho commented Mar 10, 2019

Any pointers how I could reproduce this behavior on Cordova or React Native?

Absolutely! In my project it was reproducible by editing the file name of any file or group using Xcode. That would force Xcode to rewrite the pbxproj, and that adds in the blank line! (So, modify a project using node-Xcode, and then cause Xcode to modify itself, and compare both versions; Or, take an Xcode generated project, and then force node-Xcode to rewrite it, even though you changed nothing)

RELEASENOTES.md Outdated Show resolved Hide resolved
RELEASENOTES.md Outdated Show resolved Hide resolved
@fbartho
Copy link
Contributor Author

fbartho commented Mar 10, 2019

Changes to the release notes are removed!

Copy link

@brodycj brodycj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fbartho.

@brodycj
Copy link

brodycj commented Mar 10, 2019

Travis CI build is now green, merging now. I think this change should be considered a MINOR change as opposed to a "patch fix".

@brodycj brodycj merged commit a65e194 into apache:master Mar 10, 2019
@fbartho fbartho deleted the fb/fix-object-newline-insertion branch March 11, 2019 17:04
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