Copy dSYM for vendored frameworks

parent b9c6f34d
......@@ -8,7 +8,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* None.
* Copy dSYM for vendored frameworks.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#1698](https://github.com/CocoaPods/CocoaPods/issues/1698)
##### Bug Fixes
......
......@@ -91,6 +91,15 @@ module Pod
fi
}
# Copies the dSYM of a vendored framework
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
echo "rsync -av --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
......@@ -126,11 +135,14 @@ module Pod
SH
script << "\n" unless frameworks_by_config.values.all?(&:empty?)
frameworks_by_config.each do |config, frameworks|
unless frameworks.empty?
frameworks_by_config.each do |config, frameworks_with_dsyms|
unless frameworks_with_dsyms.empty?
script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
frameworks.each do |framework|
script << %( install_framework "#{framework}"\n)
frameworks_with_dsyms.each do |framework_with_dsym|
script << %( install_framework "#{framework_with_dsym[:framework]}"\n)
# Vendored frameworks might have a dSYM file next to them so ensure its copied. Frameworks built from
# sources will have their dSYM generated and copied by Xcode.
script << %( install_dsym "#{framework_with_dsym[:dSYM]}"\n) unless framework_with_dsym[:dSYM].nil?
end
script << "fi\n"
end
......
......@@ -158,18 +158,24 @@ module Pod
#
def create_embed_frameworks_script
path = target.embed_frameworks_script_path
frameworks_by_config = {}
frameworks_and_dsyms_by_config = {}
target.user_build_configurations.keys.each do |config|
relevant_pod_targets = target.pod_targets.select do |pod_target|
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_artifacts).map { |fw| "${PODS_ROOT}/#{fw.relative_path_from(sandbox.root)}" }
frameworks << pod_target.build_product_path('$BUILT_PRODUCTS_DIR') if pod_target.should_build? && pod_target.requires_frameworks?
frameworks_and_dsyms_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
frameworks = pod_target.file_accessors.flat_map(&:vendored_dynamic_artifacts).map do |fw|
path_to_framework = "${PODS_ROOT}/#{fw.relative_path_from(sandbox.root)}"
# Until this can be configured, assume the dSYM file uses the file name as the framework.
# See https://github.com/CocoaPods/CocoaPods/issues/1698
{ :framework => path_to_framework, :dSYM => "#{path_to_framework}.dSYM" }
end
# For non vendored frameworks Xcode will generate the dSYM and copy it instead.
frameworks << { :framework => pod_target.build_product_path('$BUILT_PRODUCTS_DIR'), :dSYM => nil } if pod_target.should_build? && pod_target.requires_frameworks?
frameworks
end
end
generator = Generator::EmbedFrameworksScript.new(frameworks_by_config)
generator = Generator::EmbedFrameworksScript.new(frameworks_and_dsyms_by_config)
generator.save_as(path)
add_file_to_support_group(path)
end
......
Subproject commit 11064dbaee00b46980afd8589a428d3d1a06108b
Subproject commit 04072c13296783a87f1afb5947cb84097d0d3808
......@@ -4,13 +4,14 @@ module Pod
describe Generator::EmbedFrameworksScript do
it 'returns the embed frameworks script' do
frameworks = {
'Debug' => %w(Pods/Loopback.framework Reveal.framework),
'Release' => %w(CrashlyticsFramework.framework),
'Debug' => [{ :framework => 'Pods/Loopback.framework', :dSYM => 'Pods/Loopback.framework.dSYM' }, { :framework => 'Reveal.framework', :dSYM => nil }],
'Release' => [{ :framework => 'CrashlyticsFramework.framework', :dSYM => nil }],
}
generator = Pod::Generator::EmbedFrameworksScript.new(frameworks)
generator.send(:script).should.include <<-SH.strip_heredoc
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods/Loopback.framework"
install_dsym "Pods/Loopback.framework.dSYM"
install_framework "Reveal.framework"
fi
SH
......
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