@@ -57,7 +57,6 @@ class Project < Xcodeproj::Project
57
57
58
58
def self . open ( xcodeproj )
59
59
proj = super
60
- proj . configure_from_yml
61
60
proj . xcodeproj = xcodeproj
62
61
proj
63
62
end
@@ -67,10 +66,6 @@ def derived_data_path
67
66
end
68
67
private :derived_data_path
69
68
70
- def build_directory
71
- @build_directory || derived_data_path
72
- end
73
-
74
69
def coverage_files
75
70
if self . input_format == "profdata"
76
71
profdata_coverage_files
@@ -118,27 +113,6 @@ def profdata_coverage_dir
118
113
dir
119
114
end
120
115
121
- def find_binary_file
122
- xctest_bundle = Dir [ "#{ profdata_coverage_dir } /**/*.xctest" ] . reject { |bundle |
123
- bundle . include? "-Runner.app/PlugIns/"
124
- } . first
125
- raise StandardError , "No product binary found in #{ profdata_coverage_dir } . Are you sure your project is setup for generating coverage files? Try `slather setup your/project.xcodeproj`" unless xctest_bundle != nil
126
-
127
- # Find the matching binary file
128
- xctest_bundle_file_directory = Pathname . new ( xctest_bundle ) . dirname
129
- app_bundle = Dir [ "#{ xctest_bundle_file_directory } /*.app" ] . first
130
- dynamic_lib_bundle = Dir [ "#{ xctest_bundle_file_directory } /*.framework" ] . first
131
-
132
- if app_bundle != nil
133
- find_binary_file_for_app ( app_bundle )
134
- elsif dynamic_lib_bundle != nil
135
- find_binary_file_for_dynamic_lib ( dynamic_lib_bundle )
136
- else
137
- find_binary_file_for_static_lib ( xctest_bundle )
138
- end
139
- end
140
- private :find_binary_file
141
-
142
116
def find_binary_file_for_app ( app_bundle_file )
143
117
app_bundle_file_name_noext = Pathname . new ( app_bundle_file ) . basename . to_s . gsub ( ".app" , "" )
144
118
Dir [ "#{ app_bundle_file } /**/#{ app_bundle_file_name_noext } " ] . first
@@ -162,7 +136,7 @@ def unsafe_profdata_llvm_cov_output
162
136
end
163
137
164
138
if self . binary_file == nil
165
- raise StandardError , "No binary file found. Please help slather by adding the \" scheme \" argument "
139
+ raise StandardError , "No binary file found."
166
140
end
167
141
168
142
puts "\n Processing coverage file: #{ profdata_file_arg } "
@@ -206,7 +180,7 @@ def configure_from_yml
206
180
end
207
181
208
182
def configure_build_directory_from_yml
209
- self . build_directory = self . class . yml [ "build_directory" ] if self . class . yml [ "build_directory" ] && ! @build_directory
183
+ self . build_directory || = self . class . yml [ "build_directory" ] || derived_data_path
210
184
end
211
185
212
186
def configure_source_directory_from_yml
@@ -226,7 +200,19 @@ def configure_ci_service_from_yml
226
200
end
227
201
228
202
def configure_input_format_from_yml
229
- self . input_format ||= self . class . yml [ "input_format" ] if self . class . yml [ "input_format" ]
203
+ self . input_format ||= self . class . yml [ "input_format" ] || input_format
204
+ end
205
+
206
+ def input_format = ( format )
207
+ format ||= "auto"
208
+ unless %w( gcov profdata auto ) . include? ( format )
209
+ raise StandardError , "Only supported input formats are gcov, profdata or auto"
210
+ end
211
+ if format == "auto"
212
+ @input_format = Slather . xcode_version [ 0 ] < 7 ? "gcov" : "profdata"
213
+ else
214
+ @input_format = format
215
+ end
230
216
end
231
217
232
218
def configure_scheme_from_yml
@@ -266,20 +252,28 @@ def coverage_service=(service)
266
252
end
267
253
268
254
def configure_binary_file_from_yml
269
- if input_format == "profdata"
270
- self . binary_file = self . class . yml [ "binary_file" ] ? self . class . yml [ "binary_file" ] : find_binary_file
255
+ if self . input_format == "profdata"
256
+ self . binary_file || = self . class . yml [ "binary_file" ] || find_binary_file
271
257
end
272
258
end
273
259
274
- def input_format = ( format )
275
- format ||= "auto"
276
- unless %w( gcov profdata auto ) . include? ( format )
277
- raise StandardError , "Only supported input formats are gcov, profdata or auto"
278
- end
279
- if format == "auto"
280
- @input_format = Slather . xcode_version [ 0 ] < 7 ? "gcov" : "profdata"
260
+ def find_binary_file
261
+ xctest_bundle = Dir [ "#{ profdata_coverage_dir } /**/*.xctest" ] . reject { |bundle |
262
+ bundle . include? "-Runner.app/PlugIns/"
263
+ } . first
264
+ raise StandardError , "No product binary found in #{ profdata_coverage_dir } . Are you sure your project is setup for generating coverage files? Try `slather setup your/project.xcodeproj`" unless xctest_bundle != nil
265
+
266
+ # Find the matching binary file
267
+ xctest_bundle_file_directory = Pathname . new ( xctest_bundle ) . dirname
268
+ app_bundle = Dir [ "#{ xctest_bundle_file_directory } /*.app" ] . first
269
+ dynamic_lib_bundle = Dir [ "#{ xctest_bundle_file_directory } /*.framework" ] . first
270
+
271
+ if app_bundle != nil
272
+ find_binary_file_for_app ( app_bundle )
273
+ elsif dynamic_lib_bundle != nil
274
+ find_binary_file_for_dynamic_lib ( dynamic_lib_bundle )
281
275
else
282
- @input_format = format
276
+ find_binary_file_for_static_lib ( xctest_bundle )
283
277
end
284
278
end
285
279
0 commit comments