Skip to content
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

[helix][ios] Emulate deep signing of iOS app bundles on helix in order to support library mode builds #14164

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function die ()

function sign ()
{
echo "Signing $1"
echo "Signing bundle $1"

provisioning_profile="$1/embedded.mobileprovision"
if [ ! -f "$provisioning_profile" ]; then
Expand Down Expand Up @@ -104,8 +104,22 @@ function sign ()
security cms -D -i "$provisioning_profile" > provision.plist
/usr/libexec/PlistBuddy -x -c 'Print :Entitlements' provision.plist > entitlements.plist

# Sign the app
/usr/bin/codesign -v --force --sign "Apple Development" --keychain "$keychain_name" --entitlements entitlements.plist "$1"
# Perform deep signing - sign all .app, .framework and Mach-O files by respecting bundle hierarchy (deepest files are signed first)
for file_in_bundle in $(find "$1" -d 2>/dev/null); do

file_name=$(basename -- "$file_in_bundle")
file_extension="${file_name##*.}"
is_macho=$(file -b $file_in_bundle | grep Mach-O)

if [ "$file_extension" = "app" ] || [ "$file_extension" = "framework" ] || [ ! -z "${is_macho}" ]; then
echo "Signing file $file_in_bundle"
if [ "$file_extension" = "app" ]; then
/usr/bin/codesign -v --force --sign "Apple Development" --keychain "$keychain_name" --entitlements entitlements.plist "$file_in_bundle"
else
/usr/bin/codesign -v --force --sign "Apple Development" --keychain "$keychain_name" --preserve-metadata=identifier,entitlements,flags "$file_in_bundle"
fi
fi
done
}

if [ -z "$app" ]; then
Expand Down
Loading