Commit 8528146b authored by Marius Rackwitz's avatar Marius Rackwitz

Add attribute #target_definition to EmbedFrameworksScript

Inject the attribute value by the initializer. It is used to locate the target specific build products as they are namespaced in build location.
parent b279e421
module Pod module Pod
module Generator module Generator
class EmbedFrameworksScript class EmbedFrameworksScript
# @return [TargetDefinition] The target definition, whose label will be
# used to locate the target specific build products.
#
attr_reader :target_definition
# @return [Hash{String, Array{String}] Multiple lists of frameworks per # @return [Hash{String, Array{String}] Multiple lists of frameworks per
# configuration. # configuration.
# #
attr_reader :frameworks_by_config attr_reader :frameworks_by_config
# @param [TargetDefinition] target_definition
# @see #target_definition
#
# @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(target_definition, frameworks_by_config)
@target_definition = target_definition
@frameworks_by_config = frameworks_by_config @frameworks_by_config = frameworks_by_config
end end
...@@ -44,7 +53,7 @@ module Pod ...@@ -44,7 +53,7 @@ module Pod
install_framework() install_framework()
{ {
echo "rsync --exclude '*.h' -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" echo "rsync --exclude '*.h' -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -av "${BUILT_PRODUCTS_DIR}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" rsync -av "${BUILT_PRODUCTS_DIR}/#{target_definition.label}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
} }
eos eos
script += "\n" unless frameworks_by_config.values.all?(&:empty?) script += "\n" unless frameworks_by_config.values.all?(&:empty?)
......
...@@ -126,7 +126,7 @@ module Pod ...@@ -126,7 +126,7 @@ module Pod
pod_target.include_in_build_config?(config) pod_target.include_in_build_config?(config)
end.map(&:product_name) end.map(&:product_name)
end end
generator = Generator::EmbedFrameworksScript.new(frameworks_by_config) generator = Generator::EmbedFrameworksScript.new(target_definition, frameworks_by_config)
generator.save_as(path) generator.save_as(path)
add_file_to_support_group(path) add_file_to_support_group(path)
end end
......
...@@ -4,11 +4,12 @@ module Pod ...@@ -4,11 +4,12 @@ module Pod
describe Generator::EmbedFrameworksScript do describe Generator::EmbedFrameworksScript do
it 'returns the embed frameworks script' do it 'returns the embed frameworks script' do
target_definition = Podfile::TargetDefinition.new(:default, nil)
frameworks = { frameworks = {
'Debug' => %w(Loopback.framework Reveal.framework), 'Debug' => %w(Loopback.framework Reveal.framework),
'Release' => %w(CrashlyticsFramework.framework) 'Release' => %w(CrashlyticsFramework.framework)
} }
generator = Pod::Generator::EmbedFrameworksScript.new(frameworks) generator = Pod::Generator::EmbedFrameworksScript.new(target_definition, frameworks)
generator.send(:script).should.include <<-eos.strip_heredoc generator.send(:script).should.include <<-eos.strip_heredoc
if [[ "$CONFIGURATION" == "Debug" ]]; then if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Loopback.framework' install_framework 'Loopback.framework'
......
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