diff --git a/lib/cocoapods/generator/copy_dsyms_script.rb b/lib/cocoapods/generator/copy_dsyms_script.rb index e87c711b70..ba4ba8a6e3 100644 --- a/lib/cocoapods/generator/copy_dsyms_script.rb +++ b/lib/cocoapods/generator/copy_dsyms_script.rb @@ -5,12 +5,17 @@ class CopydSYMsScript # attr_reader :dsym_paths + # @return [Array] bcsymbolmap_paths the bcsymbolmap paths to include in the script contents. + # + attr_reader :bcsymbolmap_paths + # Initialize a new instance # # @param [Array] dsym_paths @see dsym_paths # - def initialize(dsym_paths) + def initialize(dsym_paths, bcsymbol_paths) @dsym_paths = dsym_paths + @bcsymbolmap_paths = bcsymbolmap_paths end # Saves the copy dSYMs script to the given pathname. @@ -35,10 +40,14 @@ def generate #{Pod::Generator::ScriptPhaseConstants::STRIP_INVALID_ARCHITECTURES_METHOD} #{Pod::Generator::ScriptPhaseConstants::RSYNC_PROTECT_TMP_FILES} #{Pod::Generator::ScriptPhaseConstants::INSTALL_DSYM_METHOD} +#{Pod::Generator::ScriptPhaseConstants::INSTALL_BCSYMBOLMAP_METHOD} SH - dsym_paths.each do |dsym_path| + dsym_paths&.each do |dsym_path| script << %(install_dsym "#{dsym_path}"\n) end + bcsymbolmap_paths&.each do |bcsymbolmap_path| + script << %(install_bcsymbolmap "#{bcsymbolmap_path}"\n) + end script end end diff --git a/lib/cocoapods/generator/embed_frameworks_script.rb b/lib/cocoapods/generator/embed_frameworks_script.rb index 3aa6c803b9..fb09a82736 100644 --- a/lib/cocoapods/generator/embed_frameworks_script.rb +++ b/lib/cocoapods/generator/embed_frameworks_script.rb @@ -130,14 +130,6 @@ def script } #{Pod::Generator::ScriptPhaseConstants::INSTALL_DSYM_METHOD} #{Pod::Generator::ScriptPhaseConstants::STRIP_INVALID_ARCHITECTURES_METHOD} -# Copies the bcsymbolmap files of a vendored framework -install_bcsymbolmap() { - local bcsymbolmap_path="$1" - local destination="${BUILT_PRODUCTS_DIR}" - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" -} - # 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 diff --git a/lib/cocoapods/generator/script_phase_constants.rb b/lib/cocoapods/generator/script_phase_constants.rb index 94837b8d0a..af4d9ae026 100644 --- a/lib/cocoapods/generator/script_phase_constants.rb +++ b/lib/cocoapods/generator/script_phase_constants.rb @@ -82,6 +82,25 @@ module ScriptPhaseConstants touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" fi fi +} + SH + + INSTALL_BCSYMBOLMAP_METHOD = <<-SH.strip_heredoc.freeze +# Copies bcsymbolmaps +install_bcsymbolmap() { + local source="$1" + warn_missing_arch=${2:-true} + if [ -r "$source" ]; then + # Copy the bcsymbolmap into the targets temp dir. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DERIVED_FILES_DIR}\\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" + + local basename + basename="$(basename -s .bcsymbolmap "$source")" + # Move the stripped file into its final destination. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\" \\"${DWARF_DSYM_FOLDER_PATH}\\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.bcsymbolmap" "${DWARF_DSYM_FOLDER_PATH}" + fi } SH end diff --git a/lib/cocoapods/installer/user_project_integrator/target_integrator.rb b/lib/cocoapods/installer/user_project_integrator/target_integrator.rb index 82c3919a25..462145ca6e 100644 --- a/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +++ b/lib/cocoapods/installer/user_project_integrator/target_integrator.rb @@ -426,12 +426,7 @@ def embed_frameworks_input_paths(framework_paths, xcframeworks) def embed_frameworks_output_paths(framework_input_paths, xcframeworks) paths = framework_input_paths.flat_map do |framework_path| framework_output_path = "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}" - bcsymbol_output_paths = unless framework_path.bcsymbolmap_paths.nil? - framework_path.bcsymbolmap_paths.map do |bcsymbolmap_path| - "${BUILT_PRODUCTS_DIR}/#{File.basename(bcsymbolmap_path)}" - end - end - [framework_output_path, *bcsymbol_output_paths] + [framework_output_path] end.compact.uniq # Static xcframeworks are not copied to the build dir # so only include dynamic artifacts that will be copied to the build folder @@ -576,6 +571,10 @@ def add_embed_frameworks_script_phase input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path) input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks) + # input_paths << ARTIFACT_LIST_FILE if target.includes_xcframeworks? + # framework_paths.each do |path| + # input_paths.concat([path.source_path].compact) + # end output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path) output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks) diff --git a/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb b/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb index c1582ebcc8..f62115a4fb 100644 --- a/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +++ b/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb @@ -776,15 +776,16 @@ def create_app_target_embed_frameworks_script(app_spec) end end - # Creates a script that copies and strips vendored dSYMs. + # Creates a script that copies and strips vendored dSYMs and bcsymbolmaps. # # @return [void] # def create_copy_dsyms_script dsym_paths = PodTargetInstaller.dsym_paths(target) + bcsymbolmap_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.bcsymbolmap_paths.nil? }.map(&:bcsymbolmap_paths) path = target.copy_dsyms_script_path - unless dsym_paths.empty? - generator = Generator::CopydSYMsScript.new(dsym_paths) + unless dsym_paths.empty? && bcsymbolmap_paths.empty? + generator = Generator::CopydSYMsScript.new(dsym_paths, bcsymbolmap_paths) update_changed_file(generator, path) add_file_to_support_group(path) end diff --git a/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb b/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb index 29e443dbb3..1bbace54a0 100644 --- a/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +++ b/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb @@ -141,7 +141,7 @@ def add_embed_frameworks_script_phase(native_target, spec) input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path) input_paths = input_paths_by_config[input_paths_key] = [script_path] framework_paths.each do |path| - input_paths.concat([path.source_path, path.bcsymbolmap_paths].flatten.compact) + input_paths.concat << path.source_path end output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec) @@ -209,8 +209,9 @@ def add_copy_xcframeworks_script_phase(native_target) def add_copy_dsyms_script_phase(native_target) script_path = "${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}" dsym_paths = PodTargetInstaller.dsym_paths(target) + bcsymbolmap_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.bcsymbolmap_paths.nil? }.map(&:bcsymbolmap_paths).flatten - if dsym_paths.empty? + if dsym_paths.empty? && bcsymbolmap_paths.empty? script_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME) } native_target.build_phases.delete(script_phase) if script_phase.present? return @@ -227,7 +228,7 @@ def add_copy_dsyms_script_phase(native_target) input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}" input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path) input_paths = input_paths_by_config[input_paths_key] = [] - input_paths.concat dsym_paths + input_paths.concat([dsym_paths, bcsymbolmap_paths].flatten.compact) output_file_list_path = target.copy_dsyms_script_output_files_path output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}" @@ -235,7 +236,8 @@ def add_copy_dsyms_script_phase(native_target) output_paths = output_paths_by_config[output_paths_key] = [] dsym_output_paths = dsym_paths.map { |dsym_path| "${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}" } - output_paths.concat dsym_output_paths + bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| "${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}" } + output_paths.concat([dsym_output_paths, bcsymbolmap_output_paths].flatten.compact) end UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) diff --git a/spec/cocoapods-integration-specs b/spec/cocoapods-integration-specs index e000507586..b107f0b000 160000 --- a/spec/cocoapods-integration-specs +++ b/spec/cocoapods-integration-specs @@ -1 +1 @@ -Subproject commit e000507586d437223da1d7554f27862911db98a5 +Subproject commit b107f0b00097c0f90b95422485295b872ff81bbd diff --git a/spec/unit/generator/embed_frameworks_script_spec.rb b/spec/unit/generator/embed_frameworks_script_spec.rb index bb7aa21c4c..0342d45afe 100644 --- a/spec/unit/generator/embed_frameworks_script_spec.rb +++ b/spec/unit/generator/embed_frameworks_script_spec.rb @@ -34,8 +34,6 @@ module Pod result.should.include <<-SH.strip_heredoc if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "Pods/Loopback.framework" - install_bcsymbolmap "7724D6B4-C7DD-31F0-80C6-EE818ED30B07.bcsymbolmap" - install_bcsymbolmap "B724D6B4-C7DD-31F0-80C6-EE818ED30B0B.bcsymbolmap" install_framework "Reveal.framework" fi SH diff --git a/spec/unit/installer/user_project_integrator/target_integrator_spec.rb b/spec/unit/installer/user_project_integrator/target_integrator_spec.rb index 7073855cdb..ffb2e6e5e8 100644 --- a/spec/unit/installer/user_project_integrator/target_integrator_spec.rb +++ b/spec/unit/installer/user_project_integrator/target_integrator_spec.rb @@ -441,7 +441,7 @@ module Pod it 'adds embed frameworks build phase input and output paths for vendored and non vendored frameworks' do debug_vendored_framework = Xcode::FrameworkPaths.new('${PODS_ROOT}/DebugVendoredFramework/ios/DebugVendoredFramework.framework', '${PODS_ROOT}/DebugVendoredFramework/ios/DebugVendoredFramework.framework.dSYM', - ['${PODS_ROOT}/DebugVendoredFramework/ios/A6621399-62A0-3DC3-A6E3-B6B51BD287AD.bcsymbolmap']) + '${PODS_ROOT}/DebugVendoredFramework/ios/A6621399-62A0-3DC3-A6E3-B6B51BD287AD.bcsymbolmap') debug_non_vendored_framework = Xcode::FrameworkPaths.new('${BUILT_PRODUCTS_DIR}/DebugCompiledFramework/DebugCompiledFramework.framework') @@ -457,13 +457,11 @@ module Pod phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name } phase.input_paths.sort.should == %w( ${BUILT_PRODUCTS_DIR}/DebugCompiledFramework/DebugCompiledFramework.framework - ${PODS_ROOT}/DebugVendoredFramework/ios/A6621399-62A0-3DC3-A6E3-B6B51BD287AD.bcsymbolmap ${PODS_ROOT}/DebugVendoredFramework/ios/DebugVendoredFramework.framework ${PODS_ROOT}/ReleaseVendoredFramework/ios/ReleaseVendoredFramework.framework ${PODS_ROOT}/Target\ Support\ Files/Pods/Pods-frameworks.sh ) phase.output_paths.sort.should == %w( - ${BUILT_PRODUCTS_DIR}/A6621399-62A0-3DC3-A6E3-B6B51BD287AD.bcsymbolmap ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DebugCompiledFramework.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DebugVendoredFramework.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReleaseVendoredFramework.framework diff --git a/spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb b/spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb index d828d16a6d..02107d0fce 100644 --- a/spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb +++ b/spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb @@ -237,7 +237,8 @@ class PodTargetIntegrator it 'integrates native target with copy dSYM script phase' do framework_paths = [Pod::Xcode::FrameworkPaths.new('${PODS_ROOT}/Vendored/Vendored.framework', - '${PODS_ROOT}/Vendored/Vendored.framework.dSYM')] + '${PODS_ROOT}/Vendored/Vendored.framework.dSYM', + '${PODS_ROOT}/Vendored/7724D6B4-C7DD-31F0-80C6-EE818ED30B07.bcsymbolmap')] @watermelon_pod_target.stubs(:framework_paths).returns('WatermelonLib' => framework_paths) installation_result = TargetInstallationResult.new(@watermelon_pod_target, @native_target, [], []) PodTargetIntegrator.new(installation_result, :use_input_output_paths => true).integrate! @@ -247,16 +248,19 @@ class PodTargetIntegrator ] @native_target.build_phases[0].input_paths.should == [ '${PODS_ROOT}/Vendored/Vendored.framework.dSYM', + '${PODS_ROOT}/Vendored/7724D6B4-C7DD-31F0-80C6-EE818ED30B07.bcsymbolmap', ] @native_target.build_phases[0].output_paths.should == [ '${DWARF_DSYM_FOLDER_PATH}/Vendored.framework.dSYM', + '${DWARF_DSYM_FOLDER_PATH}/7724D6B4-C7DD-31F0-80C6-EE818ED30B07.bcsymbolmap', ] end it 'integrates native target with copy dSYM script phase and xcfilelists' do @project.stubs(:object_version).returns('50') framework_paths = [Pod::Xcode::FrameworkPaths.new('${PODS_ROOT}/Vendored/Vendored.framework', - '${PODS_ROOT}/Vendored/Vendored.framework.dSYM')] + '${PODS_ROOT}/Vendored/Vendored.framework.dSYM', + '${PODS_ROOT}/Vendored/7724D6B4-C7DD-31F0-80C6-EE818ED30B07.bcsymbolmap')] @watermelon_pod_target.stubs(:framework_paths).returns('WatermelonLib' => framework_paths) installation_result = TargetInstallationResult.new(@watermelon_pod_target, @native_target, [], []) PodTargetIntegrator.new(installation_result, :use_input_output_paths => true).integrate!