Commit f0bc0a3f authored by Luke Redpath's avatar Luke Redpath

Continue to refactor TargetInstaller.

parent 8390e00b
Subproject commit ea0ac9953d8ad7da4f35f0e452a68ecf7ef5938e Subproject commit fc2a3c0152605451a67e9ee5f69ea244fd624a68
...@@ -4,10 +4,10 @@ module Pod ...@@ -4,10 +4,10 @@ module Pod
include Config::Mixin include Config::Mixin
include Shared include Shared
attr_reader :podfile, :project, :definition, :target attr_reader :podfile, :project, :target_definition, :target
def initialize(podfile, project, definition) def initialize(podfile, project, target_definition)
@podfile, @project, @definition = podfile, project, definition @podfile, @project, @target_definition = podfile, project, target_definition
end end
def xcconfig def xcconfig
...@@ -23,7 +23,7 @@ module Pod ...@@ -23,7 +23,7 @@ module Pod
end end
def xcconfig_filename def xcconfig_filename
"#{@definition.lib_name}.xcconfig" "#{@target_definition.lib_name}.xcconfig"
end end
def copy_resources_script_for(pods) def copy_resources_script_for(pods)
...@@ -31,7 +31,7 @@ module Pod ...@@ -31,7 +31,7 @@ module Pod
end end
def copy_resources_filename def copy_resources_filename
"#{@definition.lib_name}-resources.sh" "#{@target_definition.lib_name}-resources.sh"
end end
def bridge_support_generator def bridge_support_generator
...@@ -43,7 +43,7 @@ module Pod ...@@ -43,7 +43,7 @@ module Pod
end end
def bridge_support_filename def bridge_support_filename
"#{@definition.lib_name}.bridgesupport" "#{@target_definition.lib_name}.bridgesupport"
end end
# TODO move out to Generator::PrefixHeader # TODO move out to Generator::PrefixHeader
...@@ -56,13 +56,17 @@ module Pod ...@@ -56,13 +56,17 @@ module Pod
end end
def prefix_header_filename def prefix_header_filename
"#{@definition.lib_name}-prefix.pch" "#{@target_definition.lib_name}-prefix.pch"
end
def target_support_files
[copy_resources_filename, prefix_header_filename, xcconfig_filename]
end end
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support. # TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
def install!(pods, sandbox) def install!(pods, sandbox)
# First add the target to the project # First add the target to the project
@target = @project.targets.new_static_library(@definition.lib_name) @target = @project.targets.new_static_library(@target_definition.lib_name)
pods.each do |pod| pods.each do |pod|
xcconfig.merge!(pod.specification.xcconfig) xcconfig.merge!(pod.specification.xcconfig)
...@@ -74,15 +78,16 @@ module Pod ...@@ -74,15 +78,16 @@ module Pod
# Add all the target related support files to the group, even the copy # Add all the target related support files to the group, even the copy
# resources script although the project doesn't actually use them. # resources script although the project doesn't actually use them.
support_files_group = @project.groups.find do |group| support_files_group = @project.groups.object_named("Targets Support Files")
group.name == "Targets Support Files" support_files_group = support_files_group.create_group(@target_definition.lib_name)
end.groups.new("name" => @definition.lib_name)
support_files_group.files.new('path' => copy_resources_filename) target_support_files.each do |file_path|
prefix_file = support_files_group.files.new('path' => prefix_header_filename) support_files_group.create_file(file_path)
xcconfig_file = support_files_group.files.new("path" => xcconfig_filename) end
# Assign the xcconfig as the base config of each config. # Assign the xcconfig as the base config of each config.
@target.buildConfigurations.each do |config| @target.buildConfigurations.each do |config|
xcconfig_file = support_files_group.file_with_path(xcconfig_filename)
config.baseConfiguration = xcconfig_file config.baseConfiguration = xcconfig_file
config.buildSettings['OTHER_LDFLAGS'] = '' config.buildSettings['OTHER_LDFLAGS'] = ''
config.buildSettings['GCC_PREFIX_HEADER'] = prefix_header_filename config.buildSettings['GCC_PREFIX_HEADER'] = prefix_header_filename
......
...@@ -56,6 +56,6 @@ describe "Pod::Installer" do ...@@ -56,6 +56,6 @@ describe "Pod::Installer" do
end end
config.rootspec = podfile config.rootspec = podfile
installer = Pod::Installer.new(podfile) installer = Pod::Installer.new(podfile)
installer.target_installers.map(&:definition).map(&:name).should == [:not_empty] installer.target_installers.map(&:target_definition).map(&:name).should == [:not_empty]
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