Version number postfix based on build

We have multiple builds in our project. I would like to add a post-fix of the build to the version number, to identify the different builds. For example:
Build A: Version should be: “1.2.3-A”
Build B: Version should be: “1.2.3-B”

With Application Settings (generated.c/h) it seems not possible to add a post-fix to the version number. Is that correct?

I figured that because it is not possible with generated.c/h, I should disable the code generation and build my own code. I tried to make a copy of generated.c and .h, keeping the same contents. My builds with “Enable code generation” disabled (in Application settings), fail with the following error message: make: *** No rule to make target build.properties', needed byMSW01_01_pack.zip’. Stop.

If I diff the build.properties I see that version, company and name are missing . Which steps do I need to take to build my code without automatic code generation?

Edit:
I am using Developer Studio V2.3.2 in combination with the internal makefile builder.

DS appends automatically a “qualifier” to the version when generating the code (if the preference is enabled, as it should be by default).
This qualifier is updated each time the application code is modified.

Hello daav. Thanks for your reply. Where can I find this Qualifier. Is it available on Developer Studio 2.3.2?

Yes it is available in DS 2.3.2
This is configured in the Preferences > Developer Studio > Build page.
Default value should be yyyyMMddHHmmss

What I don’t understand is that I only see a qualifier for a time-stamp there. Is it possible to add a predefined string, based on the active build, e.g. a defined symbol?

The qualifier is generated using Java SimpleDateFormat class.
As stated here: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html, it is possible to quote static text with single quotes (’).
Unfortunately, no other dynamic possibilities are implemented for the qualifier generation.

So with this qualifier it is not possible to automate my build process: I need to add a fixed qualifier which is different per build, which is not possible with the Java SimpleDateFormat class.

Therefore I would like to know is which steps I need to take to make code link without errors without using the code generation (generated.c/.h).
I can build version numbers with a fixed qualifier using string concatenation, I already build that.
See my opening post for the error that I receive linking without code generation.

Hmmmm, sounds like makefile builder is not compatible with disabling the code generation.
Anyway, you can give a try by disabling it anyway, and add a pre-build step (in Project Properties > C/C++ Build > Settings > Build Steps)
This step needs to stand in one command line, but you can use a call to a custom script (“cmd /c prebuild.bat”) responsible to generate both a .c file and the build.properties file required by the following steps.

Thanks daav. Do you know if the disabled code generation is compatible with the makefile builder in the latest Developer studio versions?

I’m afraid not, this part was not updated since 2.3.2
I’ve logged the point to have a look at it for a future version.

So this means you can only use a build-all with the internal builder if you use the same version number for all builds, am I correct?

What I don’t like about generation my own build.properties is that I also need to put in information like robase, baseband, patchDwlVersion. I don’t want to mess with those.

Isn’t there any other way to have a custom version number per build, using a build-all with the internal builder? Is there a point I overlooked?

Anyway it should be fixed in the future. Will there also be a patch for the 2.3.2 Developer version?

When you’re talking about “all builds”, do you mean successive builds of the same project with the same Build Configuration, or a simple build (same source code) with different Build Configurations? I’m not sure to fully understand your use case.

We have single source code that should generate different outputs. For this I implemented a build per output, and use build-all to build all outputs with a single press of the button. So a simple build (same source code) with different Build Configurations.

Oh, OK, and that’s why your’re using the makefile builder, because the Build All Configurations is not working well with the Internal Builder.
And so your real need is to have a different qualifier per Build Configuration, in order to identify your different builds once deployed on the field, correct?

Correct 100%. And we identified already that it is currently only possible to generate a time qualifier. For this reasoning I disabled “automatic code generation” but this results in linker errors because build.properties is missing entries, see my post below.

As a workaround I developed a post-build script which generates my own build.properties. However I would like to pass the version number to this post-build script call.
Is it possible to make a variable that I can both use in my source code and in my post-build call?

  1. A define in my code cannot be added as parameter for the post-build script.
  2. A “Build Variable” cannot be used in the source code.

How can I make a single parameter that I can use both in the post-build script and my version number inside my source code?