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

feat: use xcbeautify for xcodebuild output if installed #1392

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

liamjones
Copy link
Contributor

Summary:

The run-ios command already detects and uses xcpretty (https://github.com/xcpretty/xcpretty) if it's available.

This commit adds support for another xcodebuild output formatter, xcbeautify (https://github.com/thii/xcbeautify).

The logic for what is used is as follows:

  1. If xcbeautify is available use it
  2. If xcbeautify isn't available but xcpretty is use xcpretty
  3. If neither are available fallback to raw xcodebuild output

Test Plan:

Tested manually with the following scenarios;

  • only xcbeautify installed (xcbeautify used)
  • only xcpretty installed (xcpretty used)
  • both installed (xcbeautify used)
  • neither installed (xcodebuild used raw)

@liamjones
Copy link
Contributor Author

I looked at adding unit tests for the new code but my initial attempt was ending up pretty messy due to having to run the entirety of runIOS and there being lots of file system access that needed dealing with (mocked or otherwise). I assumed (maybe incorrectly?) that the project maintainers wouldn't want buildProject exported from its module purely for testing purposes.

The run-ios command already detects and uses xcpretty (https://github.com/xcpretty/xcpretty) if it's available.

This commit adds support for another xcodebuild output formatter, xcbeautify (https://github.com/thii/xcbeautify).

The logic for what is used is as follows:
1. If xcbeautify is available use it
2. If xcbeautify isn't available but xcpretty is use xcpretty
3. If neither are available fallback to raw xcodebuild output
Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Mind sending a screenshot of how it looks with xcbeautify? :)

@liamjones
Copy link
Contributor Author

@thymikee here's an example of xcbeautify with a successful build:

Screenshot 2021-04-07 at 15 14 21

And xcbeautify with a failed build:

Screenshot 2021-04-07 at 15 17 38

(Note: PR #1393 is also applied in the above screenshot so there's no raw xcodebuild output after the failure output from xcbeautify itself)

Copy link
Member

@grabbou grabbou left a comment

Choose a reason for hiding this comment

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

LGTM. I have cleaned up the if/else logic for better readability.

@grabbou grabbou merged commit 2705d9d into react-native-community:master Jul 6, 2021
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.

None yet

3 participants