-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[No QA] Strip debug symbols from production iOS binaries #83249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
28c1f7d
Strip debug symbols from iOS production binaries
roryabraham f36b9a6
Fix dependency cycle by removing dSYM inputPath from Strip Debug Symb…
roryabraham 7bac0ea
Fix: use -exec pattern for framework stripping and add diagnostics
roryabraham c590cb7
Fix: find framework binaries by name convention, not permission bits
roryabraham d46181d
Merge remote-tracking branch 'origin/main' into rory-strip-debug-symbols
roryabraham 27f8a32
Add 'codesign' to cspell dictionary
roryabraham 2650aad
Re-sign frameworks after stripping to restore code signatures
roryabraham bacf4c9
Merge remote-tracking branch 'origin/main' into rory-strip-debug-symbols
roryabraham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,7 @@ | |
| "cocoapods", | ||
| "Codat", | ||
| "codegen", | ||
| "codesign", | ||
| "codeshare", | ||
| "Codice", | ||
| "Combustors", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/bin/bash | ||
| # | ||
| # Strips debug symbols from the app binary and embedded frameworks for non-Debug builds. | ||
| # This reduces the IPA size by ~22MB without affecting crash symbolication, because Xcode | ||
| # generates dSYMs from the unstripped binary before this phase runs. | ||
| # | ||
| # Expected Xcode environment variables: | ||
| # CONFIGURATION, BUILT_PRODUCTS_DIR, EXECUTABLE_FOLDER_PATH, EXECUTABLE_NAME, | ||
| # EXPANDED_CODE_SIGN_IDENTITY | ||
|
|
||
| set -e | ||
|
|
||
| case "$CONFIGURATION" in | ||
| Debug*) | ||
| echo "Skipping symbol stripping for $CONFIGURATION build." | ||
| exit 0 | ||
| ;; | ||
| esac | ||
|
|
||
| APP_DIR_PATH="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}" | ||
|
|
||
| echo "Stripping main binary: ${APP_DIR_PATH}/${EXECUTABLE_NAME}" | ||
| strip -rSTx "${APP_DIR_PATH}/${EXECUTABLE_NAME}" | ||
|
|
||
| APP_FRAMEWORKS_DIR="${APP_DIR_PATH}/Frameworks" | ||
| if [ -d "$APP_FRAMEWORKS_DIR" ]; then | ||
| find "$APP_FRAMEWORKS_DIR" -name "*.framework" -maxdepth 1 -type d | while read -r framework_dir; do | ||
| framework_name=$(basename "$framework_dir" .framework) | ||
| framework_binary="$framework_dir/$framework_name" | ||
| if [ ! -f "$framework_binary" ]; then | ||
| continue | ||
| fi | ||
| if codesign -v -R="anchor apple" "$framework_binary" &> /dev/null; then | ||
| echo "Skipping Apple-signed: $framework_name" | ||
| continue | ||
| fi | ||
| echo "Stripping framework: $framework_name" | ||
| strip -rSTx "$framework_binary" | ||
| codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY:--}" --preserve-metadata=identifier,entitlements "$framework_dir" | ||
| done | ||
| else | ||
| echo "No Frameworks directory found at $APP_FRAMEWORKS_DIR" | ||
| fi | ||
|
|
||
| echo "Symbol stripping complete." | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.