Created
August 23, 2013 19:21
-
-
Save letiemble/6322996 to your computer and use it in GitHub Desktop.
When developing inside Xcode, use this script inside a "Run Script" build phase and place it before the "Compile Sources" one.
This file contains 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
# Receigen binary | |
RECEIGEN="/Applications/Receigen.app/Contents/MacOS/Receigen" | |
# Extract Info.plist information | |
INPUT="$INFOPLIST_FILE" | |
BUNDLE_ID=`/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "$INPUT"` | |
BUNDLE_VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INPUT"` | |
# Expand information if needed | |
EXPANDED_BUNDLE_ID=`eval "echo $BUNDLE_ID"` | |
EXPANDED_BUNDLE_VERSION=`eval "echo $BUNDLE_VERSION"` | |
# Make sure the destination directory exists | |
mkdir -p "$DERIVED_FILES_DIR" | |
HEADER="$DERIVED_FILES_DIR/receipt.h" | |
# Check if the generation is needed | |
if [ -e "$HEADER" ]; then | |
SKIP=`grep -q "$EXPANDED_BUNDLE_ID" "$HEADER" && grep -q "$EXPANDED_BUNDLE_VERSION" "$HEADER" && echo "YES"` | |
fi | |
# Generate the header file if needed | |
if [ "x$SKIP" = "x" ]; then | |
"$RECEIGEN" --identifier "$EXPANDED_BUNDLE_ID" --version "$EXPANDED_BUNDLE_VERSION" --type receipt > "$HEADER" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment