From b16a515d9c1fcfbaedd400fe07a9b41c5a7961ac Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 7 Feb 2017 15:57:16 -0800 Subject: [PATCH] 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. --- packages/flutter_tools/bin/xcode_backend.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index d4d7b3f500..e4d4fe559d 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -141,13 +141,22 @@ LipoExecutable() { 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