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.
I'm calling a user program to make a file called buildNr.h which contains
#define _BUILD_ 123
This file is included in the project. I inserted the command into the "Options for Target - User - Run User ..." This works but the disadvantage is, the tool is called every time a file gets compiled and since the project contains >12 files its timeconsuming and increments _BUILD_ by 12. Any better solution?
Ref: http://www.keil.com/forum/docs/thread10615.asp
You never did say why you can't just use __DATE__ and __TIME__ ...?
Anyhow, add the thing that creates the header as a separate item, and make it the very first in the project: that way it won't be run on every individual compile - only when you build or rebuild-all.
See also: http://www.keil.com/forum/docs/thread780.asp
Hi Peter
there is a solution. I add a project folder with a textfile name.txt In the dialogbox option for name.txt enter in the field Custom Arguments: yourprog.exe output.h File type is Custom file Check the Always build and every time you compile the desired header is created one time.
Guenter
"Check the Always build and every time you compile..."
The method is correct, but that description is not quite accurate:
As I said, it doesn't get run with each compile (ie, each individual source file) - only when you build (or rebuild) the Project
Thank you to Andy and Günter. That's a good solution - but: Using "Build Target" or "Rebuild all Targets" the tool gets called eyery time. Actually I expected to increment _BUILD_ only if I rebuild all files.
You never did say why you can't just use __DATE__ and __TIME__ ...? The customer wants Date, Time and Build !!
I don't think there's any way to have it called only on a rebuild-all and not just a build.
But I'm not sure why you'd want to do that. Surely, if any file is recompiled, then you need to identify the final image as different from any previous image - so it should get a new Build Number?
Or perhaps I'm misunderstanding your requirement of a "Build Number"?
Actually it's no problem, but if I have to compile many times until the new feature is finished (bug corrected ;-)) I don't like to demonstrate this by a very increased build number. Howeever, for this situation I would correct the number manually.
I do not know if this is suitable for you: In our projects, we define some bytes at fixed location and are patching the build number after the linker run by using "After Build/Rebuild: Run User Program #1". By this, a new number is only assigned if the build was completed successfully.
I need DATE and TIME in old style.
And it doesn't matter if I change 1, 2, ... or all source files. If I get a new output file I need the current DATE+TIME cause it's not the same the the one before.
I would expect that a BUILD number is also incremented.
But I haven't a solution to run the tool only at rebuild all, sorry.
G.
Another good idea. I will think about it. Thanks.
"a new number is only assigned if the build was completed successfully"
Yes, but a successful build does not indicate that the bug has been fixed, or that the new feature is complete, does it?
"Actually it's no problem, but if I have to compile many times until the new feature is finished (bug corrected ;-)) I don't like to demonstrate this by a very increased build number."
I see.
So this is not really something that should be automated at all! It should be part of your release process - only when the "release candidate" has ticked all the boxes should it be rebuilt with a new build number...
My approch is as follow: During testing I only compile the modified files using "Build Target". When testing is finished I'll use "Build all Target Files". That's the moment I want to increment _BUILD_.
Yes, but a successful build does not indicate that the bug has been fixed, or that the new feature is complete, does it? Of course not. It is just a build number. For customer releases, the build number becomes a release label.