Skip to content

Instantly share code, notes, and snippets.

@JoeMatt
Created September 14, 2015 16:41
Show Gist options
  • Save JoeMatt/ac39261692f67bbe9e5d to your computer and use it in GitHub Desktop.
Save JoeMatt/ac39261692f67bbe9e5d to your computer and use it in GitHub Desktop.
#!/bin/sh
#set -e
#set -o pipefail
# Fix code signing in embedded iOS frameworks
destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "destination ${destination}"
## Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
/usr/bin/codesign --force --verbose --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
fi
}
export -f code_sign_if_enabled
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
find "${destination}" -iname "*.Framework" -print0 | xargs -0 -n1 bash -c 'code_sign_if_enabled "$@"' _
fi
if [[ "$CONFIGURATION" == "Debug" ]]; then
destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
# put your parents frameworks here
code_sign_if_enabled "${destination}/HNCoreBaseLibrary.framework"
code_sign_if_enabled "${destination}/HNCoreTouchLibrary.framework"
code_sign_if_enabled "${destination}/PremiumKit.framework"
code_sign_if_enabled "${destination}/PremiumUIKit.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
# !!!! put your parents frameworks here
code_sign_if_enabled "${destination}/Example1.framework"
code_sign_if_enabled "${destination}/Example2.framework"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment