Re: Updating a Build Number
Re: Updating a Build Number
- Subject: Re: Updating a Build Number
- From: Paul M <email@hidden>
- Date: Sun, 28 Jun 2009 20:14:42 +1200
A while back I asked about updating a timespec to be available from
within my code. With thanks to those on the list, I got a pretty simple
technique working that should work in this case too.
First I created a shell script build phase. (In my case this 'script'
simply invokes an actual shell script - I wanted a real script I could
edit separately, not a series of commands shell buried in xcode.)
This script generates a separate header file with the timespec, in the
form I want, defined in it. It also includes some other processing such
that the header only gets written once per day not every time the app
is built. This obviously wont apply to you, but the point is, you can
do what you like in this script, depending on your choice of scripting
language.
The script also writes a message into the header file that it's a
machine generated file and should not be edited.
And that's all there is to it in my case.
How this can be adapted to your use depends on where you want your
build number to end up - if you need it visible in code, your case can
be very similar to mine, if you need it in a plist, that may be
different depending on order of processing in xcode. Maybe your script
could call agvtool - I'm not familiar with this tool though, so
apologies if that's nonsense.
If anyone wants the contents of my actual scripts and files, I'd be
happy to share.
paulm
On 27/06/2009, at 8:36 AM, Seth Willits wrote:
On Jun 24, 2009, at 7:58 AM, Scott Tooker wrote:
If you are just looking to increment a simple build number, I'd
strongly encourage you to look at the agvtool tool provided as part
of Xcode Tools (man agvtool). This provides a convenient way to
easily version different builds of you application without having to
manually edit your Info.plist.
I just looked at this (I read Chris Hanson's blog since the man page
wasn't clear enough for me). I think it's a bit silly. Why should I
have to quite Xcode just to increment the build number? Any time I
build my "Release" configuration, I simply want the build number to
increase. I don't see why it should be any more complicated than that
(at least in my situation), so I created that simple build script.
Xcode doesn't like it though.
When building a target, Xcode processes Info.plist before anything
else. This means that it creates a plist file and moves it into the
build products folder, *then*, my script is executed which increases
the value in the source products' Info.plist file. So the number in
the source-products is actually N+1 rather than being the same number.
The problem there is that if I then commit the code, it's not the
right value relative to the code. So that's kinda sucky.
The bigger problem though is that if I do a build, let's say the
version is 100 in the final built app, and Info.plist in the source
folder says 101. If I build again, Info.plist is updated to 102, but
*VERY VERY OFTEN* the app's Info.plist is left unchanged -- it'd still
be 100. Then I have to wack build again, and it then jumps to 102. I
don't know what the heck is going on here, but it's annoying. :\
A third problem is that I have a build script at the very end of
building which is supposed to zip the file for me and create a digital
signature on it for Sparkle and some other things, but that happens
*before* code signing so it's not zipping the correct/final result.
There seems to be no way to change this.
The solution I see to all of this is to create a build script fired of
from Terminal that uses agvtool to do the build and then do all of my
post processing. But quitting Xcode is not exactly my idea of
use-friendliness. I'll try avoiding agvtool and making my own
incrementing script so that Xcode doesn't need to be quit.
It seems like this really should be simpler given that everyone needs
to do it. :-\
--
Seth Willits
_______________________________________________
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
_______________________________________________
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