Do not include settings from file accessors of test specs into aggregate xcconfigs

parent a75a2e85
...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Do not include settings from file accessors of test specs into aggregate xcconfigs
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7019](https://github.com/CocoaPods/CocoaPods/pull/7019)
* Perform code signing on xctest bundles in the Pods project generated by a test spec * Perform code signing on xctest bundles in the Pods project generated by a test spec
[Justin Martin](https://github.com/justinseanmartin) [Justin Martin](https://github.com/justinseanmartin)
[#7013](https://github.com/CocoaPods/CocoaPods/pull/7013) [#7013](https://github.com/CocoaPods/CocoaPods/pull/7013)
......
...@@ -76,13 +76,15 @@ module Pod ...@@ -76,13 +76,15 @@ module Pod
# #
def self.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig) def self.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
pod_target.file_accessors.each do |file_accessor| pod_target.file_accessors.each do |file_accessor|
if aggregate_target.nil? || !file_accessor.spec.test_specification?
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(aggregate_target, pod_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(pod_target, xcconfig) end
XCConfigHelper.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig)
if pod_target.requires_frameworks? if pod_target.requires_frameworks?
pod_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(aggregate_target, dependent_target, xcconfig)
end end
end end
end end
...@@ -104,6 +106,7 @@ module Pod ...@@ -104,6 +106,7 @@ module Pod
# @return [void] # @return [void]
# #
def self.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor) def self.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
if aggregate_target.nil? || !file_accessor.spec.test_specification?
file_accessor.vendored_static_frameworks.each do |vendored_static_framework| file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target) adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root, adds_other_ldflags) XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
...@@ -113,6 +116,7 @@ module Pod ...@@ -113,6 +116,7 @@ module Pod
XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root, adds_other_ldflags) XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
end end
end end
end
# @param [AggregateTarget] aggregate_target # @param [AggregateTarget] aggregate_target
# The aggregate target, may be nil. # The aggregate target, may be nil.
...@@ -132,6 +136,9 @@ module Pod ...@@ -132,6 +136,9 @@ module Pod
# Adds build settings for dynamic vendored frameworks and libraries. # Adds build settings for dynamic vendored frameworks and libraries.
# #
# @param [AggregateTarget] aggregate_target
# The aggregate target, may be nil.
#
# @param [PodTarget] pod_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+.
# #
...@@ -140,8 +147,9 @@ module Pod ...@@ -140,8 +147,9 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.add_dynamic_dependency_build_settings(pod_target, xcconfig) def self.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig)
pod_target.file_accessors.each do |file_accessor| pod_target.file_accessors.each do |file_accessor|
if aggregate_target.nil? || !file_accessor.spec.test_specification?
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, pod_target.sandbox.root) XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root)
end end
...@@ -150,6 +158,7 @@ module Pod ...@@ -150,6 +158,7 @@ module Pod
end end
end end
end end
end
# Configures the given Xcconfig according to the build settings of the # Configures the given Xcconfig according to the build settings of the
# given Specification. # given Specification.
......
...@@ -241,6 +241,93 @@ module Pod ...@@ -241,6 +241,93 @@ module Pod
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
describe 'concerning settings for file accessors' do
it 'does not propagate framework or libraries from a test specification to an aggregate target' do
spec = stub(:test_specification? => true)
consumer = stub(
:libraries => ['xml2'],
:frameworks => ['XCTest'],
:weak_frameworks => [],
:spec => spec,
)
file_accessor = stub(
:spec => spec,
:spec_consumer => consumer,
:vendored_static_frameworks => [config.sandbox.root + 'StaticFramework.framework'],
:vendored_static_libraries => [config.sandbox.root + 'StaticLibrary.a'],
:vendored_dynamic_frameworks => [config.sandbox.root + 'VendoredFramework.framework'],
:vendored_dynamic_libraries => [config.sandbox.root + 'VendoredDyld.dyld'],
)
pod_target = stub(
:file_accessors => [file_accessor],
:requires_frameworks? => true,
:dependent_targets => [],
:sandbox => config.sandbox,
)
target_definition = stub(:inheritance => 'complete')
aggregate_target = stub(:target_definition => target_definition)
xcconfig = Xcodeproj::Config.new
@sut.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should.be.nil
end
it 'does propagate framework or libraries from a non test specification to an aggregate target' do
spec = stub(:test_specification? => false)
consumer = stub(
:libraries => ['xml2'],
:frameworks => ['XCTest'],
:weak_frameworks => [],
:spec => spec,
)
file_accessor = stub(
:spec => spec,
:spec_consumer => consumer,
:vendored_static_frameworks => [config.sandbox.root + 'StaticFramework.framework'],
:vendored_static_libraries => [config.sandbox.root + 'StaticLibrary.a'],
:vendored_dynamic_frameworks => [config.sandbox.root + 'VendoredFramework.framework'],
:vendored_dynamic_libraries => [config.sandbox.root + 'VendoredDyld.dyld'],
)
pod_target = stub(
:file_accessors => [file_accessor],
:requires_frameworks? => true,
:dependent_targets => [],
:sandbox => config.sandbox,
)
target_definition = stub(:inheritance => 'complete')
aggregate_target = stub(:target_definition => target_definition)
xcconfig = Xcodeproj::Config.new
@sut.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should.be == '-l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest"'
end
it 'does propagate framework or libraries to a nil aggregate target' do
spec = stub(:test_specification? => false)
consumer = stub(
:libraries => ['xml2'],
:frameworks => ['XCTest'],
:weak_frameworks => [],
:spec => spec,
)
file_accessor = stub(
:spec => spec,
:spec_consumer => consumer,
:vendored_static_frameworks => [config.sandbox.root + 'StaticFramework.framework'],
:vendored_static_libraries => [config.sandbox.root + 'StaticLibrary.a'],
:vendored_dynamic_frameworks => [config.sandbox.root + 'VendoredFramework.framework'],
:vendored_dynamic_libraries => [config.sandbox.root + 'VendoredDyld.dyld'],
)
pod_target = stub(
:file_accessors => [file_accessor],
:requires_frameworks? => true,
:dependent_targets => [],
:sandbox => config.sandbox,
)
xcconfig = Xcodeproj::Config.new
@sut.add_settings_for_file_accessors_of_target(nil, pod_target, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should.be == '-l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework" -framework "XCTest"'
end
end
describe 'for proper other ld flags' do describe 'for proper other ld flags' do
before do before do
@root = fixture('banana-lib') @root = fixture('banana-lib')
......
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