Commit c325e4be authored by Ben Asher's avatar Ben Asher

Cleaned up target mismatch analysis

parent 4660373e
...@@ -247,7 +247,6 @@ module Pod ...@@ -247,7 +247,6 @@ module Pod
next unless embedded_target.user_targets.map(&:uuid).any? do |embedded_uuid| next unless embedded_target.user_targets.map(&:uuid).any? do |embedded_uuid|
embedded_uuids.include? embedded_uuid embedded_uuids.include? embedded_uuid
end end
raise Informative, "#{aggregate_target.name} must call use_frameworks! because it is hosting an embedded target that calls use_frameworks!." unless aggregate_target.requires_frameworks?
pod_target_names = aggregate_target.pod_targets.map(&:name) pod_target_names = aggregate_target.pod_targets.map(&:name)
# This embedded target is hosted by the aggregate target's user_target; copy over the non-duplicate pod_targets # This embedded target is hosted by the aggregate target's user_target; copy over the non-duplicate pod_targets
aggregate_target.pod_targets = aggregate_target.pod_targets + embedded_target.pod_targets.select do |pod_target| aggregate_target.pod_targets = aggregate_target.pod_targets + embedded_target.pod_targets.select do |pod_target|
...@@ -317,18 +316,19 @@ module Pod ...@@ -317,18 +316,19 @@ module Pod
end end
target_mismatches = [] target_mismatches = []
check_prop = lambda do |target_definition1, target_definition2, attr, msg|
attr1 = target_definition1.send(attr)
attr2 = target_definition2.send(attr)
if attr1 != attr2
target_mismatches << "- #{target_definition1.name} (#{attr1}) and #{target_definition2.name} (#{attr2}) #{msg}."
end
end
host_uuid_to_embedded_target_definitions.each do |uuid, target_definitions| host_uuid_to_embedded_target_definitions.each do |uuid, target_definitions|
host_target_definition = target_definitions_by_uuid[uuid] host_target_definition = target_definitions_by_uuid[uuid]
target_definitions.each do |target_definition| target_definitions.each do |target_definition|
if target_definition.platform != host_target_definition.platform check_prop.call(host_target_definition, target_definition, :platform, 'do not use the same platform')
target_mismatches << "- #{target_definition.name} (#{target_definition.platform}) and #{host_target_definition.name} (#{host_target_definition.platform}) do not use the same platform." check_prop.call(host_target_definition, target_definition, :uses_frameworks?, 'do not both set use_frameworks!')
end check_prop.call(host_target_definition, target_definition, :swift_version, 'do not both use the same Swift version')
if target_definition.uses_frameworks? != host_target_definition.uses_frameworks?
target_mismatches << "- #{target_definition.name} (#{target_definition.uses_framworks?}) and #{host_target_definition.name} (#{host_target_definition.uses_frameworks?}) do not both set use_frameworks!."
end
if target_definition.swift_version != host_target_definition.swift_version
target_mismatches << "- #{target_definition.name} (#{target_definition.swift_version}) and #{host_target_definition.name} (#{host_target_definition.swift_version}) do not both use the same Swift version."
end
end end
end end
......
...@@ -783,7 +783,7 @@ module Pod ...@@ -783,7 +783,7 @@ module Pod
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
should.raise Informative do should.raise Informative do
analyzer.analyze analyzer.analyze
end.message.should.match /Pods-Sample Extensions Project must call use_frameworks! because it is hosting an embedded target that calls use_frameworks!/ end.message.should.match /Sample Extensions Project \(false\) and Today Extension \(true\) do not both set use_frameworks!\./
end end
end end
......
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