We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello
We have a uv4 project that I would like to be built using an automated build tool.
The simplest way given that we already have a working project is to call uv4 from the command line.
c:\keil\uv4\uv4.exe -b PROJECTNAME.uvproj -o BuildOutput.txt
This seems to work fine.
What I would now like to do is include an automatically generated build number in the build process. Searching on the forum I thought I had found a solution by having a define=environment variable in the C preprocessor symbols dialog. However it seems that uv4 does not read environment variables. I also cannot see a command line option that would help with this either.
Any suggestions? Do I need to convert to building using a makefile?
Thanks Stephen
By far the most universal solution to this will be to put your build number directly into an actual source file, e.g.
/* file: buildnumber.h */ #define BUILD_NUMBER 12345
That way any build tool will be able to find it and include it into the build.
Build number sounds like an outdated concept. What's wrong with version control systems?
Hi, we use the subversion revision as the build number and the tool SubWCRev.exe (tortoisesvn.net/.../tsvn-subwcrev.html) makes it usable in the source code. Or you can write a short batch file for generating the header file with the build number define and call it in a pre-build step.
BR Stefan
Absolutely nothing wrong with VCS. In fact this is specifically help with that.
The build number as I intend it is to allow builds to be tied to a known state in version control. Whether this is by including the changeset in the build number or labelling the version control with a build number I've not settled on.
Stephen
... how about __DATE__ and __TIME__ ?
The bad thing with __DATE__ and __TIME__ is that you can check out an old version of the source code and rebuild and produce something that looks like the latest and greatest.
And they don't allow old code to be rebuilt and able to recreate the same binary.
But wouldn't that also be the case with an automatic build number incrementer...?
Yes, if they are automatic as in "build_number = last_build_number+1".
But an automatic build process can also extract a build number from the repository or similar.
Sometimes, it can be good to have version control system tag + sequence number (or __TIME__) in the binary for in-house testing. Then you can build the same source code using different compiler options and test, to verify if they produce the same result.