Retrieving LLVM version is now backwards compatible with Xcode 7 #308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses issue #306 and fixes Slather for Xcode 7 builds
The main issue is line 239 (https://github.com/SlatherOrg/slather/blob/master/lib/slather/project.rb#L239) of
project.rb
, which parses the LLVM version from the output ofxcrun llvm-cov --version
. If the version can't be parsed, the match array is null, and thecaptures
method fails. The stack trace returns:When Xcode 7 is installed, or selected as the active Xcode app, running
xcrun llvm-cov --version
gives the following output:When Xcode 8 is active, the command generates the following:
The obvious difference here is the line containing the LLVM version information. Xcode 8 and beyond prefix this line with
Apple
, which is what the regex current checks for. The change to parse the LLVM version was only added 2 months ago, so Xcode 7 may have been an afterthought at the time. Ideally, there would be a better function to parse the version string, but simply removing theApple
prefix from the regex is good enough to fix the issue.