Xcodeproj icon indicating copy to clipboard operation
Xcodeproj copied to clipboard

Not all targets respond to test_target_type

Open getaaron opened this issue 7 years ago • 2 comments

In https://github.com/fastlane/fastlane/pull/12212, @joshdholtz had to do the following because aggregate targets don't respond to test_target_type?:

-          non_test_targets = targets.reject(&:test_target_type?)
+          non_test_targets = targets.reject do |t|
+            # Not all targets respond to `test_target_type?`
+            t.respond_to?(:test_target_type?) && t.test_target_type?
+          end

It would be nice if aggregate targets (and others?) would respond to test_target_type? by returning false instead of throwing an exception

getaaron avatar Apr 02 '18 18:04 getaaron

Right now, that's only defined on PBXNativeTarget since that's the only type of target that has product types

segiddins avatar Apr 07 '18 18:04 segiddins

What do you think about adding

def test_target_type?
    false
end

to AbstractTarget? We could do the same with extension_target_type?. This would improve support for heterogeneous collections of targets at the cost of a (IMO) minor increase in API complexity. I can open a PR if there are no concerns about the design decision.

getaaron avatar Apr 07 '18 18:04 getaaron