Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/react-native/scripts/cocoapods/rncore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,16 @@ def self.process_dsyms(frameworkTarball, dSymsTarball)

# Add the dSYMs folder to the framework folder
rncore_log(" Adding dSYMs to framework tarball")
`(cd "$(dirname "#{dsyms_tmp_dir}")" && mkdir -p React.xcframework && cp -r "$(basename "#{dsyms_tmp_dir}")" React.xcframework/dSYMs && tar -rf "#{frameworkTarPath}" React.xcframework/dSYMs && rm -rf React.xcframework)`

# Move symbol bundles into each of the slices in the xcframework
# Example:
# move dSYMs/ios-arm64/. into React.xcframework/ios-arm64/React.framework/dSYMs/.
Dir.glob(File.join(dsyms_tmp_dir, "*")).each do |dsym_path|
slice_name = File.basename(dsym_path)
slice_dsym_dest = File.join("React.xcframework", slice_name, "React.framework", "dSYMs")
rncore_log(" Adding dSYM slice #{slice_name} into tarball at #{slice_dsym_dest}")
`(cd "#{File.dirname(frameworkTarPath)}" && mkdir -p "#{slice_dsym_dest}" && cp -R "#{dsym_path}/." "#{slice_dsym_dest}" && tar -rf "#{frameworkTarPath}" "#{slice_dsym_dest}")`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this could be simplified just because is too long. I would avoid doing a cd before, you can invoke all the commands from the current directory.

In theory this could just be a tar invocation with -C which changes the working directory only for tar?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also that's a nit

end

# Now gzip the framework tarball again - remember to use the .tar file and not the .gz file
rncore_log(" Packing #{Pathname.new(frameworkTarPath).relative_path_from(Pathname.pwd).to_s}")
Expand All @@ -246,6 +255,10 @@ def self.process_dsyms(frameworkTarball, dSymsTarball)
# Remove backup of original tarballs
FileUtils.rm_f("#{frameworkTarball}.orig")

# Remove temp dSYMs folder and the temp Framework folder
FileUtils.rm_rf(dsyms_tmp_dir)
FileUtils.rm_rf(File.join(artifacts_dir, "React.xcframework"))

rescue => e
rncore_log("Failed to process dSYMs: #{e.message}", :error)
# Restore the original tarballs
Expand Down
Loading