[Lazarus] Version info

Graeme Geldenhuys graeme at geldenhuys.co.uk
Mon Sep 17 19:09:23 CEST 2012


On 17/09/12 17:06, Mark Morgan Lloyd wrote:
>
> I sympathise with the OP though: the Lazarus IDE has facilities to
> insert version information, so how can you get at that even if it means

Yeah, those options are pretty pointless on any platform - except Windows.


> And for that matter, how can one merge svn information into it? :-)

All my apps, linux & windows, gui & console, supports a --version 
parameter. When I want to include repository information like SHA1 (git) 
or Revision (svn), then I use include files that set a value for a 
version constant. I do the same for the FPC version.

For example, here are some constants for one of my apps...

NOTE the formatting for FPC version and application compiled date. They 
are like macros.


   cMajorVersion             = 3;
   cMinorVersion             = 0;
   cBuildVersion: string     = {$I revision.inc} // '006-rc1';
   cCompileDateTime: string  = {$I %date%} + ' ' + {$I %time%};
   cFPCVersion: string  = {$I %fpcversion%};
   // Name + cMajorVersion + cMinorVersion + Build + cBuildVersion
   cAppNameFormatStr         = '%s v%d.%2.2d (%s %s)';
   // Name + cMajorVersion + cMinorVersion + Centre
   cAppNameCentreFormatStr   = '%s v%d.%2.2d - [%s]';
   cAppNameCGI               = '%s v%d.%2.2d';


I also have a VERSION-GEN script that gets executed before I do a Build 
All. It generates output as shown below, which I normally pipe into a 
*.inc file, and get set as a constant in my application.

      '3.0.12.9.gbcfb.dirty';

This gives me lots of information:
    3  - major version
    0  - minor version
   12  - build number
    9  - commits since the last released version (v3.0.12)
    gbcfb - the SHA1 value of the last commit in my git repository
            (if you don't know git, this is live a revision number)
    dirty - this tells me the build was made, but I had local changes
            that wasn't committed in the repository yet.

The next released version will be v3.0.13 - we don't really use the 
minor version number in our company software. The formatting string 
above shows how we display version information to the end-user.

Regards,
   - Graeme -





More information about the Lazarus mailing list