Xcode: Race condition between .dSYM creation and post-build actions in "new build system"
This has been observed in 3.21.1 and 3.22.0-rc1, using either Xcode 12.5.1 or Xcode 13.
When a framework target for iOS is set to Dwarf-with-dSYM, and when using Xcode's modern build system, we observe a race condition. Xcode performs the link of the framework's binary file, and then the post-build steps start running before the dSYM file is completed. You can observe this by adding a post-build step that logs a message and see the order of it relative to the line about dSYM creation.
The result is that if your post-build step does anything with the .dSYM file, it is likely to be incomplete. Also, if your post-build step does anything with the library binary itself, it will not have been stripped yet, as this happens when the .dSYM is finished.
When using the legacy build system this problem is not observed - the .dSYM file is finished before any post-build steps begin.