From eda228404ce9bd0ddfd1594b45836f19eea4a517 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 26 Sep 2018 00:57:39 +0200 Subject: [PATCH] Strip debug symbols from App.framework for non-debug builds (#22245) A dSYM file is created for the stripped `App.framework` and placed at `build/aot/App.dSYM`. Reduces `App.framework` for Flutter Gallery by 6MB uncompressed, minus 23%. Reduces `App.framework` for Hello World by 1.6MB uncompressed, minus 22%. Fixes #4287. Fixes #18693. Helps with #21813. See also #12012. This change depends on https://dart-review.googlesource.com/c/sdk/+/76306. --- packages/flutter_tools/bin/xcode_backend.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/flutter_tools/bin/xcode_backend.sh b/packages/flutter_tools/bin/xcode_backend.sh index 655040ab274..c8b61898390 100755 --- a/packages/flutter_tools/bin/xcode_backend.sh +++ b/packages/flutter_tools/bin/xcode_backend.sh @@ -141,7 +141,26 @@ BuildApp() { fi StreamOutput "done" - RunCommand cp -r -- "${build_dir}/aot/App.framework" "${derived_dir}" + local app_framework="${build_dir}/aot/App.framework" + + RunCommand cp -r -- "${app_framework}" "${derived_dir}" + + StreamOutput " ├─Generating dSYM file..." + RunCommand xcrun dsymutil -o "${build_dir}/aot/App.dSYM" "${app_framework}/App" + if [[ $? -ne 0 ]]; then + EchoError "Failed to generate debug symbols (dSYM) file for ${app_framework}/App." + exit -1 + fi + StreamOutput "done" + + StreamOutput " ├─Stripping debug symbols..." + RunCommand xcrun strip -x -S "${derived_dir}/App.framework/App" + if [[ $? -ne 0 ]]; then + EchoError "Failed to strip ${derived_dir}/App.framework/App." + exit -1 + fi + StreamOutput "done" + else RunCommand mkdir -p -- "${derived_dir}/App.framework"