Commit e2819ac3 authored by Luke Redpath's avatar Luke Redpath

TargetInstaller no longer needs access to #build_specifications

parent a751ba23
...@@ -2,29 +2,14 @@ module Pod ...@@ -2,29 +2,14 @@ module Pod
class Installer class Installer
autoload :TargetInstaller, 'cocoapods/installer/target_installer' autoload :TargetInstaller, 'cocoapods/installer/target_installer'
module Shared
def dependent_specifications
@dependent_specifications ||= Resolver.new(@podfile, @definition ? @definition.dependencies : nil).resolve
end
def build_specifications
dependent_specifications.reject do |spec|
spec.wrapper? || spec.defined_in_set.only_part_of_other_pod?
end
end
def download_only_specifications
dependent_specifications - build_specifications
end
end
include Config::Mixin include Config::Mixin
include Shared
attr_reader :sandbox attr_reader :sandbox
def initialize(podfile) def initialize(podfile)
@podfile = podfile @podfile = podfile
# FIXME: pass this into the installer as a parameter
@sandbox = Sandbox.new(config.project_pods_root) @sandbox = Sandbox.new(config.project_pods_root)
end end
...@@ -189,5 +174,19 @@ module Pod ...@@ -189,5 +174,19 @@ module Pod
puts "[!] From now on use `#{File.basename(xcworkspace)}' instead of `#{File.basename(projpath)}'." puts "[!] From now on use `#{File.basename(xcworkspace)}' instead of `#{File.basename(projpath)}'."
end end
end end
def dependent_specifications
@dependent_specifications ||= Resolver.new(@podfile, @definition ? @definition.dependencies : nil).resolve
end
def build_specifications
dependent_specifications.reject do |spec|
spec.wrapper? || spec.defined_in_set.only_part_of_other_pod?
end
end
def download_only_specifications
dependent_specifications - build_specifications
end
end end
end end
...@@ -2,7 +2,6 @@ module Pod ...@@ -2,7 +2,6 @@ module Pod
class Installer class Installer
class TargetInstaller class TargetInstaller
include Config::Mixin include Config::Mixin
include Shared
attr_reader :podfile, :project, :target_definition, :target attr_reader :podfile, :project, :target_definition, :target
...@@ -34,11 +33,9 @@ module Pod ...@@ -34,11 +33,9 @@ module Pod
"#{@target_definition.lib_name}-resources.sh" "#{@target_definition.lib_name}-resources.sh"
end end
def bridge_support_generator def bridge_support_generator_for(pods, sandbox)
Generator::BridgeSupport.new(build_specifications.map do |spec| Generator::BridgeSupport.new(pods.map do |pod|
spec.header_files.map do |header| pod.header_files.map { |header| sandbox.root + header }
config.project_pods_root + header
end
end.flatten) end.flatten)
end end
...@@ -98,7 +95,7 @@ module Pod ...@@ -98,7 +95,7 @@ module Pod
if @podfile.generate_bridge_support? if @podfile.generate_bridge_support?
bridge_support_metadata_path = sandbox.root + bridge_support_filename bridge_support_metadata_path = sandbox.root + bridge_support_filename
puts "* Generating BridgeSupport metadata file at `#{bridge_support_metadata_path}'" if config.verbose? puts "* Generating BridgeSupport metadata file at `#{bridge_support_metadata_path}'" if config.verbose?
bridge_support_generator.save_as(bridge_support_metadata_path) bridge_support_generator_for(pods, sandbox).save_as(bridge_support_metadata_path)
copy_resources_script_for(pods).resources << bridge_support_filename copy_resources_script_for(pods).resources << bridge_support_filename
end end
puts "* Generating xcconfig file at `#{sandbox.root + xcconfig_filename}'" if config.verbose? puts "* Generating xcconfig file at `#{sandbox.root + xcconfig_filename}'" if config.verbose?
......
...@@ -39,12 +39,13 @@ describe "Pod::Installer" do ...@@ -39,12 +39,13 @@ describe "Pod::Installer" do
config.rootspec = podfile config.rootspec = podfile
expected = [] expected = []
installer = Pod::Installer.new(podfile) installer = Pod::Installer.new(podfile)
installer.build_specifications.each do |spec| pods = installer.build_specifications.map do |spec|
spec.header_files.each do |header| spec.header_files.each do |header|
expected << config.project_pods_root + header expected << config.project_pods_root + header
end end
Pod::LocalPod.new(spec, installer.sandbox)
end end
installer.target_installers.first.bridge_support_generator.headers.should == expected installer.target_installers.first.bridge_support_generator_for(pods, installer.sandbox).headers.should == expected
end end
it "omits empty target definitions" do it "omits empty target definitions" do
......
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