Skip to content

Commit

Permalink
find gcno files through an exhaustive serach, since I can't find out …
Browse files Browse the repository at this point in the history
…how to change where Xcode wants to put them
  • Loading branch information
marklarr committed Jun 17, 2014
1 parent 43d19db commit d125230
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/smother/coverage_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def source_file_pathname_relative_to_project_root

def gcov_data
@gcov_data ||= begin
gcov_output = `gcov #{source_file_pathname} --object-directory #{project.gcno_file_dir}`
gcov_output = `gcov #{source_file_pathname} --object-directory #{gcno_file_pathname.parent}`
# Sometimes gcov makes gcov files for Cocoa Touch classes, like NSRange. Ignore and delete later.
gcov_files_created = gcov_output.scan(/creating '(.+\..+\.gcov)'/)

Expand Down
20 changes: 15 additions & 5 deletions lib/smother/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@
module Smother
class Project < Xcodeproj::Project

def gcno_file_dir
"/Users/marklarsen/Library/Developer/Xcode/DerivedData/OCMock-enxcxyopnlsrzqdfbcahokpmqtwj/Build/Intermediates/OCMock.build/Debug/OCMock.build/Objects-normal/x86_64/"
def derived_data_dir
File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/"
end
private :derived_data_dir

def coverage_files
Dir["#{gcno_file_dir}/*.gcno"].map do |file|
Dir["#{derived_data_dir}/**/*.gcno"].map do |file|
coverage_file = Smother::CoverallsCoverageFile.new(file)
coverage_file.project = self
coverage_file
end
# If there's no source file for this gcno, or the gcno is old, it probably belongs to another project.
if coverage_file.source_file_pathname
stale_seconds_limit = 60
if (Time.now - File.mtime(file) < stale_seconds_limit)
next coverage_file
else
puts "Skipping #{file} -- older than #{stale_seconds_limit} seconds ago."
end
end
next nil
end.compact
end
private :coverage_files

Expand Down

0 comments on commit d125230

Please sign in to comment.