MobileNativeFoundation / XCLogParser

Tool to parse Xcode and xcodebuild logs stored in the xcactivitylog format
Apache License 2.0
1.73k stars 120 forks source link

Fixes logic with swiftc parsing #106

Closed birwin93 closed 4 years ago

birwin93 commented 4 years ago

Noticed there were missing swiftFunctionTimes and swiftTypeCheckTimes in the outputted json report that were in the original xcactivitylog. After some investigation, it looks like the regex parsing used has some bugs. When running through the matches in the parse(command:occurrences:) methods, there were results that had multiple entries included in them and then were skipped:

“\r2.66ms\t/Users/user/workspace/project/directory/Utils/Utils/Validator/TextValidator.swift:61:71\r1.54ms\t/Users/user/workspace/project/directory/Utils/Utils/Validator/TextValidator.swift:62:63\r”

It may be caused by the trailing +(.+)\\r in regex queries, which is a bit indeterministic and in some cases may include a \r in it. Had some issues getting a regex query that worked correctly, so moved to just splitting commands on \r and \t. Didn't do a ton of benchmarking, but it didn't seem to cause the script to run noticeably slower. For reference the project I m running on is fairly large with well over 10k files.

Total transparency, I'm new to xcactivitylog files so I assume this is a bug, but let me know otherwise!