Commit ff27eacf authored by Kevin Coleman's avatar Kevin Coleman

Recursively processes dependent frameworks to ensure all vendored frameworks are…

Recursively processes dependent frameworks to ensure all vendored frameworks are added to the targets xcconfig
parent 05eea37a
......@@ -43,7 +43,6 @@ module Pod
target_search_paths = target.build_headers.search_paths(target.platform)
sandbox_search_paths = target.sandbox.public_headers.search_paths(target.platform)
search_paths = target_search_paths.concat(sandbox_search_paths).uniq
framework_search_paths = target.dependent_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks).map { |fw| '${PODS_ROOT}/' << fw.dirname.relative_path_from(target.sandbox.root).to_s }
config = {
'OTHER_LDFLAGS' => XCConfigHelper.default_ld_flags(target),
......@@ -51,7 +50,7 @@ module Pod
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(search_paths),
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'SKIP_INSTALL' => 'YES',
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ' << XCConfigHelper.quote(framework_search_paths)
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) '
# 'USE_HEADERMAP' => 'NO'
}
......
......@@ -50,6 +50,14 @@ module Pod
# The xcconfig to edit.
#
def self.add_settings_for_file_accessors_of_target(target, xcconfig)
# Recursively process all dependent targets to ensure dependency vendored
# frameworks and libraries are added to OTHER_LDFLAGS and FRAMEWORK_SEARCH_PATHS.
if target.host_requires_frameworks?
target.dependent_targets.each do |dependent_target|
add_settings_for_file_accessors_of_target(dependent_target, xcconfig)
end
end
target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig)
file_accessor.vendored_frameworks.each do |vendored_framework|
......@@ -91,7 +99,7 @@ module Pod
#
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root)
name = File.basename(framework_path, '.framework')
dirname = '$(PODS_ROOT)/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
dirname = '${PODS_ROOT}/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-framework #{name}",
'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
......@@ -113,7 +121,7 @@ module Pod
#
def self.add_library_build_settings(library_path, xcconfig, sandbox_root)
name = File.basename(library_path, '.a').sub(/\Alib/, '')
dirname = '$(PODS_ROOT)/' + library_path.dirname.relative_path_from(sandbox_root).to_s
dirname = '${PODS_ROOT}/' + library_path.dirname.relative_path_from(sandbox_root).to_s
build_settings = {
'OTHER_LDFLAGS' => "-l#{name}",
'LIBRARY_SEARCH_PATHS' => '$(inherited) ' + quote([dirname]),
......
......@@ -8,5 +8,6 @@ Pod::Spec.new do |s|
s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s }
s.license = 'MIT'
s.vendored_library = 'monkey.a'
#s.ios.vendored_framework = "monkey.framework"
s.public_header_files = 'monkey.h'
end
......@@ -6,8 +6,15 @@ module Pod
describe PodXCConfig do
describe 'in general' do
before do
@monkey_spec = fixture_spec('monkey/monkey.podspec')
@monkey_spec.vendored_framework = 'monkey.framework'
@monkey_pod_target = fixture_pod_target(@monkey_spec)
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@pod_target = fixture_pod_target(@spec)
@pod_target.dependent_targets = [@monkey_pod_target]
@pod_target.host_requires_frameworks = true
@consumer = @pod_target.spec_consumers.first
@podfile = @pod_target.podfile
@generator = PodXCConfig.new(@pod_target)
......@@ -18,8 +25,6 @@ module Pod
@spec.weak_frameworks = ['iAd']
@spec.libraries = ['xml2']
file_accessors = [Sandbox::FileAccessor.new(fixture('banana-lib'), @consumer)]
# vendored_framework_paths = [config.sandbox.root + 'BananaLib/BananaLib.framework']
# Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks).returns(vendored_framework_paths)
@pod_target.stubs(:file_accessors).returns(file_accessors)
......@@ -47,6 +52,10 @@ module Pod
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework "iAd"')
end
it 'includes the vendored dynamic frameworks for dependecy pods of the specification' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "monkey"')
end
it 'does not configure the project to load all members that implement Objective-c classes or categories from the static library' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include '-ObjC'
end
......
......@@ -127,7 +127,7 @@ module Pod
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == '-framework "Parse"'
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"$(PODS_ROOT)/Parse"'
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/Parse"'
end
it "doesn't override existing linker flags" do
......@@ -143,7 +143,7 @@ module Pod
xcconfig = Xcodeproj::Config.new('FRAMEWORK_SEARCH_PATHS' => '"path/to/frameworks"')
@sut.add_framework_build_settings(framework_path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"path/to/frameworks" "$(PODS_ROOT)/Parse"'
hash_config['FRAMEWORK_SEARCH_PATHS'].should == '"path/to/frameworks" "${PODS_ROOT}/Parse"'
end
end
......@@ -156,7 +156,7 @@ module Pod
@sut.add_library_build_settings(path, xcconfig, config.sandbox.root)
hash_config = xcconfig.to_hash
hash_config['OTHER_LDFLAGS'].should == '-l"Proj4"'
hash_config['LIBRARY_SEARCH_PATHS'].should == '$(inherited) "$(PODS_ROOT)/MapBox/Proj4"'
hash_config['LIBRARY_SEARCH_PATHS'].should == '$(inherited) "${PODS_ROOT}/MapBox/Proj4"'
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