Commit 0ba1910e authored by Ben Asher's avatar Ben Asher

validate uniq symbol_type count instead of user_target count

parent cc804e3f
...@@ -238,8 +238,10 @@ module Pod ...@@ -238,8 +238,10 @@ module Pod
# #
def copy_extension_pod_targets_to_host(aggregate_target, extension_aggregate_targets) def copy_extension_pod_targets_to_host(aggregate_target, extension_aggregate_targets)
return if aggregate_target.requires_host_target? return if aggregate_target.requires_host_target?
# Get the uuids of the aggregate_target's user_target's extension targets if any # Get the uuids of the aggregate_target's user_targets' extension targets if any
extension_uuids = aggregate_target.user_project.extensions_for_native_target(aggregate_target.user_targets[0]).map(&:uuid) extension_uuids = aggregate_target.user_targets.map do |target|
aggregate_target.user_project.extensions_for_native_target(target).map(&:uuid)
end.flatten
return if extension_uuids.empty? return if extension_uuids.empty?
extension_aggregate_targets.each do |extension_target| extension_aggregate_targets.each do |extension_target|
next unless extension_uuids.include? extension_target.user_targets[0].uuid next unless extension_uuids.include? extension_target.user_targets[0].uuid
......
...@@ -37,8 +37,9 @@ module Pod ...@@ -37,8 +37,9 @@ module Pod
# for sure that this target refers to an extension # for sure that this target refers to an extension
# target that would require a host target # target that would require a host target
return false if user_project.nil? return false if user_project.nil?
raise ArgumentError, "Expected single user_target for #{name}" unless user_targets.count == 1 symbol_types = user_targets.map(&:symbol_type).uniq
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? user_targets[0].symbol_type raise ArgumentError, "Expected single kind of user_target for #{name}. Found #{symbol_types.join(', ')}." unless symbol_types.count == 1
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? symbol_types[0]
end end
# @return [String] the label for the target. # @return [String] the label for the target.
......
...@@ -230,11 +230,13 @@ module Pod ...@@ -230,11 +230,13 @@ module Pod
@target.requires_host_target?.should == false @target.requires_host_target?.should == false
end end
it 'raises an exception if more than one user_target is found' do it 'raises an exception if more than one kind of user_target is found' do
@target.user_target_uuids += @target.user_target_uuids @target.user_target_uuids << '51075D491521D0C100E39B41'
@target.user_targets.first.stubs(:symbol_type).returns(:app_extension)
@target.user_targets.last.stubs(:symbol_type).returns(:watch_extension)
should.raise ArgumentError do should.raise ArgumentError do
@target.requires_host_target? @target.requires_host_target?
end.message.should.equal 'Expected single user_target for Pods' end.message.should.equal 'Expected single kind of user_target for Pods. Found app_extension, watch_extension.'
end end
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