Commit 7e70269b authored by Samuel E. Giddins's avatar Samuel E. Giddins

[EmbedFrameworksScript] Support dylibs

parent 6f3230b3
......@@ -34,7 +34,7 @@ module Pod
# @return [String] The contents of the embed frameworks script.
#
def script
script = <<-eos.strip_heredoc
script = <<-SH.strip_heredoc
#!/bin/sh
set -e
......@@ -65,8 +65,11 @@ module Pod
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename "$1" | sed -E s/\\\\..+// && exit ${PIPESTATUS[0]})"
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
......@@ -114,15 +117,15 @@ module Pod
fi
}
eos
script += "\n" unless frameworks_by_config.values.all?(&:empty?)
SH
script << "\n" unless frameworks_by_config.values.all?(&:empty?)
frameworks_by_config.each do |config, frameworks|
unless frameworks.empty?
script += %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
frameworks.each do |framework|
script += " install_framework '#{framework}'\n"
script << " install_framework '#{framework}'\n"
end
script += "fi\n"
script << "fi\n"
end
end
script
......
......@@ -417,10 +417,7 @@ module Pod
dependencies = pod_targets.select(&:should_build?).flat_map(&:dependencies)
dependended_upon_targets = pod_targets.select { |t| dependencies.include?(t.pod_name) && !t.should_build? }
static_libs = dependended_upon_targets.flat_map(&:file_accessors).flat_map do |fa|
fa.vendored_static_libraries + fa.vendored_static_frameworks
end
static_libs = dependended_upon_targets.flat_map(&:file_accessors).flat_map(&:vendored_static_artifacts)
unless static_libs.empty?
raise Informative, "The '#{aggregate_target.label}' target has " \
"transitive dependencies that include static binaries: (#{static_libs.to_sentence})"
......
......@@ -148,7 +148,7 @@ module Pod
pod_target.include_in_build_config?(target_definition, config)
end
frameworks_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
frameworks = pod_target.file_accessors.flat_map(&:vendored_dynamic_frameworks).map { |fw| "${PODS_ROOT}/#{fw.relative_path_from(sandbox.root)}" }
frameworks = pod_target.file_accessors.flat_map(&:vendored_dynamic_artifacts).map { |fw| "${PODS_ROOT}/#{fw.relative_path_from(sandbox.root)}" }
frameworks << "#{target_definition.label}/#{pod_target.product_name}" if pod_target.should_build? && pod_target.requires_frameworks?
frameworks
end
......
......@@ -207,6 +207,14 @@ module Pod
vendored_libraries - vendored_dynamic_libraries
end
def vendored_dynamic_artifacts
vendored_dynamic_libraries + vendored_dynamic_frameworks
end
def vendored_static_artifacts
vendored_static_libraries + vendored_static_frameworks
end
# @return [Hash{String => Array<Pathname>}] A hash that describes the
# resource bundles of the Pod. The keys represent the name of
# the bundle while the values the path of the resources.
......
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