Commit 7811eafc authored by Marius Rackwitz's avatar Marius Rackwitz

Move PodTarget#host_requires_frameworks initialization into Installer

Because a PodTarget needs to know its #file_accessors to decide whether it has Swift sources.
parent 8bd3a2c5
......@@ -89,6 +89,7 @@ module Pod
prepare
resolve_dependencies
download_dependencies
determine_dependency_product_type
generate_pods_project
integrate_user_project if config.integrate_targets?
perform_post_install_actions
......@@ -311,6 +312,21 @@ module Pod
@pod_installers.each(&:clean!)
end
# Determines if the dependencies need to be built as dynamic frameworks or
# if they can be built as static libraries by checking for the Swift source
# presence. Therefore it is important that the file accessors of the
# #pod_targets are created.
#
# @return [void]
#
def determine_dependency_product_type
aggregate_targets.each do |aggregate_target|
aggregate_target.pod_targets.each do |pod_target|
pod_target.host_requires_frameworks |= aggregate_target.requires_frameworks?
end
end
end
# Performs any post-installation actions
#
# @return [void]
......
......@@ -221,12 +221,6 @@ module Pod
target.pod_targets = generate_pod_targets(target, specs)
# We can set host_requires_frameworks first, when the AggregateTarget
# does know all its PodTargets.
target.pod_targets.each do |pod_target|
pod_target.host_requires_frameworks |= target.requires_frameworks?
end
target
end
......
......@@ -50,6 +50,7 @@ module Pod
before do
@installer.stubs(:resolve_dependencies)
@installer.stubs(:download_dependencies)
@installer.stubs(:determine_dependency_product_type)
@installer.stubs(:generate_pods_project)
@installer.stubs(:integrate_user_project)
@installer.stubs(:run_plugins_post_install_hooks)
......@@ -114,6 +115,37 @@ module Pod
end
end
#-------------------------------------------------------------------------#
describe '#determine_dependency_product_type' do
it 'does propagate that frameworks are required to all pod targets' do
fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Pod::Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
end
lockfile = generate_lockfile
config.integrate_targets = false
@installer = Installer.new(config.sandbox, podfile, lockfile)
@installer.install!
target = @installer.aggregate_targets.first
target.requires_frameworks?.should == true
target.pod_targets.select(&:requires_frameworks?).map(&:name).sort.should == [
'Pods-BananaLib',
'Pods-OrangeFramework',
'Pods-monkey',
]
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