Commit 170ba7dc authored by Marius Rackwitz's avatar Marius Rackwitz

[PodTarget] Combine helper methods for build dir

parent 74aef542
......@@ -97,7 +97,7 @@ module Pod
if target.requires_frameworks?
build_pod_targets = pod_targets.select(&:should_build?)
framework_header_search_paths = build_pod_targets.map do |target|
"#{target.relative_configuration_build_dir}/#{target.product_name}/Headers"
"#{target.configuration_build_dir}/#{target.product_name}/Headers"
end
build_settings = {
# Make framework headers discoverable by `import "…"`
......
......@@ -219,23 +219,23 @@ module Pod
dependent_targets = dependent_targets.select(&:should_build?)
has_configuration_build_dir = target.respond_to?(:configuration_build_dir)
if has_configuration_build_dir
build_dir_var = "$#{SHARED_BUILD_DIR_VARIABLE}"
build_settings = {
'CONFIGURATION_BUILD_DIR' => target.configuration_build_dir,
'CONFIGURATION_BUILD_DIR' => target.configuration_build_dir(build_dir_var),
SHARED_BUILD_DIR_VARIABLE => '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)',
}
build_dir_var = "$#{SHARED_BUILD_DIR_VARIABLE}"
else
build_settings = {}
build_dir_var = '$CONFIGURATION_BUILD_DIR'
build_settings = {}
end
unless dependent_targets.empty?
framework_search_paths = []
library_search_paths = []
dependent_targets.each do |dependent_target|
if dependent_target.requires_frameworks?
framework_search_paths << dependent_target.relative_configuration_build_dir(build_dir_var)
framework_search_paths << dependent_target.configuration_build_dir(build_dir_var)
else
library_search_paths << dependent_target.relative_configuration_build_dir(build_dir_var)
library_search_paths << dependent_target.configuration_build_dir(build_dir_var)
end
end
build_settings['FRAMEWORK_SEARCH_PATHS'] = '$(inherited) ' + XCConfigHelper.quote(framework_search_paths.uniq) unless framework_search_paths.empty?
......
......@@ -249,32 +249,15 @@ module Pod
end
end
# @return [String] The configuration build dir, relevant if the target is
# integrated as framework.
#
def configuration_build_dir
if scoped?
"$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/#{scope_suffix}"
else
'$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
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)'
# @return [String] The absolute path to the configuration build dir
#
def relative_configuration_build_dir(dir = '$CONFIGURATION_BUILD_DIR')
if scoped?
"#{dir}/#{pod_name}/#{scope_suffix}"
else
"#{dir}/#{pod_name}"
end
def configuration_build_dir(dir = '$CONFIGURATION_BUILD_DIR')
"#{dir}/#{pod_name}#{scoped? ? "/#{scope_suffix}" : ''}"
end
private
......
......@@ -162,8 +162,10 @@ module Pod
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)'
@pod_target.scoped.first.configuration_build_dir.should == '$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods'
@pod_target.configuration_build_dir.should == '$CONFIGURATION_BUILD_DIR/BananaLib'
@pod_target.scoped.first.configuration_build_dir.should == '$CONFIGURATION_BUILD_DIR/BananaLib/Pods'
@pod_target.configuration_build_dir('$PODS_SHARED_BUILD_DIR').should == '$PODS_SHARED_BUILD_DIR/BananaLib'
@pod_target.scoped.first.configuration_build_dir('$PODS_SHARED_BUILD_DIR').should == '$PODS_SHARED_BUILD_DIR/BananaLib/Pods'
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