Skip to content

Instantly share code, notes, and snippets.

@Nelyus
Last active September 21, 2015 14:05
Show Gist options
  • Save Nelyus/8510632b2e04f774aa08 to your computer and use it in GitHub Desktop.
Save Nelyus/8510632b2e04f774aa08 to your computer and use it in GitHub Desktop.
Copy frameworks build by carthage to the target build dir, so Xcode can find them more easily (for exemple in playgrounds)
#!/usr/bin/env sh
# Carthage build dirs per platform
CARTHAGE_IOS_BUILD_DIR="Carthage/Build/iOS"
CARTHAGE_MAC_BUILD_DIR="Carthage/Build/Mac"
if [ "$PLATFORM_NAME" = "iphoneos" -o "$PLATFORM_NAME" = "iphonesimulator" ]; then
CARTHAGE_BUILD_DIR="$CARTHAGE_IOS_BUILD_DIR"
elif [ "$PLATFORM_NAME" = "macosx" ]; then
CARTHAGE_BUILD_DIR="$CARTHAGE_MAC_BUILD_DIR"
else
echo "unknown PLATFORM_NAME $PLATFORM_NAME"
echo '(this script is intended to be run from a script build phase in Xcode)'
exit 1
fi
if [ -z "$TARGET_BUILD_DIR" ]; then
echo 'TARGET_BUILD_DIR not specified'
echo '(this script is intended to be run from a script build phase in Xcode)'
exit 1
fi
echo copying from $PWD/$CARTHAGE_BUILD_DIR
echo to $TARGET_BUILD_DIR
for source in "$CARTHAGE_BUILD_DIR"/*; do
destination="$TARGET_BUILD_DIR/$(basename "$source")"
if [ "$source" -nt "$destination" ]; then
echo "--> rm $destination"
rm -vrf "$destination"
cp -vr "$source" "$destination"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment