Last active
June 19, 2016 06:36
-
-
Save DerekK19/4aebcc3a370295c6686f65700385629e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
# Script used in XCode build phase to bring Carthage dependencies up to date | |
# Will check if the Cartfile is newer than the Cartfile.resolved, and if so | |
# Will bring the Carthage checkouts up to date | |
# If the checkouts are newer than the build | |
# Will bring the build up to date | |
# | |
# Derek Knight | |
# Jun 2016 | |
if [ -z "$CONFIGURATION" ]; then | |
CONFIGURATION="Release" | |
fi | |
if [ -z "$PLATFORM" ]; then | |
PLATFORM="iOS" | |
fi | |
if [ "Cartfile" -nt "Cartfile.resolved" ]; then | |
echo "Cartfile is newer than source, removing source" | |
rm -rf Carthage/Checkouts | |
fi | |
if ! [ -d "Carthage/Checkouts" ]; then | |
echo "Source doesn't exist, checking out" | |
env -i /usr/local/bin/carthage update --no-build --platform $PLATFORM --configuration $CONFIGURATION $* | |
rm -rf Carthage/Build/$PLATFORM | |
fi | |
if [ -d "Carthage/Build/$PLATFORM" ]; then | |
echo "$PLATFORM Build exists" | |
else | |
echo "Build doesn't exist, building" | |
env -i /usr/local/bin/carthage build --platform $PLATFORM --configuration $CONFIGURATION $* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I save this as /usr/local/bin/carthage-xcode, then my Xcode run Script task "Update/Build Carthage Dependencies" is just one line:
/usr/local/bin/carthage-xcode