Do not link static frameworks to targets that use `inherit! search_paths`

parent 9e7c3c2e
...@@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* None. * Do not link static frameworks to targets that use `inherit! search_paths`.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6065](https://github.com/CocoaPods/CocoaPods/issues/6065)
## 1.2.0.rc.1 (2017-01-13) ## 1.2.0.rc.1 (2017-01-13)
......
...@@ -185,7 +185,7 @@ module Pod ...@@ -185,7 +185,7 @@ module Pod
targets.each do |pod_target| targets.each do |pod_target|
unless pod_target.should_build? && pod_target.requires_frameworks? unless pod_target.should_build? && pod_target.requires_frameworks?
XCConfigHelper.add_settings_for_file_accessors_of_target(pod_target, @xcconfig) XCConfigHelper.add_settings_for_file_accessors_of_target(target, pod_target, @xcconfig)
end end
end end
end end
......
...@@ -59,7 +59,7 @@ module Pod ...@@ -59,7 +59,7 @@ module Pod
@xcconfig = Xcodeproj::Config.new(config) @xcconfig = Xcodeproj::Config.new(config)
XCConfigHelper.add_settings_for_file_accessors_of_target(target, @xcconfig) XCConfigHelper.add_settings_for_file_accessors_of_target(nil, target, @xcconfig)
target.file_accessors.each do |file_accessor| target.file_accessors.each do |file_accessor|
@xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig) @xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig)
end end
......
...@@ -61,7 +61,10 @@ module Pod ...@@ -61,7 +61,10 @@ module Pod
# Configures the given Xcconfig # Configures the given Xcconfig
# #
# @param [PodTarget] target # @param [AggregateTarget] aggregate_target
# The aggregate target, may be nil.
#
# @param [PodTarget] pod_target
# The pod target, which holds the list of +Spec::FileAccessor+. # The pod target, which holds the list of +Spec::FileAccessor+.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
...@@ -69,14 +72,14 @@ module Pod ...@@ -69,14 +72,14 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.add_settings_for_file_accessors_of_target(target, xcconfig) def self.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
target.file_accessors.each do |file_accessor| pod_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) XCConfigHelper.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
end end
XCConfigHelper.add_dynamic_dependency_build_settings(target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(pod_target, xcconfig)
if target.requires_frameworks? if pod_target.requires_frameworks?
target.dependent_targets.each do |dependent_target| pod_target.dependent_targets.each do |dependent_target|
XCConfigHelper.add_dynamic_dependency_build_settings(dependent_target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(dependent_target, xcconfig)
end end
end end
...@@ -84,7 +87,10 @@ module Pod ...@@ -84,7 +87,10 @@ module Pod
# Adds build settings for static vendored frameworks and libraries. # Adds build settings for static vendored frameworks and libraries.
# #
# @param [PodTarget] target # @param [AggregateTarget] aggregate_target
# The aggregate target, may be nil.
#
# @param [PodTarget] pod_target
# The pod target, which holds the list of +Spec::FileAccessor+. # The pod target, which holds the list of +Spec::FileAccessor+.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
...@@ -95,18 +101,20 @@ module Pod ...@@ -95,18 +101,20 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.add_static_dependency_build_settings(target, xcconfig, file_accessor) def self.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
file_accessor.vendored_static_frameworks.each do |vendored_static_framework| file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, target.sandbox.root) if aggregate_target.nil? || aggregate_target.target_definition.inheritance != 'search_paths'
XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root)
end
end end
file_accessor.vendored_static_libraries.each do |vendored_static_library| file_accessor.vendored_static_libraries.each do |vendored_static_library|
XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, target.sandbox.root) XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root)
end end
end end
# Adds build settings for dynamic vendored frameworks and libraries. # Adds build settings for dynamic vendored frameworks and libraries.
# #
# @param [PodTarget] target # @param [PodTarget] pod_target
# The pod target, which holds the list of +Spec::FileAccessor+. # The pod target, which holds the list of +Spec::FileAccessor+.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
...@@ -114,13 +122,13 @@ module Pod ...@@ -114,13 +122,13 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.add_dynamic_dependency_build_settings(target, xcconfig) def self.add_dynamic_dependency_build_settings(pod_target, xcconfig)
target.file_accessors.each do |file_accessor| pod_target.file_accessors.each do |file_accessor|
file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework| file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, target.sandbox.root) XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root)
end end
file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library| file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library|
XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, target.sandbox.root) XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, pod_target.sandbox.root)
end end
end end
end end
......
...@@ -222,6 +222,43 @@ module Pod ...@@ -222,6 +222,43 @@ module Pod
end end
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
describe 'for proper other ld flags' do
before do
@root = fixture('banana-lib')
@path_list = Sandbox::PathList.new(@root)
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@spec_consumer = @spec.consumer(:ios)
@accessor = Pod::Sandbox::FileAccessor.new(@path_list, @spec_consumer)
end
it 'should not include static framework other ld flags when inheriting search paths' do
target_definition = stub(:inheritance => 'search_paths')
aggregate_target = stub(:target_definition => target_definition)
pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib"'
end
it 'should include static framework other ld flags when not inheriting search paths' do
target_definition = stub(:inheritance => 'complete')
aggregate_target = stub(:target_definition => target_definition)
pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"'
end
it 'should include static framework for pod targets' do
pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(nil, pod_target, xcconfig, @accessor)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"'
end
end
#---------------------------------------------------------------------#
end end
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