grab / cocoapods-binary-cache

MIT License
478 stars 69 forks source link

Duplicate (or overwritten) resources in app bundle #74

Closed richardneitzke closed 3 years ago

richardneitzke commented 3 years ago

Checklist

Issue Description

TLDR: Resources of Pods integrated via cocoapods-binary-cache appear to be present twice, sometimes overwriting other files.

Command executed

  1. bundle exec pod binary prebuild
  2. Regular Xcode build of the app

What went wrong?

When prebuilding frameworks with resources and compiling an app, the associated .bundle-files (and other resources) can be found twice: once in the root directory and once more in the .framework-directory of the corresponding framework.

This issue can be reproduced with the example project contained in this repo, here are part of the contents (I excluded the development pods) of PodBinCacheExample.app:

Screen Shot 2021-04-09 at 16 32 26

Note how there is a duplicate of SVProgressHUD.bundle present in the root directory of the app. The same thing happens with MJRefresh.bundle in the sample app.

To me, it looks like the [CP] Copy Pods Resources-phase (Pods-PodBinCacheExample-resources.sh) of the target copies all kinds of resources (even files which are part of asset catalogues?) into the root directly when using cocoapods-binary-cache. In the best case this simply increases the app's size but we've noticed that this apparently leads to .lproj-files being overwritten because some of our included Pods contain their own localization files.

Environment

Plugin version

cocoapods-binary-cache version 0.1.14 CocoaPods version 1.10.1

Installed CocoaPods plugins

Installed CocoaPods Plugins:
    - cocoapods-binary-cache : 0.1.14 (pre_install and post_install hooks)
    - cocoapods-deintegrate  : 1.0.4
    - cocoapods-plugins      : 1.0.0
    - cocoapods-search       : 1.0.0
    - cocoapods-trunk        : 1.5.0
    - cocoapods-try          : 1.2.0
trinhngocthuyen commented 3 years ago

Thanks for reaching out! We acknowledge this issue. It happens with dynamic frameworks with resources/resource_bundles. We'll look into the fix. In the meantime, you might probably want to turn the given pods into static frameworks as a fix.

trinhngocthuyen commented 3 years ago

Should be resolved in https://github.com/grab/cocoapods-binary-cache/commit/d366f1084c55b0a0533edaebc3e337194c783868. Kindly check it out. Thank you!

richardneitzke commented 3 years ago

I can confirm that the issue has been resolved on d366f10 for our use case (we use XCFrameworks). We will check more thoroughly over the next couple of days.

Thank you for the quick fix!