Skip to content

Instantly share code, notes, and snippets.

@bradhowes
Last active January 27, 2022 15:39
Show Gist options
  • Save bradhowes/8f86a61924536e2e27dc23bc9fe269d7 to your computer and use it in GitHub Desktop.
Save bradhowes/8f86a61924536e2e27dc23bc9fe269d7 to your computer and use it in GitHub Desktop.
Simple script that is useful as a Build post-action to remove bogus embedded frameworks due to Swift packages.
#!/bin/bash
set -eu
echo "-- BEGIN post-build.sh"
function process # TOP EMBED
{
local TOP="${1}" EMBED="${2}"
cd "${CODESIGNING_FOLDER_PATH}/${TOP}"
ls -l
for DIR in *; do
BAD="${DIR}${EMBED}"
if [[ -d "${BAD}" ]]; then
echo "-- deleting '${BAD}'"
rm -rf "${BAD}"
fi
done
}
if [[ -d "${CODESIGNING_FOLDER_PATH}/Contents/Frameworks" ]]; then
# macOS paths
process "/Contents/Frameworks" "/Versions/A/Frameworks"
elif [[ -d "${CODESIGNING_FOLDER_PATH}/Frameworks" ]]; then
# iOS paths
process "/Frameworks" "/Frameworks"
fi
echo "-- END post-build.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment