Created
December 20, 2011 14:34
-
-
Save steipete/1501754 to your computer and use it in GitHub Desktop.
Use Xcode to automatically set git hash
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
git=`sh /etc/profile; which git` | |
version=`$git describe --tags --always` | |
count=`$git rev-list --all |wc -l` | |
echo -e "#define GIT_VERSION $version\n#define GIT_COMMIT_COUNT $count" > InfoPlist.h |
When where and how do you make use of this script? I must be doing something wrong:
Edit schemes
Select Build->Pre-Actions
Provide Build Settings From (My App Target)
Pasting in the script
Now Run, or Select Product Build
I don't see anything in the project folder or the console that gives me any indication the this is working or not working.
Can I get a hint?
Got it ... found your blog post that references this.
What I'd like to see is a means of triggering git describe –abbrev=0 –tags
automatically based on the build configuration or the selected scheme, that way I don't need to have a separate target for the distribution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Your script doesn't show the tag, that's why I chose git describe. Otherwise pretty similar. The git-binary-lookup is nice!