Commit 28463d4e authored by Marius Rackwitz's avatar Marius Rackwitz

Namespace the pod target product

Pod target products are named after their specs. The namespacing cannot directly happen in the product name itself, because this must be equal to the module name and this will be used in source code, which should stay agnostic over the dependency manager. We need namespacing at all because multiple targets can exist for the same podspec and their products should not collide. This happens when mulitple user targets require the same pod, because they could require different sets of subspecs.
parent 34a1cf34
...@@ -7,7 +7,7 @@ module Pod ...@@ -7,7 +7,7 @@ module Pod
attr_reader :frameworks_by_config attr_reader :frameworks_by_config
# @param [Hash{String, Array{String}] frameworks_by_config # @param [Hash{String, Array{String}] frameworks_by_config
# @see frameworks_by_config # @see #frameworks_by_config
# #
def initialize(frameworks_by_config) def initialize(frameworks_by_config)
@frameworks_by_config = frameworks_by_config @frameworks_by_config = frameworks_by_config
......
...@@ -56,6 +56,14 @@ module Pod ...@@ -56,6 +56,14 @@ module Pod
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem') 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem')
} }
if target.requires_framework?
build_settings = {
'FRAMEWORK_SEARCH_PATHS' => XCConfigHelper.quote([target.configuration_build_dir]),
}
config.merge!(build_settings)
end
@xcconfig = Xcodeproj::Config.new(config) @xcconfig = Xcodeproj::Config.new(config)
XCConfigHelper.add_target_specific_settings(target, @xcconfig) XCConfigHelper.add_target_specific_settings(target, @xcconfig)
......
...@@ -57,6 +57,14 @@ module Pod ...@@ -57,6 +57,14 @@ module Pod
# 'USE_HEADERMAP' => 'NO' # 'USE_HEADERMAP' => 'NO'
} }
if target.requires_framework?
build_settings = {
'CONFIGURATION_BUILD_DIR' => target.configuration_build_dir,
'FRAMEWORK_SEARCH_PATHS' => XCConfigHelper.quote([target.configuration_build_dir]),
}
config.merge!(build_settings)
end
xcconfig_hash = add_xcconfig_namespaced_keys(public_xcconfig.to_hash, config, target.xcconfig_prefix) xcconfig_hash = add_xcconfig_namespaced_keys(public_xcconfig.to_hash, config, target.xcconfig_prefix)
@xcconfig = Xcodeproj::Config.new(xcconfig_hash) @xcconfig = Xcodeproj::Config.new(xcconfig_hash)
XCConfigHelper.add_target_specific_settings(target, @xcconfig) XCConfigHelper.add_target_specific_settings(target, @xcconfig)
......
...@@ -197,6 +197,23 @@ module Pod ...@@ -197,6 +197,23 @@ module Pod
support_files_dir + "#{label}-dummy.m" support_files_dir + "#{label}-dummy.m"
end end
# @return [String] The configuration build dir, if the target is integrated
# as framework.
#
# @note Namespace the pod target product with its target definition name.
# Pod target products are named after their specs. The namespacing
# cannot directly happen in the product name itself, because this
# must be equal to the module name and this will be used in source
# code, which should stay agnostic over the dependency manager.
# We need namespacing at all because multiple targets can exist for
# the same podspec and their products should not collide. This
# happens when multiple user targets require the same pod, because
# they could require different sets of subspecs.
#
def configuration_build_dir
"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/#{target_definition.label}"
end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
protected protected
......
...@@ -82,6 +82,10 @@ module Pod ...@@ -82,6 +82,10 @@ module Pod
it 'returns the path of the xcconfig file relative to the user project' do it 'returns the path of the xcconfig file relative to the user project' do
@target.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods/Pods.release.xcconfig' @target.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods/Pods.release.xcconfig'
end end
it 'returns the path for the CONFIGURATION_BUILD_DIR build setting' do
@target.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods'
end
end end
describe 'Pod targets' do describe 'Pod targets' do
......
...@@ -106,6 +106,10 @@ module Pod ...@@ -106,6 +106,10 @@ module Pod
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-Private.xcconfig' 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-Private.xcconfig'
) )
end end
it 'returns the path for the CONFIGURATION_BUILD_DIR build setting' do
@pod_target.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods'
end
end end
describe 'Product type dependent helpers' do describe 'Product type dependent helpers' 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