Commit 22ad8457 authored by Jeremy Slater's avatar Jeremy Slater

Move integration library linking outside of target integrator

The target integrator is only run when libraries are being integrated 
with user projects.  The Pods integration library needs to be 
updated, linked with the spec libraries, regardless of user 
project integration.
parent 8fb33174
...@@ -109,6 +109,7 @@ module Pod ...@@ -109,6 +109,7 @@ module Pod
prepare_pods_project prepare_pods_project
install_file_references install_file_references
install_libraries install_libraries
link_integration_libraries
run_post_install_hooks run_post_install_hooks
write_pod_project write_pod_project
write_lockfiles write_lockfiles
...@@ -322,6 +323,22 @@ module Pod ...@@ -322,6 +323,22 @@ module Pod
end end
end end
# Links the integration library targets with all the dependent libraries
#
# @note This is run in the integration step to ensure that targets
# have been created for all per spec libraries.
#
def link_integration_libraries
targets.each do |target|
native_target = pods_project.targets.select { |t| t.name == target.name }.first
products = pods_project.products_group
target.libraries.each do |library|
product = products.files.select { |f| f.path == library.product_name }.first
native_target.frameworks_build_phase.add_file_reference(product)
end
end
end
# Writes the Pods project to the disk. # Writes the Pods project to the disk.
# #
# @return [void] # @return [void]
......
...@@ -32,7 +32,7 @@ module Pod ...@@ -32,7 +32,7 @@ module Pod
add_pods_library add_pods_library
add_copy_resources_script_phase add_copy_resources_script_phase
add_check_manifest_lock_script_phase add_check_manifest_lock_script_phase
save_projects save_user_project
end end
end end
...@@ -126,13 +126,6 @@ module Pod ...@@ -126,13 +126,6 @@ module Pod
# @return [void] # @return [void]
# #
def add_pods_library def add_pods_library
native_target = pods_project.targets.select { |t| t.name == target.name }.first
products = pods_project.products_group
target.libraries.each do |library|
product = products.files.select { |f| f.path == library.product_name }.first
native_target.frameworks_build_phase.add_file_reference(product)
end
frameworks = user_project.frameworks_group frameworks = user_project.frameworks_group
native_targets.each do |native_target| native_targets.each do |native_target|
library = frameworks.files.select { |f| f.path == target.product_name }.first || library = frameworks.files.select { |f| f.path == target.product_name }.first ||
...@@ -191,9 +184,8 @@ module Pod ...@@ -191,9 +184,8 @@ module Pod
# #
# @return [void] # @return [void]
# #
def save_projects def save_user_project
user_project.save_as(target.user_project_path) user_project.save_as(target.user_project_path)
pods_project.save_as(target.sandbox.project_path)
end end
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
......
...@@ -62,6 +62,7 @@ module Pod ...@@ -62,6 +62,7 @@ module Pod
@installer.stubs(:run_pre_install_hooks) @installer.stubs(:run_pre_install_hooks)
@installer.stubs(:install_file_references) @installer.stubs(:install_file_references)
@installer.stubs(:install_libraries) @installer.stubs(:install_libraries)
@installer.stubs(:link_integration_libraries)
@installer.stubs(:write_lockfiles) @installer.stubs(:write_lockfiles)
@installer.unstub(:generate_pods_project) @installer.unstub(:generate_pods_project)
def @installer.run_post_install_hooks def @installer.run_post_install_hooks
...@@ -344,6 +345,27 @@ module Pod ...@@ -344,6 +345,27 @@ module Pod
describe "Integrating client projects" do describe "Integrating client projects" do
it "links the pod libraries with the integration library target" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
target_definition = Podfile::TargetDefinition.new('Pods', nil)
target = Target.new(target_definition, config.sandbox)
lib_definition = Podfile::TargetDefinition.new('BananaLib', nil)
lib_definition.store_pod('BananaLib')
library = Target.new(lib_definition, config.sandbox)
library.spec = spec
target.libraries = [library]
project = Xcodeproj::Project.new
pods_target = project.new_target(:static_library, target.name, :ios)
native_target = project.new_target(:static_library, library.name, :ios)
@installer.stubs(:pods_project).returns(project)
@installer.stubs(:targets).returns([target])
@installer.stubs(:libraries).returns([library])
@installer.send(:link_integration_libraries)
pods_target.frameworks_build_phase.files.map(&:display_name).should.include?(library.product_name)
end
it "integrates the client projects" do it "integrates the client projects" do
@installer.stubs(:libraries).returns([Target.new(nil, config.sandbox)]) @installer.stubs(:libraries).returns([Target.new(nil, config.sandbox)])
Installer::UserProjectIntegrator.any_instance.expects(:integrate!) Installer::UserProjectIntegrator.any_instance.expects(:integrate!)
......
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