Recent

Author Topic: Automatically change Version Numbering based on build mode  (Read 2469 times)

celso

  • New Member
  • *
  • Posts: 10
Automatically change Version Numbering based on build mode
« on: September 27, 2016, 08:58:50 pm »
I´m trying to use the option below to automatically change the version of my application:

Project Options > Version Numbering, the option "Automatically increase build number"

I use a build mode called "Release Week Version", to make a distribution version of my application, it´s released once a week. Every time I make a build, in any mode, the build number increases, but the other numbers never does, just manually.

Is there a way to automatically increase the "Revision Number" for example every time I build using the "Relase Week Version" mode?

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: Automatically change Version Numbering based on build mode
« Reply #1 on: September 27, 2016, 10:59:12 pm »
AFAIK there is no automation for this in the IDE.
I think you would have to disable the integrated version info tool in the IDE and create your own version info resource file in the pre-build step (with a custom, small console app).

See here:
http://www.freepascal.org/docs-html/3.0.0/fclres/versionresource/tversionresource.html
With this you should be able to automate any data in the version resource.

Then include the resulting *.res file into your project source and build your project.

Never done this though, just my ideas.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Automatically change Version Numbering based on build mode
« Reply #2 on: September 28, 2016, 02:58:54 am »
Is there a way to automatically increase the "Revision Number" for example every time I build using the "Relase Week Version" mode?

Just write a little console app that reads the project's .lpi file, finds the revision number, increases it, then saves the .lpi file.

Then run lazbuild to build the project. No need even to open Lazarus. You could put both of these in a batch or script file and run it whenever you want to do a release.

This project has a unit VersInfoListEx.pas with a LoadFromLpi method that shows how easy it is to read the .lpi file - it's just XML:

https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/LazXProj.html

 

TinyPortal © 2005-2018