Handle non-fat frameworks in iOS app framework thinning (#7950)
Support for thinning app frameworks to the target architecture was added
in 708909fc6b4a6f50d024c0d36843883284001219. This commit adds support
and error-checking for non-fat frameworks that are not of the target
architecture. In such cases, we now fail the build, and emit an error
message and the contents of lipo -info for the affected framework.
diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh
index d4d7b3f..e4d4fe5 100755
--- a/packages/flutter_tools/bin/xcode_backend.sh
+++ b/packages/flutter_tools/bin/xcode_backend.sh
@@ -141,13 +141,22 @@
local all_executables=()
for arch in $archs; do
local output="${executable}_${arch}"
- lipo -output "${output}" -extract "${arch}" "${executable}"
- if [[ $? == 0 ]]; then
- all_executables+=("${output}")
+ local lipo_info=$(lipo -info "${executable}")
+ if [[ "${lipo_info}" == "Non-fat file:"* ]]; then
+ if [[ "${lipo_info}" != *"${arch}" ]]; then
+ echo "Non-fat binary ${executable} is not ${arch}. Running lipo -info:"
+ echo "${lipo_info}"
+ exit 1
+ fi
else
- echo "Failed to extract ${arch} for ${executable}. Running lipo -info:"
- lipo -info "${executable}"
- exit 1
+ lipo -output "${output}" -extract "${arch}" "${executable}"
+ if [[ $? == 0 ]]; then
+ all_executables+=("${output}")
+ else
+ echo "Failed to extract ${arch} for ${executable}. Running lipo -info:"
+ lipo -info "${executable}"
+ exit 1
+ fi
fi
done