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.
This commit is contained in:
Michael Goderbauer 2018-09-26 00:57:39 +02:00 committed by GitHub
parent f330e27dbd
commit eda228404c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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