Commit 01b69242 authored by Paul Beusterien's avatar Paul Beusterien

Fix static_framework Swift pod dependencies and implement pod access to…

Fix static_framework Swift pod dependencies and implement pod access to dependent vendored_framework modules
parent a6cf591c
...@@ -34,6 +34,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -34,6 +34,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7121](https://github.com/CocoaPods/CocoaPods/issues/7121) [#7121](https://github.com/CocoaPods/CocoaPods/issues/7121)
* Fix static_framework Swift pod dependencies and implement pod access to dependent vendored_framework modules
[Paul Beusterien](https://github.com/paulb777)
[#7117](https://github.com/CocoaPods/CocoaPods/issues/7117)
* Strip vendored dSYMs during embed script phase * Strip vendored dSYMs during embed script phase
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7111](https://github.com/CocoaPods/CocoaPods/issues/7111) [#7111](https://github.com/CocoaPods/CocoaPods/issues/7111)
......
...@@ -71,6 +71,7 @@ module Pod ...@@ -71,6 +71,7 @@ module Pod
XCConfigHelper.add_target_specific_settings(target, @xcconfig) XCConfigHelper.add_target_specific_settings(target, @xcconfig)
recursive_dependent_targets = target.recursive_dependent_targets recursive_dependent_targets = target.recursive_dependent_targets
@xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig) @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig)
XCConfigHelper.generate_vendored_build_settings(target, recursive_dependent_targets, @xcconfig, false) if target.requires_frameworks?
if @test_xcconfig if @test_xcconfig
test_dependent_targets = [target, *target.recursive_test_dependent_targets].uniq test_dependent_targets = [target, *target.recursive_test_dependent_targets].uniq
@xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig) @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
......
...@@ -63,8 +63,8 @@ module Pod ...@@ -63,8 +63,8 @@ module Pod
# Configures the given Xcconfig # Configures the given Xcconfig
# #
# @param [AggregateTarget] aggregate_target # @param [Target] target
# The aggregate target, may be nil. # The root 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+.
...@@ -72,27 +72,30 @@ module Pod ...@@ -72,27 +72,30 @@ module Pod
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit. # The xcconfig to edit.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @return [void] # @return [void]
# #
def self.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig) def self.add_settings_for_file_accessors_of_target(target, pod_target, xcconfig, include_ld_flags = true)
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? if 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) if include_ld_flags
XCConfigHelper.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor) XCConfigHelper.add_static_dependency_build_settings(target, pod_target, xcconfig, file_accessor, include_ld_flags)
end end
end end
XCConfigHelper.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags)
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(aggregate_target, dependent_target, xcconfig) XCConfigHelper.add_dynamic_dependency_build_settings(target, dependent_target, xcconfig, include_ld_flags)
end end
end end
end end
# Adds build settings for static vendored frameworks and libraries. # Adds build settings for static vendored frameworks and libraries.
# #
# @param [AggregateTarget] aggregate_target # @param [Target] target
# The aggregate target, may be nil. # The root 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+.
...@@ -103,16 +106,18 @@ module Pod ...@@ -103,16 +106,18 @@ module Pod
# @param [Spec::FileAccessor] file_accessor # @param [Spec::FileAccessor] file_accessor
# The file accessor, which holds the list of static frameworks. # The file accessor, which holds the list of static frameworks.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @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(target, pod_target, xcconfig, file_accessor, include_ld_flags)
if aggregate_target.nil? || !file_accessor.spec.test_specification? if target.nil? || !file_accessor.spec.test_specification?
adds_other_ldflags = include_ld_flags && XCConfigHelper.links_dependency?(target, pod_target)
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)
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)
end end
file_accessor.vendored_static_libraries.each do |vendored_static_library| file_accessor.vendored_static_libraries.each do |vendored_static_library|
adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
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
...@@ -136,8 +141,8 @@ module Pod ...@@ -136,8 +141,8 @@ module Pod
# Adds build settings for dynamic vendored frameworks and libraries. # Adds build settings for dynamic vendored frameworks and libraries.
# #
# @param [AggregateTarget] aggregate_target # @param [Target] target
# The aggregate target, may be nil. # The root 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+.
...@@ -145,16 +150,19 @@ module Pod ...@@ -145,16 +150,19 @@ module Pod
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit. # The xcconfig to edit.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @return [void] # @return [void]
# #
def self.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig) def self.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags)
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? if 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, include_ld_flags)
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, pod_target.sandbox.root) XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, pod_target.sandbox.root, include_ld_flags)
end end
end end
end end
...@@ -190,15 +198,18 @@ module Pod ...@@ -190,15 +198,18 @@ module Pod
# @param [Pathname] sandbox_root # @param [Pathname] sandbox_root
# The path retrieved from Sandbox#root. # The path retrieved from Sandbox#root.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @return [void] # @return [void]
# #
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root, include_other_ldflags = true) def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root, include_ld_flags = true)
name = File.basename(framework_path, '.framework') 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 = { build_settings = {
'FRAMEWORK_SEARCH_PATHS' => quote([dirname]), 'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
} }
build_settings['OTHER_LDFLAGS'] = "-framework #{name}" if include_other_ldflags build_settings['OTHER_LDFLAGS'] = "-framework #{name}" if include_ld_flags
xcconfig.merge!(build_settings) xcconfig.merge!(build_settings)
end end
...@@ -214,16 +225,19 @@ module Pod ...@@ -214,16 +225,19 @@ module Pod
# @param [Pathname] sandbox_root # @param [Pathname] sandbox_root
# The path retrieved from Sandbox#root. # The path retrieved from Sandbox#root.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @return [void] # @return [void]
# #
def self.add_library_build_settings(library_path, xcconfig, sandbox_root, include_other_ldflags = true) def self.add_library_build_settings(library_path, xcconfig, sandbox_root, include_ld_flags = true)
extension = File.extname(library_path) extension = File.extname(library_path)
name = File.basename(library_path, extension).sub(/\Alib/, '') name = File.basename(library_path, extension).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 = { build_settings = {
'LIBRARY_SEARCH_PATHS' => quote([dirname]), 'LIBRARY_SEARCH_PATHS' => quote([dirname]),
} }
build_settings['OTHER_LDFLAGS'] = "-l#{name}" if include_other_ldflags build_settings['OTHER_LDFLAGS'] = "-l#{name}" if include_ld_flags
xcconfig.merge!(build_settings) xcconfig.merge!(build_settings)
end end
...@@ -350,25 +364,28 @@ module Pod ...@@ -350,25 +364,28 @@ module Pod
# Add custom build settings and required build settings to link to # Add custom build settings and required build settings to link to
# vendored libraries and frameworks. # vendored libraries and frameworks.
# #
# @param [AggregateTarget] aggregate_target # @param [Target] target
# The aggregate target, may be nil. # The root target, may be nil.
# #
# @param [Array<PodTarget] pod_targets # @param [Array<PodTarget] dep_targets
# The pod targets to add the vendored build settings for. # The dependency targets to add the vendored build settings for.
# #
# @param [Xcodeproj::Config] xcconfig # @param [Xcodeproj::Config] xcconfig
# The xcconfig to edit. # The xcconfig to edit.
# #
# @param [Boolean] include_ld_flags
# Indicates whether or not to generate ld flags in addition to compile flags
#
# @note # @note
# In case of generated pod targets, which require frameworks, the # In case of generated pod targets, which require frameworks, the
# vendored frameworks and libraries are already linked statically # vendored frameworks and libraries are already linked statically
# into the framework binary and must not be linked again to the # into the framework binary and must not be linked again to the
# user target. # user target.
# #
def self.generate_vendored_build_settings(aggregate_target, pod_targets, xcconfig) def self.generate_vendored_build_settings(target, dep_targets, xcconfig, include_ld_flags = true)
pod_targets.each do |pod_target| dep_targets.each do |dep_target|
unless pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework? unless dep_target.should_build? && dep_target.requires_frameworks? && !dep_target.static_framework?
XCConfigHelper.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig) XCConfigHelper.add_settings_for_file_accessors_of_target(target, dep_target, xcconfig, include_ld_flags)
end end
end end
end end
......
...@@ -229,10 +229,11 @@ module Pod ...@@ -229,10 +229,11 @@ module Pod
aggregate_target.native_target.add_dependency(pod_target.native_target) aggregate_target.native_target.add_dependency(pod_target.native_target)
configure_app_extension_api_only_for_target(pod_target) if is_app_extension configure_app_extension_api_only_for_target(pod_target) if is_app_extension
add_dependent_targets_to_native_target(pod_target.dependent_targets,
pod_target.native_target, is_app_extension,
pod_target.requires_frameworks? && !pod_target.static_framework?,
frameworks_group)
unless pod_target.static_framework? unless pod_target.static_framework?
add_dependent_targets_to_native_target(pod_target.dependent_targets,
pod_target.native_target, is_app_extension,
pod_target.requires_frameworks?, frameworks_group)
add_pod_target_test_dependencies(pod_target, frameworks_group) add_pod_target_test_dependencies(pod_target, frameworks_group)
end end
end end
......
...@@ -9,9 +9,35 @@ module Pod ...@@ -9,9 +9,35 @@ module Pod
@monkey_spec = fixture_spec('monkey/monkey.podspec') @monkey_spec = fixture_spec('monkey/monkey.podspec')
@monkey_pod_target = fixture_pod_target(@monkey_spec) @monkey_pod_target = fixture_pod_target(@monkey_spec)
vspec = stub(:test_specification? => false)
consumer = stub(
:pod_target_xcconfig => {},
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios,
)
file_accessor = stub(
:spec => vspec,
:spec_consumer => consumer,
:vendored_static_frameworks => [config.sandbox.root + 'AAA/StaticFramework.framework'],
:vendored_static_libraries => [config.sandbox.root + 'BBB/StaticLibrary.a'],
:vendored_dynamic_frameworks => [config.sandbox.root + 'CCC/VendoredFramework.framework'],
:vendored_dynamic_libraries => [config.sandbox.root + 'DDD/VendoredDyld.dyld'],
)
vendored_dep_target = stub(
:name => 'BananaLib',
:sandbox => config.sandbox,
:should_build? => false,
:requires_frameworks? => true,
:static_framework? => false,
:dependent_targets => [],
:file_accessors => [file_accessor],
)
@spec = fixture_spec('banana-lib/BananaLib.podspec') @spec = fixture_spec('banana-lib/BananaLib.podspec')
@pod_target = fixture_pod_target(@spec) @pod_target = fixture_pod_target(@spec)
@pod_target.dependent_targets = [@monkey_pod_target] @pod_target.dependent_targets = [@monkey_pod_target, vendored_dep_target]
@pod_target.host_requires_frameworks = true @pod_target.host_requires_frameworks = true
@consumer = @pod_target.spec_consumers.first @consumer = @pod_target.spec_consumers.first
...@@ -51,11 +77,11 @@ module Pod ...@@ -51,11 +77,11 @@ module Pod
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework "iAd"') @xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-weak_framework "iAd"')
end end
it 'includes the vendored dynamic frameworks for dependecy pods of the specification' do it 'includes the vendored dynamic frameworks for dependency pods of the specification' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "dynamic-monkey"') @xcconfig.to_hash['OTHER_LDFLAGS'].should.include('-framework "dynamic-monkey"')
end end
it 'does not include vendored static frameworks for dependecy pods of the specification' do it 'does not include vendored static frameworks for dependency pods of the specification' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-l"monkey.a"') @xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include('-l"monkey.a"')
end end
...@@ -75,6 +101,23 @@ module Pod ...@@ -75,6 +101,23 @@ module Pod
@xcconfig.to_hash['OTHER_LDFLAGS'].split(' ').should.include('-fobjc-arc') @xcconfig.to_hash['OTHER_LDFLAGS'].split(' ').should.include('-fobjc-arc')
end end
it 'sets the framework search paths' do
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('spec/fixtures/banana-lib')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('spec/fixtures/monkey')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('${PODS_ROOT}/AAA')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('${PODS_ROOT}/BBB')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('${PODS_ROOT}/CCC')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('${PODS_ROOT}/DDD')
end
it 'vendored frameworks dont get added to frameworks paths if use_frameworks! isnt set' do
@pod_target.stubs(:requires_frameworks?).returns(false)
@xcconfig = @generator.generate
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('spec/fixtures/monkey')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('${PODS_ROOT}/AAA')
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.include('${PODS_ROOT}/CCC')
end
it 'sets the PODS_ROOT build variable' do it 'sets the PODS_ROOT build variable' do
@xcconfig.to_hash['PODS_ROOT'].should.not.nil? @xcconfig.to_hash['PODS_ROOT'].should.not.nil?
end end
......
...@@ -119,6 +119,85 @@ module Pod ...@@ -119,6 +119,85 @@ module Pod
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"xml2"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"xml2"'
end end
it 'checks OTHER_LD_FLAGS and FRAMEWORK_SEARCH_PATHS for a vendored dependencies to a static framework' do
spec = stub(:test_specification? => false)
target_definition = stub(:inheritance => 'search_paths')
consumer = stub(
:pod_target_xcconfig => {},
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios,
)
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'],
)
dep_target = stub(
:name => 'BananaLib',
:sandbox => config.sandbox,
:should_build? => false,
:requires_frameworks? => true,
:static_framework? => false,
:dependent_targets => [],
:file_accessors => [file_accessor],
)
dep_targets = [dep_target]
target = stub(
:target_definition => target_definition,
:pod_targets => dep_targets,
:search_paths_aggregate_targets => [],
:static_framework => true,
)
xcconfig = Xcodeproj::Config.new
@sut.generate_vendored_build_settings(target, dep_targets, xcconfig, true)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"StaticLibrary" -l"VendoredDyld" -l"xml2" -framework "StaticFramework" -framework "VendoredFramework"'
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/."'
end
it 'check that include_ld_flags being false doesnt generate OTHER_LD_FLAGS' do
spec = stub(:test_specification? => false)
target_definition = stub(:inheritance => 'search_paths')
consumer = stub(
:pod_target_xcconfig => {},
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios,
)
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'],
)
dep_target = stub(
:name => 'BananaLib',
:sandbox => config.sandbox,
:should_build? => false,
:requires_frameworks? => true,
:static_framework? => false,
:dependent_targets => [],
:file_accessors => [file_accessor],
)
dep_targets = [dep_target]
target = stub(
:target_definition => target_definition,
:pod_targets => dep_targets,
:search_paths_aggregate_targets => [],
)
xcconfig = Xcodeproj::Config.new
@sut.generate_vendored_build_settings(target, dep_targets, xcconfig, false)
xcconfig.to_hash['OTHER_LDFLAGS'].should.nil?
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/."'
end
it 'makes sure setting from search_paths get propagated for static frameworks' do it 'makes sure setting from search_paths get propagated for static frameworks' do
target_definition = stub(:inheritance => 'search_paths') target_definition = stub(:inheritance => 'search_paths')
consumer = stub( consumer = stub(
...@@ -434,7 +513,7 @@ module Pod ...@@ -434,7 +513,7 @@ module Pod
aggregate_target = stub(:target_definition => target_definition, :pod_targets => [], :search_paths_aggregate_targets => []) aggregate_target = stub(:target_definition => target_definition, :pod_targets => [], :search_paths_aggregate_targets => [])
pod_target = stub(:sandbox => config.sandbox) pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor) @sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor, true)
xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['OTHER_LDFLAGS'].should.be.nil xcconfig.to_hash['OTHER_LDFLAGS'].should.be.nil
...@@ -445,7 +524,7 @@ module Pod ...@@ -445,7 +524,7 @@ module Pod
pod_target = stub(:name => 'BananaLib', :sandbox => config.sandbox) pod_target = stub(:name => 'BananaLib', :sandbox => config.sandbox)
aggregate_target = stub(:target_definition => target_definition, :pod_targets => [pod_target], :search_paths_aggregate_targets => []) aggregate_target = stub(:target_definition => target_definition, :pod_targets => [pod_target], :search_paths_aggregate_targets => [])
xcconfig = Xcodeproj::Config.new xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor) @sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor, true)
xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"'
...@@ -456,7 +535,7 @@ module Pod ...@@ -456,7 +535,7 @@ module Pod
aggregate_target = stub(:target_definition => target_definition) aggregate_target = stub(:target_definition => target_definition)
pod_target = stub(:sandbox => config.sandbox) pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor) @sut.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, @accessor, true)
xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"'
...@@ -465,7 +544,7 @@ module Pod ...@@ -465,7 +544,7 @@ module Pod
it 'should include static framework for pod targets' do it 'should include static framework for pod targets' do
pod_target = stub(:sandbox => config.sandbox) pod_target = stub(:sandbox => config.sandbox)
xcconfig = Xcodeproj::Config.new xcconfig = Xcodeproj::Config.new
@sut.add_static_dependency_build_settings(nil, pod_target, xcconfig, @accessor) @sut.add_static_dependency_build_settings(nil, pod_target, xcconfig, @accessor, true)
xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['LIBRARY_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"' xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '"${PODS_ROOT}/../../spec/fixtures/banana-lib"'
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l"Bananalib" -framework "Bananalib"'
......
...@@ -298,6 +298,26 @@ module Pod ...@@ -298,6 +298,26 @@ module Pod
@generator.send(:set_target_dependencies) @generator.send(:set_target_dependencies)
end end
it 'adds all test dependent targets to test native targets for static frameworks' do
mock_native_target = mock('CoconutLib')
dependent_native_target = mock('DependentNativeTarget')
dependent_target = mock('dependent-target')
dependent_target.stubs(:should_build?).returns(true)
dependent_target.stubs(:native_target).returns(dependent_native_target)
@pod_target.stubs(:native_target).returns(mock_native_target)
@pod_target.stubs(:dependent_targets).returns([dependent_target])
@pod_target.stubs(:should_build? => true)
@pod_target.stubs(:static_framework? => true)
@mock_target.expects(:add_dependency).with(mock_native_target)
mock_native_target.expects(:add_dependency).with(dependent_native_target)
mock_native_target.expects(:add_dependency).with(mock_native_target).never
@generator.send(:set_target_dependencies)
end
it 'adds dependencies to pod targets that are not part of any aggregate target' do it 'adds dependencies to pod targets that are not part of any aggregate target' do
@target.stubs(:pod_targets).returns([]) @target.stubs(:pod_targets).returns([])
@generator.expects(:pod_targets).returns([@pod_target]) @generator.expects(:pod_targets).returns([@pod_target])
......
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