Bitcode disabled on Carthage dependencies

大憨熊 提交于 2019-12-07 13:34:02

问题


Scenario

My project (codebase shared for iOS/watchOS/tvOS ) has build settings with ENABLE_BITCODE = YES and takes advantage of fundamental libraries which are not yet supporting bitcode, although quoting Apple documentation in App Thinning

Bitcode is the default, but optional. For watchOS and tvOS apps, bitcode is required. If you provide bitcode, all apps and frameworks in the app bundle (all targets in the project) need to include bitcode

I am currently integrating those fundamental libraries with Carthage.

Problem

In order to have a clean build process, I tried to submit some pull requests to the respective owners for enabling the bitcode but, due to the complexity of their codebases, which are working for multiple operating systems/architectures, my pull requests are still in pending: so, to be able to build my own project, I still have to change manually their build settings.

Question

How can I short-circuit the Carthage process for injecting specific build settings (in this case ENABLE_BITCODE = YES) into the relevant libraries?


回答1:


I found a solution by making a shell script able to erase the disabling of bitcode, in case someone is facing or curious to solve a similar problem, the script is this:

carthage update --platform ios
for D in ./Carthage/Checkouts/*; do
  if [ -d "${D}" ]; then
    find $D -type d -name \*.xcodeproj -print0 |
      while IFS= read -r -d $'\0' folder; do
        sed -i '' 's/ENABLE_BITCODE = NO;//g' $folder/project.pbxproj
      done
    fi
done
carthage build --platform ios

so basically the script's mechanism is:

  1. downloading all the dependencies
  2. for each dependency, find thepbxproj living inside xcodeproj and cut off the string ENABLE_BITCODE = NO
  3. finally building the dependencies to make the .framework


来源:https://stackoverflow.com/questions/47431964/bitcode-disabled-on-carthage-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!