[Analyzer] Validate Pod Target Swift versions

Raises an Informative when a pod is shared between TargetDefinitions
that have different SWIFT_VERSION flags.
parent 74eda202
...@@ -423,19 +423,21 @@ module Pod ...@@ -423,19 +423,21 @@ module Pod
end end
end end
target_msg = lambda do |target| error_message_for_target = lambda do |target|
if target.swift_version.nil? "#{target.name} (Swift #{target.swift_version})"
"#{target.name} (Swift version missing)"
else
"#{target.name} (Swift #{target.swift_version})"
end
end end
error_messages = [] error_messages = targets_by_spec.map do |spec, targets|
targets_by_spec.each do |spec, targets| swift_targets = targets.reject { |target| target.blank? }
error_messages << "#{spec.name} required by #{targets.map(&target_msg).join(', ')}" unless targets.uniq(&:swift_version).count == 1 next if swift_targets.empty? || swift_targets.uniq(&:swift_version).count == 1
target_errors = swift_targets.map(&error_message_for_target).join(', ')
"- #{spec.name} required by #{target_errors}"
end.compact
unless error_messages.empty?
raise Informative, 'The following pods are integrated into targets ' \
"that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
end end
raise Informative, "The following pods are integrated into targets that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
end end
# Setup the pod targets for an aggregate target. Deduplicates resulting # Setup the pod targets for an aggregate target. Deduplicates resulting
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment