Commit 9765ffa0 authored by Luke Redpath's avatar Luke Redpath

Ensure all header search paths are quoted in the xcconfig file.

Started adding some specs for the target installer, including for this fix.
parent e5ea947d
......@@ -13,7 +13,6 @@ module Pod
@xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found.
'PODS_ROOT' => '$(SRCROOT)/Pods',
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers"',
'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
# This makes categories from static libraries work, which many libraries
# require, so we add these by default.
......@@ -68,10 +67,12 @@ module Pod
pods.each do |pod|
xcconfig.merge!(pod.specification.xcconfig)
pod.add_to_target(@target)
# TODO: this doesn't need to be done here, it has nothing to do with the target
pod.link_headers
end
xcconfig.merge!('HEADER_SEARCH_PATHS' => sandbox.header_search_paths.join(" "))
xcconfig.merge!('HEADER_SEARCH_PATHS' => quoted(sandbox.header_search_paths).join(" "))
support_files_group = @project.group("Targets Support Files").create_group(@target_definition.lib_name)
support_files_group.add_file_paths(target_support_files)
......@@ -105,6 +106,12 @@ module Pod
puts "* Generating copy resources script at `#{sandbox.root + copy_resources_filename}'" if config.verbose?
copy_resources_script_for(pods).save_as(sandbox.root + copy_resources_filename)
end
private
def quoted(strings)
strings.map { |s| "\"#{s}\"" }
end
end
end
end
......
......@@ -4,9 +4,11 @@ module Pod
class Sandbox
attr_reader :root
HEADERS_DIR = "Headers"
def initialize(path)
@root = Pathname.new(path)
@header_search_paths = []
@header_search_paths = [HEADERS_DIR]
FileUtils.mkdir_p(@root)
end
......@@ -16,7 +18,7 @@ module Pod
end
def headers_root
root + "Headers"
root + HEADERS_DIR
end
def project_path
......
require File.expand_path('../../spec_helper', __FILE__)
describe Pod::ProjectIntegration do
describe Pod::ProjectIntegration do
before do
@sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
Pod::ProjectIntegration.integrate_with_project(@sample_project_path)
......
......@@ -65,7 +65,11 @@ describe Pod::Sandbox do
File.open(@sandbox.root + path, "w") { |file| file.write('hello') }
end
@sandbox.add_header_files(namespace_path, relative_header_paths)
@sandbox.header_search_paths.should == ["$(PODS_ROOT)/Headers/ExampleLib"]
@sandbox.header_search_paths.should.include("$(PODS_ROOT)/Headers/ExampleLib")
end
it 'always adds the Headers root to the header search paths' do
@sandbox.header_search_paths.should.include("$(PODS_ROOT)/Headers")
end
it 'clears out its headers root when preparing for install' do
......
require File.expand_path('../../spec_helper', __FILE__)
TMP_POD_ROOT = ROOT + "tmp" + "podroot"
describe Pod::Installer::TargetInstaller do
before do
@target_definition = stub('target', :lib_name => "FooLib")
platform = Pod::Platform.new(:ios)
@podfile = stub('podfile', :platform => platform, :generate_bridge_support? => false)
@project = Pod::Project.for_platform(platform)
@project.main_group.groups.new('name' => 'Targets Support Files')
@installer = Pod::Installer::TargetInstaller.new(@podfile, @project, @target_definition)
@sandbox = Pod::Sandbox.new(TMP_POD_ROOT)
@specification = fixture_spec('banana-lib/BananaLib.podspec')
@pods = [Pod::LocalPod.new(@specification, @sandbox)]
end
def do_install!
@installer.install!(@pods, @sandbox)
end
it 'adds a new static library target to the project' do
do_install!
@project.targets.count.should == 1
@project.targets.first.name.should == "FooLib"
end
it 'adds each pod to the static library target' do
@pods[0].expects(:add_to_target).with(instance_of(Xcodeproj::Project::Object::PBXNativeTarget))
do_install!
end
it 'tells each pod to link its headers' do
@pods[0].expects(:link_headers)
do_install!
end
it 'adds the sandbox header search paths to the xcconfig, with quotes' do
do_install!
@installer.xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include("\"#{@sandbox.header_search_paths.join(" ")}\"")
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