• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: storing git version in the plist
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: storing git version in the plist


  • Subject: Re: storing git version in the plist
  • From: Joel Reymont <email@hidden>
  • Date: Tue, 04 Dec 2012 23:36:34 +0000

Yes, PlistBuddy in a build phase works. 

You don't even need to run it multiple times, just pass -c ... as many times as needed. 

--
http://www.linkedin.com/in/joelreymont

On Tuesday, December 4, 2012 at 11:29 PM, Marco S Hyman wrote:

Are you saying that you can commit, make a small change to some target dependent on versioning, build and reliably get Xcode to preprocess the plist for you?

I have a run script as part of the build phase. The script does:

sed -e "s/#.*#/#`/usr/local/bin/git describe`#/" <Sources/Credits-input.rtf >Credits.rtf
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $(git describe --abbrev=0 | cut -b 2-)" "${TARGET_BUILD_DIR}"/${INFOPLIST_PATH}
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(git log --pretty=oneline --abbrev-commit -1 | cut -b 1-7)" "${TARGET_BUILD_DIR}"/${INFOPLIST_PATH}

That seems to work. The Info.plist in the generated bundle contains

<key>CFBundleShortVersionString</key>
<string>2.2</string>
...
<key>CFBundleVersion</key>
<string>55d9ec5</string>

Yeah, using a git sha is the wrong thing for CFBundleVersion. This code was written before I knew better and I've been too lazy to change it.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >storing git version in the plist (From: Joel Reymont <email@hidden>)
 >Re: storing git version in the plist (From: Joel Reymont <email@hidden>)
 >Re: storing git version in the plist (From: Wim Lewis <email@hidden>)
 >Re: storing git version in the plist (From: Joel Reymont <email@hidden>)
 >Re: storing git version in the plist (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: storing git version in the plist
  • Next by Date: Re: storing git version in the plist
  • Previous by thread: Re: storing git version in the plist
  • Next by thread: Printing dynamic arrays in LLDB
  • Index(es):
    • Date
    • Thread