Handle non-fat frameworks in iOS app framework thinning (#7950)

Support for thinning app frameworks to the target architecture was added
in 708909fc6b. 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.
This commit is contained in:
Chris Bracken
2017-02-07 15:57:16 -08:00
committed by GitHub
parent 2eb4f2c37a
commit b16a515d9c

View File

@@ -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