[gym] handle xcpretty errors cleaner & promote xcbeautify#30099
Conversation
a260967 to
e6b4067
Compare
| log_lines = File.read(log_path).split("\n") | ||
| log_content = log_lines.last(5) | ||
| log_content.each do |row| | ||
| UI.command_output(row) |
There was a problem hiding this comment.
Did you mean to keep printing the last 5 lines and then print the error line (if found amongst the 5 lines) as a 6th line? That seems odd?
There was a problem hiding this comment.
It previously dumped the last 5 lines in output again. Due to a bug in xcpretty, it will miss capturing some errors in the output. When XCPretty fails, it naturally pulls the last 5 lines of output and reprints it to hopefully "find" the crash.
In the case of larger apps - it won't. So we look for "error" of ALL the lines, then dump those out. This means when XCPretty doesn't push an error to the console, but its written to log and its not in the last 5 - we will find it. This is basically this bug: xcpretty/xcpretty#403
e6b4067 to
dc3b041
Compare
There was a problem hiding this comment.
Hey @iBotPeaches 👋
Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.
Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"
There was a problem hiding this comment.
Congratulations! 🎉 This was released as part of fastlane 2.237.0 🚀
Problem
Most users run
xcpretty. They have no idea that you can "brew install" a better formatter. XCPretty at this point is pretty rough as it misses the newer Xcode error format, so errors are stuck in a log file and not emitted into the output.Take this sample error (xcpretty) and try and find the real error as to why the build failed. You can't. (well in this sample case you can, since error is on one of last 5 lines)
Now look at that same build with xcbeautify. The line is clear as a day with an emoji.
Solution
Demo (xcpretty)