Commit de9080e8 authored by Boris Bügling's avatar Boris Bügling

Merge pull request #4341 from layerhq/coleman-vendored-static-linking-patch

[XCConfig Helper] Only link dynamic vendored frameworks and libraries
parents 4af70740 ae8ca750
...@@ -52,11 +52,12 @@ module Pod ...@@ -52,11 +52,12 @@ module Pod
def self.add_settings_for_file_accessors_of_target(target, xcconfig) def self.add_settings_for_file_accessors_of_target(target, xcconfig)
target.file_accessors.each do |file_accessor| target.file_accessors.each do |file_accessor|
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig) XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig)
XCConfigHelper.add_static_dependency_build_settings(target, xcconfig, file_accessor)
end end
XCConfigHelper.add_vendored_dependency_build_settings(target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(target, xcconfig)
end end
# Adds build settings for vendored frameworks and libraries. # Adds build settings for static vendored frameworks and libraries.
# #
# @param [PodTarget] target # @param [PodTarget] target
# The pod target, which holds the list of +Spec::FileAccessor+. # The pod target, which holds the list of +Spec::FileAccessor+.
...@@ -64,19 +65,39 @@ module Pod ...@@ -64,19 +65,39 @@ module Pod
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit. # The xcconfig to edit.
# #
def self.add_vendored_dependency_build_settings(target, xcconfig) # @param [Spec::FileAccessor] file_accessor
# The file accessor, which holds the list of static frameworks.
#
def self.add_static_dependency_build_settings(target, xcconfig, file_accessor)
file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, target.sandbox.root)
end
file_accessor.vendored_static_libraries.each do |vendored_static_library|
XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, target.sandbox.root)
end
end
# Adds build settings for dynamic vendored frameworks and libraries.
#
# @param [PodTarget] target
# The pod target, which holds the list of +Spec::FileAccessor+.
#
# @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit.
#
def self.add_dynamic_dependency_build_settings(target, xcconfig)
if target.requires_frameworks? if target.requires_frameworks?
target.dependent_targets.each do |dependent_target| target.dependent_targets.each do |dependent_target|
XCConfigHelper.add_vendored_dependency_build_settings(dependent_target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(dependent_target, xcconfig)
end end
end end
target.file_accessors.each do |file_accessor| target.file_accessors.each do |file_accessor|
file_accessor.vendored_frameworks.each do |vendored_framework| file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
XCConfigHelper.add_framework_build_settings(vendored_framework, xcconfig, target.sandbox.root) XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, target.sandbox.root)
end end
file_accessor.vendored_libraries.each do |vendored_library| file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library|
XCConfigHelper.add_library_build_settings(vendored_library, xcconfig, target.sandbox.root) XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, target.sandbox.root)
end end
end end
end end
......
...@@ -7,6 +7,8 @@ Pod::Spec.new do |s| ...@@ -7,6 +7,8 @@ Pod::Spec.new do |s|
s.homepage = "http://httpbin.org/html" s.homepage = "http://httpbin.org/html"
s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s } s.source = { :git => "http://monkey.local/monkey.git", :tag => s.version.to_s }
s.license = 'MIT' s.license = 'MIT'
s.vendored_framework = 'dynamic-monkey.framework'
s.vendored_library = 'monkey.a' s.vendored_library = 'monkey.a'
s.public_header_files = 'monkey.h' s.public_header_files = 'monkey.h'
end end
...@@ -157,8 +157,8 @@ module Pod ...@@ -157,8 +157,8 @@ module Pod
fixture_spec('monkey/monkey.podspec') fixture_spec('monkey/monkey.podspec')
end end
it 'does not add the framework build path to the xcconfig' do it 'does add the framework build path to the xcconfig' do
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.be.nil @xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.be.nil
end end
it 'configures the project to load all members that implement Objective-c classes or categories' do it 'configures the project to load all members that implement Objective-c classes or categories' do
......
...@@ -7,7 +7,6 @@ module Pod ...@@ -7,7 +7,6 @@ module Pod
describe 'in general' do describe 'in general' do
before do before do
@monkey_spec = fixture_spec('monkey/monkey.podspec') @monkey_spec = fixture_spec('monkey/monkey.podspec')
@monkey_spec.vendored_framework = 'monkey.framework'
@monkey_pod_target = fixture_pod_target(@monkey_spec) @monkey_pod_target = fixture_pod_target(@monkey_spec)
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
...@@ -53,7 +52,11 @@ module Pod ...@@ -53,7 +52,11 @@ module Pod
end end
it 'includes the vendored dynamic frameworks for dependecy pods of the specification' do it 'includes the vendored dynamic frameworks for dependecy pods of the specification' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "monkey"') @xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "dynamic-monkey"')
end
it 'does not include vendored static frameworks for dependecy pods of the specification' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-l"monkey.a"')
end end
it 'does not configure the project to load all members that implement Objective-c classes or categories from the static library' do it 'does not configure the project to load all members that implement Objective-c classes or categories from the static library' 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