Pods-OneCable-frameworks.sh 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #!/bin/sh
  2. set -e
  3. echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  4. mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  5. SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
  6. install_framework()
  7. {
  8. if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
  9. local source="${BUILT_PRODUCTS_DIR}/$1"
  10. elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
  11. local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
  12. elif [ -r "$1" ]; then
  13. local source="$1"
  14. fi
  15. local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  16. if [ -L "${source}" ]; then
  17. echo "Symlinked..."
  18. source="$(readlink "${source}")"
  19. fi
  20. # use filter instead of exclude so missing patterns dont' throw errors
  21. echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
  22. rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
  23. local basename
  24. basename="$(basename -s .framework "$1")"
  25. binary="${destination}/${basename}.framework/${basename}"
  26. if ! [ -r "$binary" ]; then
  27. binary="${destination}/${basename}"
  28. fi
  29. # Strip invalid architectures so "fat" simulator / device frameworks work on device
  30. if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
  31. strip_invalid_archs "$binary"
  32. fi
  33. # Resign the code if required by the build settings to avoid unstable apps
  34. code_sign_if_enabled "${destination}/$(basename "$1")"
  35. # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
  36. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
  37. local swift_runtime_libs
  38. swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
  39. for lib in $swift_runtime_libs; do
  40. echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
  41. rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
  42. code_sign_if_enabled "${destination}/${lib}"
  43. done
  44. fi
  45. }
  46. # Signs a framework with the provided identity
  47. code_sign_if_enabled() {
  48. if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
  49. # Use the current code_sign_identitiy
  50. echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
  51. local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
  52. if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
  53. code_sign_cmd="$code_sign_cmd &"
  54. fi
  55. echo "$code_sign_cmd"
  56. eval "$code_sign_cmd"
  57. fi
  58. }
  59. # Strip invalid architectures
  60. strip_invalid_archs() {
  61. binary="$1"
  62. # Get architectures for current file
  63. archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
  64. stripped=""
  65. for arch in $archs; do
  66. if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
  67. # Strip non-valid architectures in-place
  68. lipo -remove "$arch" -output "$binary" "$binary" || exit 1
  69. stripped="$stripped $arch"
  70. fi
  71. done
  72. if [[ "$stripped" ]]; then
  73. echo "Stripped $binary of architectures:$stripped"
  74. fi
  75. }
  76. if [[ "$CONFIGURATION" == "Debug" ]]; then
  77. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
  78. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking-Synchronous/AFNetworking_Synchronous.framework"
  79. install_framework "$BUILT_PRODUCTS_DIR/Aspects/Aspects.framework"
  80. install_framework "$BUILT_PRODUCTS_DIR/AsyncDisplayKit/AsyncDisplayKit.framework"
  81. install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
  82. install_framework "$BUILT_PRODUCTS_DIR/ClusterPrePermissions/ClusterPrePermissions.framework"
  83. install_framework "$BUILT_PRODUCTS_DIR/CocoaLumberjack/CocoaLumberjack.framework"
  84. install_framework "$BUILT_PRODUCTS_DIR/FLEX/FLEX.framework"
  85. install_framework "$BUILT_PRODUCTS_DIR/HeapInspector/HeapInspector.framework"
  86. install_framework "$BUILT_PRODUCTS_DIR/JGProgressHUD/JGProgressHUD.framework"
  87. install_framework "$BUILT_PRODUCTS_DIR/JSONModel/JSONModel.framework"
  88. install_framework "$BUILT_PRODUCTS_DIR/JYRefreshController/JYRefreshController.framework"
  89. install_framework "$BUILT_PRODUCTS_DIR/LDProgressView/LDProgressView.framework"
  90. install_framework "$BUILT_PRODUCTS_DIR/Masonry/Masonry.framework"
  91. install_framework "$BUILT_PRODUCTS_DIR/PINCache/PINCache.framework"
  92. install_framework "$BUILT_PRODUCTS_DIR/PINRemoteImage/PINRemoteImage.framework"
  93. install_framework "$BUILT_PRODUCTS_DIR/ReactiveObjC/ReactiveObjC.framework"
  94. install_framework "$BUILT_PRODUCTS_DIR/SDWebImage/SDWebImage.framework"
  95. install_framework "$BUILT_PRODUCTS_DIR/SocketRocket/SocketRocket.framework"
  96. install_framework "$BUILT_PRODUCTS_DIR/Valet/Valet.framework"
  97. install_framework "$BUILT_PRODUCTS_DIR/WYPopoverController/WYPopoverController.framework"
  98. fi
  99. if [[ "$CONFIGURATION" == "Release" ]]; then
  100. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
  101. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking-Synchronous/AFNetworking_Synchronous.framework"
  102. install_framework "$BUILT_PRODUCTS_DIR/Aspects/Aspects.framework"
  103. install_framework "$BUILT_PRODUCTS_DIR/AsyncDisplayKit/AsyncDisplayKit.framework"
  104. install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
  105. install_framework "$BUILT_PRODUCTS_DIR/ClusterPrePermissions/ClusterPrePermissions.framework"
  106. install_framework "$BUILT_PRODUCTS_DIR/CocoaLumberjack/CocoaLumberjack.framework"
  107. install_framework "$BUILT_PRODUCTS_DIR/FLEX/FLEX.framework"
  108. install_framework "$BUILT_PRODUCTS_DIR/HeapInspector/HeapInspector.framework"
  109. install_framework "$BUILT_PRODUCTS_DIR/JGProgressHUD/JGProgressHUD.framework"
  110. install_framework "$BUILT_PRODUCTS_DIR/JSONModel/JSONModel.framework"
  111. install_framework "$BUILT_PRODUCTS_DIR/JYRefreshController/JYRefreshController.framework"
  112. install_framework "$BUILT_PRODUCTS_DIR/LDProgressView/LDProgressView.framework"
  113. install_framework "$BUILT_PRODUCTS_DIR/Masonry/Masonry.framework"
  114. install_framework "$BUILT_PRODUCTS_DIR/PINCache/PINCache.framework"
  115. install_framework "$BUILT_PRODUCTS_DIR/PINRemoteImage/PINRemoteImage.framework"
  116. install_framework "$BUILT_PRODUCTS_DIR/ReactiveObjC/ReactiveObjC.framework"
  117. install_framework "$BUILT_PRODUCTS_DIR/SDWebImage/SDWebImage.framework"
  118. install_framework "$BUILT_PRODUCTS_DIR/SocketRocket/SocketRocket.framework"
  119. install_framework "$BUILT_PRODUCTS_DIR/Valet/Valet.framework"
  120. install_framework "$BUILT_PRODUCTS_DIR/WYPopoverController/WYPopoverController.framework"
  121. fi
  122. if [[ "$CONFIGURATION" == "AdHoc" ]]; then
  123. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
  124. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking-Synchronous/AFNetworking_Synchronous.framework"
  125. install_framework "$BUILT_PRODUCTS_DIR/Aspects/Aspects.framework"
  126. install_framework "$BUILT_PRODUCTS_DIR/AsyncDisplayKit/AsyncDisplayKit.framework"
  127. install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
  128. install_framework "$BUILT_PRODUCTS_DIR/ClusterPrePermissions/ClusterPrePermissions.framework"
  129. install_framework "$BUILT_PRODUCTS_DIR/CocoaLumberjack/CocoaLumberjack.framework"
  130. install_framework "$BUILT_PRODUCTS_DIR/FLEX/FLEX.framework"
  131. install_framework "$BUILT_PRODUCTS_DIR/HeapInspector/HeapInspector.framework"
  132. install_framework "$BUILT_PRODUCTS_DIR/JGProgressHUD/JGProgressHUD.framework"
  133. install_framework "$BUILT_PRODUCTS_DIR/JSONModel/JSONModel.framework"
  134. install_framework "$BUILT_PRODUCTS_DIR/JYRefreshController/JYRefreshController.framework"
  135. install_framework "$BUILT_PRODUCTS_DIR/LDProgressView/LDProgressView.framework"
  136. install_framework "$BUILT_PRODUCTS_DIR/Masonry/Masonry.framework"
  137. install_framework "$BUILT_PRODUCTS_DIR/PINCache/PINCache.framework"
  138. install_framework "$BUILT_PRODUCTS_DIR/PINRemoteImage/PINRemoteImage.framework"
  139. install_framework "$BUILT_PRODUCTS_DIR/ReactiveObjC/ReactiveObjC.framework"
  140. install_framework "$BUILT_PRODUCTS_DIR/SDWebImage/SDWebImage.framework"
  141. install_framework "$BUILT_PRODUCTS_DIR/SocketRocket/SocketRocket.framework"
  142. install_framework "$BUILT_PRODUCTS_DIR/Valet/Valet.framework"
  143. install_framework "$BUILT_PRODUCTS_DIR/WYPopoverController/WYPopoverController.framework"
  144. fi
  145. if [[ "$CONFIGURATION" == "Product" ]]; then
  146. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking/AFNetworking.framework"
  147. install_framework "$BUILT_PRODUCTS_DIR/AFNetworking-Synchronous/AFNetworking_Synchronous.framework"
  148. install_framework "$BUILT_PRODUCTS_DIR/Aspects/Aspects.framework"
  149. install_framework "$BUILT_PRODUCTS_DIR/AsyncDisplayKit/AsyncDisplayKit.framework"
  150. install_framework "$BUILT_PRODUCTS_DIR/Bolts/Bolts.framework"
  151. install_framework "$BUILT_PRODUCTS_DIR/ClusterPrePermissions/ClusterPrePermissions.framework"
  152. install_framework "$BUILT_PRODUCTS_DIR/CocoaLumberjack/CocoaLumberjack.framework"
  153. install_framework "$BUILT_PRODUCTS_DIR/FLEX/FLEX.framework"
  154. install_framework "$BUILT_PRODUCTS_DIR/HeapInspector/HeapInspector.framework"
  155. install_framework "$BUILT_PRODUCTS_DIR/JGProgressHUD/JGProgressHUD.framework"
  156. install_framework "$BUILT_PRODUCTS_DIR/JSONModel/JSONModel.framework"
  157. install_framework "$BUILT_PRODUCTS_DIR/JYRefreshController/JYRefreshController.framework"
  158. install_framework "$BUILT_PRODUCTS_DIR/LDProgressView/LDProgressView.framework"
  159. install_framework "$BUILT_PRODUCTS_DIR/Masonry/Masonry.framework"
  160. install_framework "$BUILT_PRODUCTS_DIR/PINCache/PINCache.framework"
  161. install_framework "$BUILT_PRODUCTS_DIR/PINRemoteImage/PINRemoteImage.framework"
  162. install_framework "$BUILT_PRODUCTS_DIR/ReactiveObjC/ReactiveObjC.framework"
  163. install_framework "$BUILT_PRODUCTS_DIR/SDWebImage/SDWebImage.framework"
  164. install_framework "$BUILT_PRODUCTS_DIR/SocketRocket/SocketRocket.framework"
  165. install_framework "$BUILT_PRODUCTS_DIR/Valet/Valet.framework"
  166. install_framework "$BUILT_PRODUCTS_DIR/WYPopoverController/WYPopoverController.framework"
  167. fi
  168. if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
  169. wait
  170. fi