From feb16d8d0156a475538e817b649e06d1f8d0cdc3 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 4 May 2018 13:20:17 -0700 Subject: [PATCH] Build App.framework for all requested architectures (#17296) In debug mode iOS builds, we build a stub App.framework with no functionality, since the engine itself loads the code from the included bundle and subsequently via hot reload. This is simply done for consistency with profile/release AOT app structure. To satisfy the linker, ensure that we're building this code for all build architectures, not just CURRENT_ARCH. This is pre-work for supporting arbitrary iOS architectures (armv7, arm64, universal) in Flutter. --- packages/flutter_tools/bin/xcode_backend.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 0a28046b8c..a42537c2bf 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -130,8 +130,16 @@ BuildApp() { RunCommand cp -r -- "${build_dir}/aot/App.framework" "${derived_dir}" else RunCommand mkdir -p -- "${derived_dir}/App.framework" + + # Build stub for all requested architectures. + local arch_flags="" + read -r -a archs <<< "$ARCHS" + for arch in "${archs[@]}"; do + arch_flags="${arch_flags}-arch $arch " + done + RunCommand eval "$(echo "static const int Moo = 88;" | xcrun clang -x c \ - -arch "$CURRENT_ARCH" \ + ${arch_flags} \ -dynamiclib \ -Xlinker -rpath -Xlinker '@executable_path/Frameworks' \ -Xlinker -rpath -Xlinker '@loader_path/Frameworks' \