Commit 048d0ab3 authored by Marius Rackwitz's avatar Marius Rackwitz

Scope all PodTargets by their root spec name

This strategy further differs from what Xcode does and breaks native copy files build phases, but allows complete deduplication. It excludes with the new scoping any name clashes where a pod depends on others, which are built in multiple variants, so that it wouldn't be possible without that to add them to the framework search paths, so that just the right variants of each is visible.
parent c2119833
......@@ -8,6 +8,13 @@ module Pod
# required by CocoaPods.
#
class PodXCConfig
# @return [String] Defined to hold the default Xcode build path, so
# that when this is overridden per {PodTarget}, it is still
# possible to reference other build products relative to the
# original path.
#
SHARED_BUILD_DIR_VARIABLE = 'PODS_SHARED_BUILD_DIR'.freeze
# @return [Target] the target represented by this xcconfig.
#
attr_reader :target
......@@ -57,13 +64,16 @@ module Pod
@xcconfig = Xcodeproj::Config.new(config)
if target.requires_frameworks? && target.scoped?
if target.requires_frameworks?
build_settings = {
SHARED_BUILD_DIR_VARIABLE => '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)',
'CONFIGURATION_BUILD_DIR' => target.configuration_build_dir,
}
scoped_dependent_targets = target.dependent_targets.select { |t| t.should_build? && t.scoped? }
unless scoped_dependent_targets.empty?
framework_search_paths = scoped_dependent_targets.map(&:relative_configuration_build_dir).uniq
framework_search_paths = scoped_dependent_targets.map do |target|
target.relative_configuration_build_dir("$#{SHARED_BUILD_DIR_VARIABLE}")
end
build_settings['FRAMEWORK_SEARCH_PATHS'] = XCConfigHelper.quote(framework_search_paths)
end
@xcconfig.merge!(build_settings)
......
......@@ -259,15 +259,20 @@ module Pod
end
end
# @param [String] dir
# The directory (which might be a variable) relative to which
# the returned path should be. This must be used if the
# $CONFIGURATION_BUILD_DIR is modified.
#
# @return [String] The configuration build dir, relative to the default
# configuration build dir, which is:
# '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
#
def relative_configuration_build_dir
def relative_configuration_build_dir(dir = '$CONFIGURATION_BUILD_DIR')
if scoped?
"$CONFIGURATION_BUILD_DIR/#{scope_suffix}"
"#{dir}/#{pod_name}/#{scope_suffix}"
else
'$CONFIGURATION_BUILD_DIR'
"#{dir}/#{pod_name}"
end
end
......
......@@ -200,16 +200,16 @@ module Pod
target_definition = fixture_target_definition(spec.name)
target_definition.stubs(:parent).returns(@target_definition.podfile)
fixture_pod_target(spec, [target_definition, @target_definition].uniq).tap do |pod_target|
pod_target.stubs(:scope_suffix).returns(target_definition.label)
pod_target.stubs(:scope_suffix).returns('iOS')
end
end
it 'adds the framework build path to the xcconfig, with quotes, as framework search paths' do
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '$(inherited) "$CONFIGURATION_BUILD_DIR/Pods-BananaLib" "$CONFIGURATION_BUILD_DIR/Pods-OrangeFramework"'
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should == '$(inherited) "$CONFIGURATION_BUILD_DIR/BananaLib/iOS" "$CONFIGURATION_BUILD_DIR/OrangeFramework/iOS"'
end
it 'adds the framework header paths to the xcconfig, with quotes, as local headers' do
expected = '$(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Pods-BananaLib/BananaLib.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Pods-OrangeFramework/OrangeFramework.framework/Headers"'
expected = '$(inherited) -iquote "$CONFIGURATION_BUILD_DIR/BananaLib/iOS/BananaLib.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/OrangeFramework/iOS/OrangeFramework.framework/Headers"'
@xcconfig.to_hash['OTHER_CFLAGS'].should == expected
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