Commit 2281ae50 authored by Samuel Giddins's avatar Samuel Giddins

Dont embed frameworks in extensions

parent 7a838899
......@@ -74,6 +74,7 @@ module Pod
@result.specifications = generate_specifications
@result.targets = generate_targets
@result.sandbox_state = generate_sandbox_state
verify_extension_bs
@result
end
......@@ -273,6 +274,7 @@ module Pod
target.pod_targets = pod_targets.select do |pod_target|
pod_target.target_definitions.include?(target_definition)
end
target.embedded_pod_targets = target.pod_targets
target
end
......@@ -692,6 +694,25 @@ module Pod
end
inspection_result
end
def verify_extension_bs
inspections = Hash(@result.target_inspections)
inspections.each do |td, inspection|
project = Xcodeproj::Project.open(inspection.project_path)
inspection.targets_to_embed_in.each do |native_target|
td_for_target, inspection_for_target = inspections.find { |_, i| i.project_target_uuids.include?(native_target.uuid) }
at_for_target = @result.targets.find { |at| at.target_definition == td_for_target }
next unless at_for_target
embedded_at = @result.targets.find { |at| at.target_definition == td }
at_for_target.embedded_pod_targets.push(*embedded_at.pod_targets)
pod_targets_by_name = at_for_target.embedded_pod_targets.group_by(&:pod_name)
pod_targets_by_name.each do |name, pt|
raise "duplicate, non-matching pod targets for #{name} in #{embedded_at.label}" if pt.size > 1
end
at_for_target.embedded_targets << embedded_at
end
end
end
end
end
end
......@@ -16,6 +16,10 @@ module Pod
#
attr_accessor :project_target_uuids
#
#
attr_accessor :targets_to_embed_in
# @return [Hash{String=>Symbol}] A hash representing the user build
# configurations where each key corresponds to the name of a
# configuration and its value to its type (`:debug` or
......
......@@ -43,6 +43,7 @@ module Pod
result.build_configurations = compute_build_configurations(targets)
result.platform = compute_platform(targets)
result.archs = compute_archs(targets)
result.targets_to_embed_in = compute_targets_to_embed_in(targets, user_project)
result.project = user_project
result
end
......@@ -170,6 +171,16 @@ module Pod
end.compact.uniq.sort
end
def compute_targets_to_embed_in(user_targets, user_project)
user_targets.flat_map do |target|
user_project.native_targets.select do |native_target|
native_target.copy_files_build_phases.any? do |phase|
phase.files_references.include?(target.product_reference)
end
end
end.uniq
end
# Checks if any of the targets for the {TargetDefinition} computed before
# by #compute_user_project_targets is recommended to be build as a framework
# due the presence of Swift source code in any of the source build phases.
......
......@@ -18,6 +18,7 @@ module Pod
@sandbox = sandbox
@pod_targets = []
@search_paths_aggregate_targets = []
@embedded_pod_targets = []
@file_accessors = []
@xcconfigs = {}
end
......@@ -109,6 +110,8 @@ module Pod
#
attr_accessor :search_paths_aggregate_targets
attr_accessor :embedded_pod_targets
# @param [String] build_configuration The build configuration for which the
# the pod targets should be returned.
#
......
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