Sign in to follow this  

Versioning your Software

This topic is 4161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You contstantly see applications with the Build number on them, like for example Xbox Media Center..it's currently on build like 5801 or something...I'm curious when people put that build number on them, are they keeping track of that themselves? or does the compiler do it? I'm curious because I have a bunch of applications that I constantly update and put on different computers, and I always get into trouble where some computers are using an older version and I forgot to update it, or I didn't put a place in the code for the version number. I realize for the bigger apps you build like auto updaters or something like that, but it hardly makes any sense to build something like that when the application itself only takes about 10 minutes to write. So I guess i'm looking for a solution to this, what do you guys do? Does everyone keep track of it all themselves? Thanks a bunch, ArchG

Share this post


Link to post
Share on other sites
I've generally seen it done with a #define in the code (EDIT: this version number should also go into any data files the system creates so you can detect if your loading data thats created with an older or newer version of the S/W). There is then label with the same name in perforce, or whatever, which is created when the new version goes online. Changing the version number is generally not something that can be automated, as it requires some intelligence.

Having a define is handy for libraries, as during the transition from one version to the next you can do stuff like...


#if MY_VERSION_NUM>2001
FancyNewFunction(this, that, theother);
#else
//Note: Obsolete code, should be deleted
CrappyOldFunction(this, that);
#endif



Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The way I do it for the project I am responsible for (it is a significant component of a large system) is use the current top change list number as the version. I have a simple line in my makefile that does something like the following (it is slightly more elaborate than this, but you should get the idea):

p4 changes -m 1 //depot/project_name | awk '{ print "#define BUILD_VERSION "; print $2; print ";" }' > version.h

All this does is create a header with a define for the build version.

If I were to do a build number that was public (i.e. not based on my actual revision control number), I would just have a text file that lived at the top of the tree (that also goes through revision control) and have tools to increment this value, but ultimately generate a similar header with the version number.

This particular idea is platform independent, but the implementation of the idea will be very build environment specific.

Care must also be taken that this header is not included everywhere (only in relevant subsystems, perhaps have a utility library that has a version accessor function so only the version utility library has a dependancy on the generated version.h header in order to prevent full rebuilds every time.

My $0.02

Share this post


Link to post
Share on other sites
one way of doing it is to run a little program before compiling that takes the version number from a source file, increments it and then saves it back.

There are IDEs out there that lets you specify programs to run before and after compilation.

Share this post


Link to post
Share on other sites

This topic is 4161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this