Skip to content

Instantly share code, notes, and snippets.

@alexrozanski
Created January 1, 2014 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexrozanski/8206681 to your computer and use it in GitHub Desktop.
Save alexrozanski/8206681 to your computer and use it in GitHub Desktop.
Shell script which gets the version of a particular target from its info plist file
targetName="..."
# Thanks to http://stackoverflow.com/a/13871762/75245 for help with the parsing.
relativeInfoPlistLocation=`/usr/bin/xcrun xcodebuild -showBuildSettings -target ${targetName} 2>/dev/null | grep "INFOPLIST_FILE" | sed 's/[ ]*INFOPLIST_FILE = //'`
absoluteInfoPlistLocation=${PROJECT_DIR}/$relativeInfoPlistLocation
version=`/usr/libexec/Plistbuddy -c 'Print :CFBundleShortVersionString' $absoluteInfoPlistLocation`
@sdarlington
Copy link

Where does PROJECT_DIR get set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment