Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Pods-Runner-frameworks.sh 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #!/bin/sh
  2. set -e
  3. set -u
  4. set -o pipefail
  5. if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
  6. # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
  7. # frameworks to, so exit 0 (signalling the script phase was successful).
  8. exit 0
  9. fi
  10. echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  11. mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  12. COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
  13. SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
  14. # Used as a return value for each invocation of `strip_invalid_archs` function.
  15. STRIP_BINARY_RETVAL=0
  16. # This protects against multiple targets copying the same framework dependency at the same time. The solution
  17. # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
  18. RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
  19. # Copies and strips a vendored framework
  20. install_framework()
  21. {
  22. if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
  23. local source="${BUILT_PRODUCTS_DIR}/$1"
  24. elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
  25. local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
  26. elif [ -r "$1" ]; then
  27. local source="$1"
  28. fi
  29. local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  30. if [ -L "${source}" ]; then
  31. echo "Symlinked..."
  32. source="$(readlink "${source}")"
  33. fi
  34. # Use filter instead of exclude so missing patterns don't throw errors.
  35. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
  36. rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
  37. local basename
  38. basename="$(basename -s .framework "$1")"
  39. binary="${destination}/${basename}.framework/${basename}"
  40. if ! [ -r "$binary" ]; then
  41. binary="${destination}/${basename}"
  42. fi
  43. # Strip invalid architectures so "fat" simulator / device frameworks work on device
  44. if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
  45. strip_invalid_archs "$binary"
  46. fi
  47. # Resign the code if required by the build settings to avoid unstable apps
  48. code_sign_if_enabled "${destination}/$(basename "$1")"
  49. # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
  50. if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
  51. local swift_runtime_libs
  52. swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
  53. for lib in $swift_runtime_libs; do
  54. echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
  55. rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
  56. code_sign_if_enabled "${destination}/${lib}"
  57. done
  58. fi
  59. }
  60. # Copies and strips a vendored dSYM
  61. install_dsym() {
  62. local source="$1"
  63. if [ -r "$source" ]; then
  64. # Copy the dSYM into a the targets temp dir.
  65. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
  66. rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
  67. local basename
  68. basename="$(basename -s .framework.dSYM "$source")"
  69. binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
  70. # Strip invalid architectures so "fat" simulator / device frameworks work on device
  71. if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
  72. strip_invalid_archs "$binary"
  73. fi
  74. if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
  75. # Move the stripped file into its final destination.
  76. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
  77. rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
  78. else
  79. # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
  80. touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
  81. fi
  82. fi
  83. }
  84. # Signs a framework with the provided identity
  85. code_sign_if_enabled() {
  86. if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
  87. # Use the current code_sign_identitiy
  88. echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
  89. local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
  90. if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
  91. code_sign_cmd="$code_sign_cmd &"
  92. fi
  93. echo "$code_sign_cmd"
  94. eval "$code_sign_cmd"
  95. fi
  96. }
  97. # Strip invalid architectures
  98. strip_invalid_archs() {
  99. binary="$1"
  100. # Get architectures for current target binary
  101. binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
  102. # Intersect them with the architectures we are building for
  103. intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
  104. # If there are no archs supported by this binary then warn the user
  105. if [[ -z "$intersected_archs" ]]; then
  106. echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
  107. STRIP_BINARY_RETVAL=0
  108. return
  109. fi
  110. stripped=""
  111. for arch in $binary_archs; do
  112. if ! [[ "${ARCHS}" == *"$arch"* ]]; then
  113. # Strip non-valid architectures in-place
  114. lipo -remove "$arch" -output "$binary" "$binary" || exit 1
  115. stripped="$stripped $arch"
  116. fi
  117. done
  118. if [[ "$stripped" ]]; then
  119. echo "Stripped $binary of architectures:$stripped"
  120. fi
  121. STRIP_BINARY_RETVAL=1
  122. }
  123. if [[ "$CONFIGURATION" == "Debug" ]]; then
  124. install_framework "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework"
  125. install_framework "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework"
  126. install_framework "${BUILT_PRODUCTS_DIR}/flutter_blue/flutter_blue.framework"
  127. install_framework "${BUILT_PRODUCTS_DIR}/screen/screen.framework"
  128. install_framework "${BUILT_PRODUCTS_DIR}/vibrate/vibrate.framework"
  129. install_framework "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework"
  130. fi
  131. if [[ "$CONFIGURATION" == "Release" ]]; then
  132. install_framework "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework"
  133. install_framework "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework"
  134. install_framework "${BUILT_PRODUCTS_DIR}/flutter_blue/flutter_blue.framework"
  135. install_framework "${BUILT_PRODUCTS_DIR}/screen/screen.framework"
  136. install_framework "${BUILT_PRODUCTS_DIR}/vibrate/vibrate.framework"
  137. install_framework "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework"
  138. fi
  139. if [[ "$CONFIGURATION" == "Profile" ]]; then
  140. install_framework "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework"
  141. install_framework "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework"
  142. install_framework "${BUILT_PRODUCTS_DIR}/flutter_blue/flutter_blue.framework"
  143. install_framework "${BUILT_PRODUCTS_DIR}/screen/screen.framework"
  144. install_framework "${BUILT_PRODUCTS_DIR}/vibrate/vibrate.framework"
  145. install_framework "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework"
  146. fi
  147. if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
  148. wait
  149. fi