# Version number postfix based on build

**URL:** <https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690>\
**Category:** Development tools\
**Created:** [January 19, 2015, 10:31am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690 "2015-01-19T10:31:26Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 19, 2015, 10:31am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/1 "2015-01-19T10:31:26Z")

</div>

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 by`MSW01\_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.

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 20, 2015, 6:55am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/2 "2015-01-20T06:55:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 20, 2015, 8:45am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/3 "2015-01-20T08:45:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 21, 2015, 4:21pm UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/4 "2015-01-21T16:21:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Geert](https://avatars.discourse-cdn.com/v4/letter/g/848f3c/32.png) [@Geert](https://forum.sierrawireless.com/u/Geert)\
**Post date:** [January 22, 2015, 10:39am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/5 "2015-01-22T10:39:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 23, 2015, 8:35am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/6 "2015-01-23T08:35:05Z")

</div>

The qualifier is generated using Java SimpleDateFormat class.  
As stated here: [https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html](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.

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 26, 2015, 9:26am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/7 "2015-01-26T09:26:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 27, 2015, 7:04am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/8 "2015-01-27T07:04:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 27, 2015, 7:59am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/9 "2015-01-27T07:59:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 28, 2015, 8:07am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/10 "2015-01-28T08:07:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 28, 2015, 11:07am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/11 "2015-01-28T11:07:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 29, 2015, 7:04am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/12 "2015-01-29T07:04:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [January 29, 2015, 7:52am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/13 "2015-01-29T07:52:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![daav](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/daav/32/2767_2.png) [@daav](https://forum.sierrawireless.com/u/daav)\
**Post date:** [January 30, 2015, 9:00am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/14 "2015-01-30T09:00:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![GeertVisser](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/geertvisser/32/1709_2.png) [@GeertVisser](https://forum.sierrawireless.com/u/GeertVisser)\
**Post date:** [February 2, 2015, 10:12am UTC](https://forum.sierrawireless.com/t/version-number-postfix-based-on-build/7690/15 "2015-02-02T10:12:03Z")

</div>

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?
