Skip to content

Commit 9f93a53

Browse files
authored
When expanding all subspecs, exclude test specs (#2949)
Fixes CMake build broken by #2943.
1 parent ea59e99 commit 9f93a53

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmake/podspec_cmake.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,24 @@ def process(podspec_file, cmake_file, *req_subspecs)
408408
end
409409
end
410410

411+
# Returns true if test specifications are supported by the current version of
412+
# CocoaPods and the given +spec+ is a test specification.
413+
def test_specification?(spec)
414+
# CocoaPods 1.3.0 added test specifications.
415+
if !spec.respond_to?(:test_specification?)
416+
return false
417+
end
418+
419+
return spec.test_specification?
420+
end
421+
411422
# Translates the (possibly empty) list of requested subspecs into the list of
412423
# subspecs to actually include. If +req_subspecs+ is empty, returns all
413424
# subspecs. If non-empty, all subspecs are returned as qualified names, e.g.
414425
# "Logger" may become "GoogleUtilities/Logger".
415426
def normalize_requested_subspecs(spec, req_subspecs)
416-
subspecs = spec.subspecs
417427
if req_subspecs.empty?
428+
subspecs = spec.subspecs.select { |s| not test_specification?(s) }
418429
return subspecs.map { |s| s.name }
419430
else
420431
return req_subspecs.map do |name|

0 commit comments

Comments
 (0)